Automatic Merge
Этот коммит содержится в:
Harshil Sharma
2026-05-25 15:54:05 +05:30
коммит произвёл GitHub
родитель c0ea57ac6c
Коммит 36ac3a43b1
28 изменённых файлов: 602 добавлений и 31 удалений

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

@@ -6,6 +6,7 @@ package api4
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/v8/channels/app"
"github.com/mattermost/mattermost/server/v8/channels/utils"
)
func userCreatePostPermissionCheckWithContext(c *Context, channelId string) {
@@ -69,3 +70,14 @@ func checkUploadFilePermissionForNewFiles(c *Context, newFileIds []string, origi
}
}
}
// checkEditFileAttachmentPermission checks edit_file_attachment permission
// when file IDs are being changed (files added or removed) during post edit.
func checkEditFileAttachmentPermission(c *Context, newFileIds []string, originalPost *model.Post) {
if utils.SliceEqualUnordered(newFileIds, originalPost.FileIds) {
return
}
if ok, _ := c.App.SessionHasPermissionToChannel(c.AppContext, *c.AppContext.Session(), originalPost.ChannelId, model.PermissionEditFileAttachment); !ok {
c.SetPermissionError(model.PermissionEditFileAttachment)
}
}