MM-20897 Add category muting (#16225)
* Make UpdateSidebarCategories return the original categories * MM-20897 Add category muting * Prevent muting the DMs category * Fix muted state not being stored in the database * Address feedback * Address some feedback * Fix unit tests * MM-20897 Mute/unmute channels in the database in bulk * Satisfy golangci-lint
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7f6b43a15f
Коммит
2ebc8ec90f
@@ -164,6 +164,18 @@ func (o *ChannelMember) GetRoles() []string {
|
||||
return strings.Fields(o.Roles)
|
||||
}
|
||||
|
||||
func (o *ChannelMember) SetChannelMuted(muted bool) {
|
||||
if o.IsChannelMuted() {
|
||||
o.NotifyProps[MARK_UNREAD_NOTIFY_PROP] = CHANNEL_MARK_UNREAD_ALL
|
||||
} else {
|
||||
o.NotifyProps[MARK_UNREAD_NOTIFY_PROP] = CHANNEL_MARK_UNREAD_MENTION
|
||||
}
|
||||
}
|
||||
|
||||
func (o *ChannelMember) IsChannelMuted() bool {
|
||||
return o.NotifyProps[MARK_UNREAD_NOTIFY_PROP] == CHANNEL_MARK_UNREAD_MENTION
|
||||
}
|
||||
|
||||
func IsChannelNotifyLevelValid(notifyLevel string) bool {
|
||||
return notifyLevel == CHANNEL_NOTIFY_DEFAULT ||
|
||||
notifyLevel == CHANNEL_NOTIFY_ALL ||
|
||||
|
||||
@@ -46,6 +46,7 @@ type SidebarCategory struct {
|
||||
Sorting SidebarCategorySorting `json:"sorting"`
|
||||
Type SidebarCategoryType `json:"type"`
|
||||
DisplayName string `json:"display_name"`
|
||||
Muted bool `json:"muted"`
|
||||
}
|
||||
|
||||
// SidebarCategoryWithChannels combines data from SidebarCategory table with the Channel IDs that belong to that category
|
||||
|
||||
Ссылка в новой задаче
Block a user