Fixed a bug where non-admin user wasn't able to edit their scheduled post (#29084)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6fd464a398
Коммит
800407f956
@@ -37,25 +37,26 @@ type Props = {
|
|||||||
|
|
||||||
function mapStateToProps(state: GlobalState, props: Props) {
|
function mapStateToProps(state: GlobalState, props: Props) {
|
||||||
const config = getConfig(state);
|
const config = getConfig(state);
|
||||||
|
const currentUserId = getCurrentUserId(state);
|
||||||
|
|
||||||
let editingPost;
|
let editingPost;
|
||||||
let channelId: string;
|
let channelId: string;
|
||||||
let draft;
|
let draft;
|
||||||
|
let isAuthor;
|
||||||
|
|
||||||
if (props.scheduledPost) {
|
if (props.scheduledPost) {
|
||||||
editingPost = {post: null};
|
editingPost = {post: null};
|
||||||
channelId = props.scheduledPost.channel_id;
|
channelId = props.scheduledPost.channel_id;
|
||||||
draft = getPostDraft(state, StoragePrefixes.EDIT_DRAFT, props.scheduledPost.id);
|
draft = getPostDraft(state, StoragePrefixes.EDIT_DRAFT, props.scheduledPost.id);
|
||||||
|
isAuthor = true;
|
||||||
} else {
|
} else {
|
||||||
editingPost = getEditingPost(state);
|
editingPost = getEditingPost(state);
|
||||||
channelId = editingPost.post.channel_id;
|
channelId = editingPost.post.channel_id;
|
||||||
draft = getPostDraft(state, StoragePrefixes.EDIT_DRAFT, editingPost.postId);
|
draft = getPostDraft(state, StoragePrefixes.EDIT_DRAFT, editingPost.postId);
|
||||||
|
isAuthor = editingPost?.post?.user_id === currentUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentUserId = getCurrentUserId(state);
|
|
||||||
const teamId = getCurrentTeamId(state);
|
const teamId = getCurrentTeamId(state);
|
||||||
|
|
||||||
const isAuthor = editingPost?.post?.user_id === currentUserId;
|
|
||||||
const deletePermission = isAuthor ? Permissions.DELETE_POST : Permissions.DELETE_OTHERS_POSTS;
|
const deletePermission = isAuthor ? Permissions.DELETE_POST : Permissions.DELETE_OTHERS_POSTS;
|
||||||
const editPermission = isAuthor ? Permissions.EDIT_POST : Permissions.EDIT_OTHERS_POSTS;
|
const editPermission = isAuthor ? Permissions.EDIT_POST : Permissions.EDIT_OTHERS_POSTS;
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user