Hackathon: Post Reminders (#20555)
This PR adds the post reminder backend work. We add a new API endpoint via which a user can set a reminder for a post. An ephemeral message will be sent down the line to let the user know about the action. And then after the time is over, the system admin bot will send a DM message to the user about the reminder post.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e6459b97de
Коммит
20cb042362
@@ -3743,6 +3743,23 @@ func (c *Client4) SetPostUnread(userId string, postId string, collapsedThreadsSu
|
||||
return BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// SetPostReminder creates a post reminder for a given post at a specified time.
|
||||
// The time needs to be in UTC epoch in seconds. It is always truncated to a
|
||||
// 5 minute resolution minimum.
|
||||
func (c *Client4) SetPostReminder(reminder *PostReminder) (*Response, error) {
|
||||
b, err := json.Marshal(reminder)
|
||||
if err != nil {
|
||||
return nil, NewAppError("SetPostReminder", "api.marshal_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
r, err := c.DoAPIPostBytes(c.userRoute(reminder.UserId)+c.postRoute(reminder.PostId)+"/reminder", b)
|
||||
if err != nil {
|
||||
return BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
return BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// PinPost pin a post based on provided post id string.
|
||||
func (c *Client4) PinPost(postId string) (*Response, error) {
|
||||
r, err := c.DoAPIPost(c.postRoute(postId)+"/pin", "")
|
||||
|
||||
Ссылка в новой задаче
Block a user