MM-17071 Add mention counting when marking a post as unread (#11966)
* Add different types for different mentions * Remove redundant THREAD_ANY and THREAD_ROOT constants * Make PostStore.Get return thread in order * MM-17071 Add initial version of countMentionsFromPost * MM-17071 Refactor comment mention counting * MM-17071 Use mention counting when marking post as unread * Fix shadowing in tests * Remove repeated check of user count * Refactor code using MentionType * Update comments around -1 return value * Move inner functions out of countMentionsFromPost * Remove preconditions check as separate test case * Update comments * Add User.GetMentionKeys * Revert "Make PostStore.Get return thread in order" This reverts commit 22aa010cee359655fe75e1dc899cf0ffb0943c2a. * Fix tests * Fix merge conflict * Add store.MentionAllPosts
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5f28ce9de0
Коммит
e6f67c664c
@@ -572,13 +572,13 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
},
|
||||
"full message, public channel, commented on post": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ROOT,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ROOT,
|
||||
ChannelType: model.CHANNEL_OPEN,
|
||||
ExpectedMessage: "user: this is a message",
|
||||
},
|
||||
"full message, public channel, commented on thread": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ANY,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ANY,
|
||||
ChannelType: model.CHANNEL_OPEN,
|
||||
ExpectedMessage: "user: this is a message",
|
||||
},
|
||||
@@ -595,13 +595,13 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
},
|
||||
"full message, private channel, commented on post": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ROOT,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ROOT,
|
||||
ChannelType: model.CHANNEL_PRIVATE,
|
||||
ExpectedMessage: "user: this is a message",
|
||||
},
|
||||
"full message, private channel, commented on thread": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ANY,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ANY,
|
||||
ChannelType: model.CHANNEL_PRIVATE,
|
||||
ExpectedMessage: "user: this is a message",
|
||||
},
|
||||
@@ -618,13 +618,13 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
},
|
||||
"full message, group message channel, commented on post": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ROOT,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ROOT,
|
||||
ChannelType: model.CHANNEL_GROUP,
|
||||
ExpectedMessage: "user: this is a message",
|
||||
},
|
||||
"full message, group message channel, commented on thread": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ANY,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ANY,
|
||||
ChannelType: model.CHANNEL_GROUP,
|
||||
ExpectedMessage: "user: this is a message",
|
||||
},
|
||||
@@ -641,13 +641,13 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
},
|
||||
"full message, direct message channel, commented on post": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ROOT,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ROOT,
|
||||
ChannelType: model.CHANNEL_DIRECT,
|
||||
ExpectedMessage: "this is a message",
|
||||
},
|
||||
"full message, direct message channel, commented on thread": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ANY,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ANY,
|
||||
ChannelType: model.CHANNEL_DIRECT,
|
||||
ExpectedMessage: "this is a message",
|
||||
},
|
||||
@@ -673,14 +673,14 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
},
|
||||
"generic message, public channel, commented on post": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ROOT,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ROOT,
|
||||
PushNotificationContents: model.GENERIC_NOTIFICATION,
|
||||
ChannelType: model.CHANNEL_OPEN,
|
||||
ExpectedMessage: "user commented on your post.",
|
||||
},
|
||||
"generic message, public channel, commented on thread": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ANY,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ANY,
|
||||
PushNotificationContents: model.GENERIC_NOTIFICATION,
|
||||
ChannelType: model.CHANNEL_OPEN,
|
||||
ExpectedMessage: "user commented on a thread you participated in.",
|
||||
@@ -707,14 +707,14 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
},
|
||||
"generic message, public private, commented on post": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ROOT,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ROOT,
|
||||
PushNotificationContents: model.GENERIC_NOTIFICATION,
|
||||
ChannelType: model.CHANNEL_PRIVATE,
|
||||
ExpectedMessage: "user commented on your post.",
|
||||
},
|
||||
"generic message, public private, commented on thread": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ANY,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ANY,
|
||||
PushNotificationContents: model.GENERIC_NOTIFICATION,
|
||||
ChannelType: model.CHANNEL_PRIVATE,
|
||||
ExpectedMessage: "user commented on a thread you participated in.",
|
||||
@@ -741,14 +741,14 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
},
|
||||
"generic message, group message channel, commented on post": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ROOT,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ROOT,
|
||||
PushNotificationContents: model.GENERIC_NOTIFICATION,
|
||||
ChannelType: model.CHANNEL_GROUP,
|
||||
ExpectedMessage: "user commented on your post.",
|
||||
},
|
||||
"generic message, group message channel, commented on thread": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ANY,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ANY,
|
||||
PushNotificationContents: model.GENERIC_NOTIFICATION,
|
||||
ChannelType: model.CHANNEL_GROUP,
|
||||
ExpectedMessage: "user commented on a thread you participated in.",
|
||||
@@ -775,14 +775,14 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
},
|
||||
"generic message, direct message channel, commented on post": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ROOT,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ROOT,
|
||||
PushNotificationContents: model.GENERIC_NOTIFICATION,
|
||||
ChannelType: model.CHANNEL_DIRECT,
|
||||
ExpectedMessage: "sent you a message.",
|
||||
},
|
||||
"generic message, direct message channel, commented on thread": {
|
||||
Message: "this is a message",
|
||||
replyToThreadType: THREAD_ANY,
|
||||
replyToThreadType: model.COMMENTS_NOTIFY_ANY,
|
||||
PushNotificationContents: model.GENERIC_NOTIFICATION,
|
||||
ChannelType: model.CHANNEL_DIRECT,
|
||||
ExpectedMessage: "sent you a message.",
|
||||
|
||||
Ссылка в новой задаче
Block a user