mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-32253] Fix "Cannot mark unread a DM message in a thread" (#16794)
Automatic Merge
This commit is contained in:
committed by
GitHub
parent
13616cac0f
commit
ff970e080b
@@ -837,7 +837,7 @@ func (a *App) getGroupsAllowedForReferenceInChannel(channel *model.Channel, team
|
||||
groupsMap := make(map[string]*model.Group)
|
||||
opts := model.GroupSearchOpts{FilterAllowReference: true}
|
||||
|
||||
if channel.IsGroupConstrained() || team.IsGroupConstrained() {
|
||||
if channel.IsGroupConstrained() || (team != nil && team.IsGroupConstrained()) {
|
||||
var groups []*model.GroupWithSchemeAdmin
|
||||
if channel.IsGroupConstrained() {
|
||||
groups, err = a.Srv().Store.Group().GetGroupsByChannel(channel.Id, opts)
|
||||
|
||||
12
app/post.go
12
app/post.go
@@ -1343,10 +1343,6 @@ func (a *App) MaxPostSize() int {
|
||||
|
||||
// countThreadMentions returns the number of times the user is mentioned in a specified thread after the timestamp.
|
||||
func (a *App) countThreadMentions(user *model.User, post *model.Post, teamId string, timestamp int64) (int64, *model.AppError) {
|
||||
team, err := a.GetTeam(teamId)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
channel, err := a.GetChannel(post.ChannelId)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@@ -1379,6 +1375,14 @@ func (a *App) countThreadMentions(user *model.User, post *model.Post, teamId str
|
||||
return int64(count), nil
|
||||
}
|
||||
|
||||
var team *model.Team
|
||||
if teamId != "" {
|
||||
team, err = a.GetTeam(teamId)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
|
||||
groups, nErr := a.getGroupsAllowedForReferenceInChannel(channel, team)
|
||||
if nErr != nil {
|
||||
return 0, model.NewAppError("countMentionsFromPost", "app.channel.count_posts_since.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user