[MM-17069] Api endpoint to unread a channel (#11794)

* [MM-17069] endpoint to unread a channel from post

* [MM-17069] update mock

* [MM-17069] first passing test

* [MM-17069] fix SQL typo

* [MM-17069] fix msgCount

* add tests

* [MM-17069] Fix tests

* [MM-16069] Remove trash, add comments

* [MM-16069] Add message to errors

* [MM-17069] fix go fmt

* [MM-17069] return an UnreadChannel response

* [MM-17069] added unauthorized test

* [MM-17069] fix operator

* [MM-17069] refactor tests

* [MM-16069] back to green tests

* [MM-17069] change url to include user

* [MM-17069] Fixing code review comments

* [MM-17069] One shouldn't fix manually what a machine can fix better

* [MM-17069] change response type, update tests

* [MM-17069] fix permission error

* [MM-17069] Add tests for edit_other_users permission

* [MM-17069] no magic numbers
Этот коммит содержится в:
Guillermo Vayá
2019-08-21 14:48:25 +02:00
коммит произвёл Harrison Healey
родитель bd152c6534
Коммит 6b0f4f1aee
10 изменённых файлов: 365 добавлений и 0 удалений

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

@@ -2480,6 +2480,16 @@ func (c *Client4) PatchPost(postId string, patch *PostPatch) (*Post, *Response)
return PostFromJson(r.Body), BuildResponse(r)
}
// SetPostUnread marks channel where post belongs as unread on the time of the provided post.
func (c *Client4) SetPostUnread(userId string, postId string) *Response {
r, err := c.DoApiPost(c.GetUserRoute(userId)+c.GetPostRoute(postId)+"/set_unread", "")
if err != nil {
return BuildErrorResponse(r, err)
}
defer closeBody(r)
return BuildResponse(r)
}
// PinPost pin a post based on provided post id string.
func (c *Client4) PinPost(postId string) (bool, *Response) {
r, err := c.DoApiPost(c.GetPostRoute(postId)+"/pin", "")