[MM-38579] Removing some town square permissions stuff (#18464)
* removing some town square permissions stuff * fixing error * adding back in channel leave check * removing tests Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Этот коммит содержится в:
20
api4/post.go
20
api4/post.go
@@ -713,13 +713,6 @@ func saveIsPinnedPost(c *Context, w http.ResponseWriter, isPinned bool) {
|
||||
return
|
||||
}
|
||||
|
||||
// Restrict pinning if the experimental read-only-town-square setting is on.
|
||||
user, err := c.App.GetUser(c.AppContext.Session().UserId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
post, err := c.App.GetSinglePost(c.Params.PostId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
@@ -727,19 +720,6 @@ func saveIsPinnedPost(c *Context, w http.ResponseWriter, isPinned bool) {
|
||||
}
|
||||
auditRec.AddMeta("post", post)
|
||||
|
||||
channel, err := c.App.GetChannel(post.ChannelId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
if c.App.Srv().License() != nil &&
|
||||
channel.Name == model.DefaultChannelName &&
|
||||
!c.App.RolesGrantPermission(user.GetRoles(), model.PermissionManageSystem.Id) {
|
||||
c.Err = model.NewAppError("saveIsPinnedPost", "api.post.save_is_pinned_post.town_square_read_only", nil, "", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
patch := &model.PostPatch{}
|
||||
patch.IsPinned = model.NewBool(isPinned)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user