MM-33746 Add TotalMsgCountRoot and MsgCountRoot columns (#17150)

Этот коммит содержится в:
Eli Yukelzon
2021-03-31 16:51:02 +03:00
коммит произвёл GitHub
родитель ee3f986da0
Коммит ab5925c4de
22 изменённых файлов: 356 добавлений и 103 удалений

Просмотреть файл

@@ -1871,6 +1871,7 @@ func (a *App) GetChannelUnread(channelID, userID string) (*model.ChannelUnread,
if channelUnread.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_MARK_UNREAD_MENTION {
channelUnread.MsgCount = 0
channelUnread.MsgCountRoot = 0
}
return channelUnread, nil

Просмотреть файл

@@ -1411,7 +1411,7 @@ func (a *App) countMentionsFromPost(user *model.User, post *model.Post) (int, *m
if channel.Type == model.CHANNEL_DIRECT {
// In a DM channel, every post made by the other user is a mention
count, nErr := a.Srv().Store.Channel().CountPostsAfter(post.ChannelId, post.CreateAt-1, channel.GetOtherUserIdForDM(user.Id))
count, _, nErr := a.Srv().Store.Channel().CountPostsAfter(post.ChannelId, post.CreateAt-1, channel.GetOtherUserIdForDM(user.Id))
if nErr != nil {
return 0, model.NewAppError("countMentionsFromPost", "app.channel.count_posts_since.app_error", nil, nErr.Error(), http.StatusInternalServerError)
}

Просмотреть файл

@@ -1133,12 +1133,14 @@ func (a *App) AddTeamMemberByInviteId(inviteId, userID string) (*model.TeamMembe
func (a *App) GetTeamUnread(teamID, userID string) (*model.TeamUnread, *model.AppError) {
channelUnreads, err := a.Srv().Store.Team().GetChannelUnreadsForTeam(teamID, userID)
if err != nil {
return nil, model.NewAppError("GetTeamUnread", "app.team.get_unread.app_error", nil, err.Error(), http.StatusInternalServerError)
}
var teamUnread = &model.TeamUnread{
MsgCount: 0,
MsgCountRoot: 0,
MentionCount: 0,
TeamId: teamID,
}
@@ -1148,6 +1150,7 @@ func (a *App) GetTeamUnread(teamID, userID string) (*model.TeamUnread, *model.Ap
if cu.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] != model.CHANNEL_MARK_UNREAD_MENTION {
teamUnread.MsgCount += cu.MsgCount
teamUnread.MsgCountRoot += cu.MsgCountRoot
}
}
@@ -1677,6 +1680,7 @@ func (a *App) GetTeamsUnreadForUser(excludeTeamId string, userID string) ([]*mod
if cu.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] != model.CHANNEL_MARK_UNREAD_MENTION {
tu.MsgCount += cu.MsgCount
tu.MsgCountRoot += cu.MsgCountRoot
}
return tu
@@ -1689,6 +1693,7 @@ func (a *App) GetTeamsUnreadForUser(excludeTeamId string, userID string) ([]*mod
} else {
membersMap[id] = unreads(data[i], &model.TeamUnread{
MsgCount: 0,
MsgCountRoot: 0,
MentionCount: 0,
TeamId: id,
})