MM-46410: adds urgency on mention counts (#20999)
* MM-46410: adds urgency on mention counts We have introduced priority for posts in https://github.com/mattermost/mattermost-webapp/pull/10951. We do need to color the mention badges in the webapp with a prominent color when a mention is posted in an urgent message. A thread has urgent mentions if the root post is marked as urgent, and the replies contain mentions to the user viewing the thread. This PR adds a column, urgentmentioncount, in channelmembers. Furthermore when asking for team/thread mention counts, we also return urgent mention counts for the user. Adds a new table to hold posts priorities Refactors priority out of the props and into the new table We are nilifying Metadata when post.ForPlugin(), which didn't save Priority for a post when Boards was enabled. This commit copies metadata again to the post, so metadata are reinstated. Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Vishal Choudhary <vish9812@gmail.com>
Этот коммит содержится в:
@@ -71,6 +71,10 @@ const (
|
||||
PostPropsGroupHighlightDisabled = "disable_group_highlight"
|
||||
|
||||
PostPropsPreviewedPost = "previewed_post"
|
||||
|
||||
PostPriorityUrgent = "urgent"
|
||||
PostPropsRequestedAck = "requested_ack"
|
||||
PostPropsPersistentNotifications = "persistent_notifications"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -158,6 +162,15 @@ type PostReminder struct {
|
||||
UserId string `json:",omitempty"`
|
||||
}
|
||||
|
||||
type PostPriority struct {
|
||||
Priority *string `json:"priority"`
|
||||
RequestedAck *bool `json:"requested_ack"`
|
||||
PersistentNotifications *bool `json:"persistent_notifications"`
|
||||
// These fields are only used internally for interacting with DB.
|
||||
PostId string `json:",omitempty"`
|
||||
ChannelId string `json:",omitempty"`
|
||||
}
|
||||
|
||||
type SearchParameter struct {
|
||||
Terms *string `json:"terms"`
|
||||
IsOrSearch *bool `json:"is_or_search"`
|
||||
@@ -306,6 +319,7 @@ type GetPostsOptions struct {
|
||||
FromCreateAt int64 // CreateAt after which to send the items
|
||||
Direction string // Only accepts up|down. Indicates the order in which to send the items.
|
||||
IncludeDeleted bool
|
||||
IncludePostPriority bool
|
||||
}
|
||||
|
||||
type PostCountOptions struct {
|
||||
@@ -770,3 +784,20 @@ func (o *Post) GetPreviewedPostProp() string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (o *Post) GetPriority() *PostPriority {
|
||||
if o.Metadata != nil && o.Metadata.Priority != nil {
|
||||
return o.Metadata.Priority
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Post) IsUrgent() bool {
|
||||
postPriority := o.GetPriority()
|
||||
if postPriority == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return *postPriority.Priority == PostPriorityUrgent
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user