Merge remote-tracking branch 'upstream/master' into people-product-init

Этот коммит содержится в:
Benjamin Cooke
2022-09-28 13:20:14 -04:00
родитель 3a370e1818 f5f036d94b
Коммит 1f4f59aaa0
47 изменённых файлов: 1444 добавлений и 125 удалений

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

@@ -35,6 +35,7 @@ const (
HeaderRequestedWith = "X-Requested-With"
HeaderRequestedWithXML = "XMLHttpRequest"
HeaderFirstInaccessiblePostTime = "First-Inaccessible-Post-Time"
HeaderFirstInaccessibleFileTime = "First-Inaccessible-File-Time"
HeaderRange = "Range"
STATUS = "status"
StatusOk = "OK"
@@ -3925,11 +3926,15 @@ func (c *Client4) GetPostThreadWithOpts(postID string, etag string, opts GetPost
}
// GetPostsForChannel gets a page of posts with an array for ordering for a channel.
func (c *Client4) GetPostsForChannel(channelId string, page, perPage int, etag string, collapsedThreads bool) (*PostList, *Response, error) {
func (c *Client4) GetPostsForChannel(channelId string, page, perPage int, etag string, collapsedThreads bool, includeDeleted bool) (*PostList, *Response, error) {
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
if collapsedThreads {
query += "&collapsedThreads=true"
}
if includeDeleted {
query += "&include_deleted=true"
}
r, err := c.DoAPIGet(c.channelRoute(channelId)+"/posts"+query, etag)
if err != nil {
return nil, BuildResponse(r), err
@@ -4050,11 +4055,14 @@ func (c *Client4) GetPostsSince(channelId string, time int64, collapsedThreads b
}
// GetPostsAfter gets a page of posts that were posted after the post provided.
func (c *Client4) GetPostsAfter(channelId, postId string, page, perPage int, etag string, collapsedThreads bool) (*PostList, *Response, error) {
func (c *Client4) GetPostsAfter(channelId, postId string, page, perPage int, etag string, collapsedThreads bool, includeDeleted bool) (*PostList, *Response, error) {
query := fmt.Sprintf("?page=%v&per_page=%v&after=%v", page, perPage, postId)
if collapsedThreads {
query += "&collapsedThreads=true"
}
if includeDeleted {
query += "&include_deleted=true"
}
r, err := c.DoAPIGet(c.channelRoute(channelId)+"/posts"+query, etag)
if err != nil {
return nil, BuildResponse(r), err
@@ -4071,11 +4079,14 @@ func (c *Client4) GetPostsAfter(channelId, postId string, page, perPage int, eta
}
// GetPostsBefore gets a page of posts that were posted before the post provided.
func (c *Client4) GetPostsBefore(channelId, postId string, page, perPage int, etag string, collapsedThreads bool) (*PostList, *Response, error) {
func (c *Client4) GetPostsBefore(channelId, postId string, page, perPage int, etag string, collapsedThreads bool, includeDeleted bool) (*PostList, *Response, error) {
query := fmt.Sprintf("?page=%v&per_page=%v&before=%v", page, perPage, postId)
if collapsedThreads {
query += "&collapsedThreads=true"
}
if includeDeleted {
query += "&include_deleted=true"
}
r, err := c.DoAPIGet(c.channelRoute(channelId)+"/posts"+query, etag)
if err != nil {
return nil, BuildResponse(r), err

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

@@ -188,3 +188,17 @@ func GetEtagForFileInfos(infos []*FileInfo) string {
return Etag(infos[0].PostId, maxUpdateAt)
}
func (fi *FileInfo) MakeContentInaccessible() {
if fi == nil {
return
}
fi.Archived = true
fi.Content = ""
fi.HasPreviewImage = false
fi.MiniPreview = nil
fi.Path = ""
fi.PreviewPath = ""
fi.ThumbnailPath = ""
}

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

@@ -12,6 +12,8 @@ type FileInfoList struct {
FileInfos map[string]*FileInfo `json:"file_infos"`
NextFileInfoId string `json:"next_file_info_id"`
PrevFileInfoId string `json:"prev_file_info_id"`
// If there are inaccessible files, FirstInaccessibleFileTime is the time of the latest inaccessible file
FirstInaccessibleFileTime int64 `json:"first_inaccessible_file_time"`
}
func NewFileInfoList() *FileInfoList {

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

@@ -28,6 +28,7 @@ const (
JobTypeResendInvitationEmail = "resend_invitation_email"
JobTypeExtractContent = "extract_content"
JobTypeLastAccessiblePost = "last_accessible_post"
JobTypeLastAccessibleFile = "last_accessible_file"
JobTypeUpgradeNotifyAdmin = "upgrade_notify_admin"
JobTypeTrialNotifyAdmin = "trial_notify_admin"
@@ -59,6 +60,7 @@ var AllJobTypes = [...]string{
JobTypeCloud,
JobTypeExtractContent,
JobTypeLastAccessiblePost,
JobTypeLastAccessibleFile,
}
type Job struct {

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

@@ -73,6 +73,7 @@ var PermissionDeleteOthersEmojis *Permission
var PermissionCreatePost *Permission
var PermissionCreatePostPublic *Permission
var PermissionCreatePostEphemeral *Permission
var PermissionReadDeletedPosts *Permission
var PermissionEditPost *Permission
var PermissionEditOthersPosts *Permission
var PermissionDeletePost *Permission
@@ -708,6 +709,12 @@ func initializePermissions() {
"authentication.permissions.create_post_ephemeral.description",
PermissionScopeChannel,
}
PermissionReadDeletedPosts = &Permission{
"read_deleted_posts",
"authentication.permissions.read_deleted_posts.name",
"authentication.permissions.read_deleted_posts.description",
PermissionScopeChannel,
}
PermissionEditPost = &Permission{
"edit_post",
"authentication.permissions.edit_post.name",
@@ -2302,6 +2309,7 @@ func initializePermissions() {
PermissionCreatePost,
PermissionCreatePostPublic,
PermissionCreatePostEphemeral,
PermissionReadDeletedPosts,
PermissionEditPost,
PermissionEditOthersPosts,
PermissionDeletePost,

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

@@ -304,6 +304,7 @@ type GetPostsOptions struct {
FromPost string // PostId after which to send the items
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
}
type PostCountOptions struct {

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

@@ -32,6 +32,7 @@ const (
SystemFirstAdminVisitMarketplace = "FirstAdminVisitMarketplace"
SystemFirstAdminSetupComplete = "FirstAdminSetupComplete"
SystemLastAccessiblePostTime = "LastAccessiblePostTime"
SystemLastAccessibleFileTime = "LastAccessibleFileTime"
AwsMeteringReportInterval = 1
AwsMeteringDimensionUsageHrs = "UsageHrs"
)