Mark category as read (#24003)
* Mark category as read * Fix lint and test * Fix tests * Fix test and remove wrong aria * Address server issues and add mark as read for unreads * Missing changes * Fix tests * fix tests * Add confirmation popup to mark as read category * Always use viewMultipleChannels and other fixes * Remove unneeded code * Fix test * Address feedback * Address feedback * Fix tests * Fix test * Fix tests * Update aria-haspopup depending on the number of channels to mark as viewed --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c1c07ba1bb
Коммит
e9b3afecc2
@@ -3540,6 +3540,27 @@ func (c *Client4) ViewChannel(ctx context.Context, userId string, view *ChannelV
|
||||
return ch, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// ReadMultipleChannels performs a view action on several channels at the same time for a user.
|
||||
func (c *Client4) ReadMultipleChannels(ctx context.Context, userId string, channelIds []string) (*ChannelViewResponse, *Response, error) {
|
||||
url := fmt.Sprintf(c.channelsRoute()+"/members/%v/mark_read", userId)
|
||||
buf, err := json.Marshal(channelIds)
|
||||
if err != nil {
|
||||
return nil, nil, NewAppError("ReadMultipleChannels", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
r, err := c.DoAPIPostBytes(ctx, url, buf)
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
var ch *ChannelViewResponse
|
||||
err = json.NewDecoder(r.Body).Decode(&ch)
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), NewAppError("ReadMultipleChannels", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return ch, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// GetChannelUnread will return a ChannelUnread object that contains the number of
|
||||
// unread messages and mentions for a user.
|
||||
func (c *Client4) GetChannelUnread(ctx context.Context, channelId, userId string) (*ChannelUnread, *Response, error) {
|
||||
|
||||
@@ -48,6 +48,7 @@ const (
|
||||
WebsocketEventResponse = "response"
|
||||
WebsocketEventEmojiAdded = "emoji_added"
|
||||
WebsocketEventChannelViewed = "channel_viewed"
|
||||
WebsocketEventMultipleChannelsViewed = "multiple_channels_viewed"
|
||||
WebsocketEventPluginStatusesChanged = "plugin_statuses_changed"
|
||||
WebsocketEventPluginEnabled = "plugin_enabled"
|
||||
WebsocketEventPluginDisabled = "plugin_disabled"
|
||||
|
||||
Ссылка в новой задаче
Block a user