Merge branch 'master' of github.com:mattermost/mattermost-server into top-dms-clean
Этот коммит содержится в:
@@ -18,30 +18,30 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
HeaderRequestId = "X-Request-ID"
|
||||
HeaderVersionId = "X-Version-ID"
|
||||
HeaderClusterId = "X-Cluster-ID"
|
||||
HeaderEtagServer = "ETag"
|
||||
HeaderEtagClient = "If-None-Match"
|
||||
HeaderForwarded = "X-Forwarded-For"
|
||||
HeaderRealIP = "X-Real-IP"
|
||||
HeaderForwardedProto = "X-Forwarded-Proto"
|
||||
HeaderToken = "token"
|
||||
HeaderCsrfToken = "X-CSRF-Token"
|
||||
HeaderBearer = "BEARER"
|
||||
HeaderAuth = "Authorization"
|
||||
HeaderCloudToken = "X-Cloud-Token"
|
||||
HeaderRemoteclusterToken = "X-RemoteCluster-Token"
|
||||
HeaderRemoteclusterId = "X-RemoteCluster-Id"
|
||||
HeaderRequestedWith = "X-Requested-With"
|
||||
HeaderRequestedWithXML = "XMLHttpRequest"
|
||||
HeaderHasInaccessiblePosts = "Has-Inaccessible-Posts"
|
||||
HeaderRange = "Range"
|
||||
STATUS = "status"
|
||||
StatusOk = "OK"
|
||||
StatusFail = "FAIL"
|
||||
StatusUnhealthy = "UNHEALTHY"
|
||||
StatusRemove = "REMOVE"
|
||||
HeaderRequestId = "X-Request-ID"
|
||||
HeaderVersionId = "X-Version-ID"
|
||||
HeaderClusterId = "X-Cluster-ID"
|
||||
HeaderEtagServer = "ETag"
|
||||
HeaderEtagClient = "If-None-Match"
|
||||
HeaderForwarded = "X-Forwarded-For"
|
||||
HeaderRealIP = "X-Real-IP"
|
||||
HeaderForwardedProto = "X-Forwarded-Proto"
|
||||
HeaderToken = "token"
|
||||
HeaderCsrfToken = "X-CSRF-Token"
|
||||
HeaderBearer = "BEARER"
|
||||
HeaderAuth = "Authorization"
|
||||
HeaderCloudToken = "X-Cloud-Token"
|
||||
HeaderRemoteclusterToken = "X-RemoteCluster-Token"
|
||||
HeaderRemoteclusterId = "X-RemoteCluster-Id"
|
||||
HeaderRequestedWith = "X-Requested-With"
|
||||
HeaderRequestedWithXML = "XMLHttpRequest"
|
||||
HeaderFirstInaccessiblePostTime = "First-Inaccessible-Post-Time"
|
||||
HeaderRange = "Range"
|
||||
STATUS = "status"
|
||||
StatusOk = "OK"
|
||||
StatusFail = "FAIL"
|
||||
StatusUnhealthy = "UNHEALTHY"
|
||||
StatusRemove = "REMOVE"
|
||||
|
||||
ClientDir = "client"
|
||||
|
||||
@@ -103,7 +103,7 @@ func (c *Client4) boolString(value bool) string {
|
||||
|
||||
func closeBody(r *http.Response) {
|
||||
if r.Body != nil {
|
||||
_, _ = io.Copy(ioutil.Discard, r.Body)
|
||||
_, _ = io.Copy(io.Discard, r.Body)
|
||||
_ = r.Body.Close()
|
||||
}
|
||||
}
|
||||
@@ -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", "")
|
||||
@@ -4419,6 +4436,24 @@ func (c *Client4) GetFileInfosForPost(postId string, etag string) ([]*FileInfo,
|
||||
return list, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// GetFileInfosForPost gets all the file info objects attached to a post, including deleted
|
||||
func (c *Client4) GetFileInfosForPostIncludeDeleted(postId string, etag string) ([]*FileInfo, *Response, error) {
|
||||
r, err := c.DoAPIGet(c.postRoute(postId)+"/files/info"+"?include_deleted="+c.boolString(true), etag)
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
var list []*FileInfo
|
||||
if r.StatusCode == http.StatusNotModified {
|
||||
return list, BuildResponse(r), nil
|
||||
}
|
||||
if jsonErr := json.NewDecoder(r.Body).Decode(&list); jsonErr != nil {
|
||||
return nil, nil, NewAppError("GetFileInfosForPostIncludeDeleted", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return list, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// General/System Section
|
||||
|
||||
// GenerateSupportPacket downloads the generated support packet
|
||||
|
||||
Ссылка в новой задаче
Block a user