diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-08-16 14:41:47 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-08-16 14:41:47 -0400 |
commit | 8203fd16ce3356d69b0cc51287d0a1fc25318b2d (patch) | |
tree | a25893649505d0a75fc1d0aac16790b3e07981c4 /api/post_test.go | |
parent | dde158c57f24e6da6ad5d05eebc104fccec855e8 (diff) | |
download | chat-8203fd16ce3356d69b0cc51287d0a1fc25318b2d.tar.gz chat-8203fd16ce3356d69b0cc51287d0a1fc25318b2d.tar.bz2 chat-8203fd16ce3356d69b0cc51287d0a1fc25318b2d.zip |
PLT-3647 Email Batching (#3718)
* PLT-3647 Added config settings for email batching
* PLT-3647 Refactored generation of email notification
* PLT-3647 Added serverside code for email batching
* PLT-3647 Updated settings UI to enable email batching
* PLT-3647 Removed debug code
* PLT-3647 Fixed 0-padding of minutes in batched notification
* PLT-3647 Updated clientside UI for when email batching is disabled
* Go fmt
* PLT-3647 Changed email batching to be disabled by default
* Updated batched email message
* Added email batching toggle to system console
* Changed Email Notifications > Immediate setting to a 30 second batch interval
* Go fmt
* Fixed link to Mattermost icon in batched email notification
* Updated users to use 30 second email batching by default
* Fully disabled email batching when clustering is enabled
* Fixed email batching setting in the system console
* Fixed casing of 'Send Email notifications' -> 'Send email notifications'
* Updating UI Improvements for email batching (#3736)
* Updated text for notification settings and SiteURL.
* Prevented enabling email batching when SiteURL isn't set in the system console
* Re-added a couple debug messages
* Added warning text when clustering is enabled
Diffstat (limited to 'api/post_test.go')
-rw-r--r-- | api/post_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/api/post_test.go b/api/post_test.go index f27e843da..2239e92cd 100644 --- a/api/post_test.go +++ b/api/post_test.go @@ -1147,3 +1147,42 @@ func TestGetFlaggedPosts(t *testing.T) { t.Fatal("should not have gotten a flagged post") } } + +func TestGetMessageForNotification(t *testing.T) { + Setup() + translateFunc := utils.GetUserTranslations("en") + + post := &model.Post{ + Message: "test", + Filenames: model.StringArray{}, + } + + if getMessageForNotification(post, translateFunc) != "test" { + t.Fatal("should've returned message text") + } + + post.Filenames = model.StringArray{"test1.png"} + if getMessageForNotification(post, translateFunc) != "test" { + t.Fatal("should've returned message text, even with attachments") + } + + post.Message = "" + if message := getMessageForNotification(post, translateFunc); message != "1 image sent: test1.png" { + t.Fatal("should've returned number of images:", message) + } + + post.Filenames = model.StringArray{"test1.png", "test2.jpg"} + if message := getMessageForNotification(post, translateFunc); message != "2 images sent: test1.png, test2.jpg" { + t.Fatal("should've returned number of images:", message) + } + + post.Filenames = model.StringArray{"test1.go"} + if message := getMessageForNotification(post, translateFunc); message != "1 file sent: test1.go" { + t.Fatal("should've returned number of files:", message) + } + + post.Filenames = model.StringArray{"test1.go", "test2.jpg"} + if message := getMessageForNotification(post, translateFunc); message != "2 files sent: test1.go, test2.jpg" { + t.Fatal("should've returned number of mixed files:", message) + } +} |