Skip to content

Commit

Permalink
feat: port create permissions code over for editor, extracted outside…
Browse files Browse the repository at this point in the history
… of editor
  • Loading branch information
akinsey committed Nov 9, 2021
1 parent 27686a5 commit 97f08b6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/components/layout/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,11 @@ import Multiselect from '@vueform/multiselect'
import { usersApi } from '@/api'
export default {
props: ['editorConvoMode', 'threadEditorMode', 'postEditorMode', 'createAction', 'updateAction', 'showEditor', 'thread', 'currentMessage', 'post', 'quote' ],
props: ['editorConvoMode', 'threadEditorMode', 'postEditorMode', 'createAction', 'updateAction', 'showEditor', 'thread', 'currentMessage', 'post', 'quote', 'canCreate' ],
emits: ['close'],
components: { ImageUploader, PollCreator, Multiselect },
setup(props, { emit }) {
/* Internal Methods */
const canCreate = () => true
const canUpdate = () => true
const canLock = () => true
const canSticky = () => true
Expand Down Expand Up @@ -345,7 +344,7 @@ export default {
}
})
return { ...toRefs(v), canLock, canCreate, canUpdate, canSticky, canModerate, canCreatePoll, cancel, closeEditor, onPollValidation }
return { ...toRefs(v), canLock, canUpdate, canSticky, canModerate, canCreatePoll, cancel, closeEditor, onPollValidation }
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/Messages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<delete-conversation-modal :show="showDeleteConversationModal" :conversation-id="selectedDeletedConvoId" @close="showDeleteConversationModal = false" @success="reload()" />
<delete-message-modal :show="showDeleteMessageModal" :message-id="selectedMessageId" @close="showDeleteMessageModal = false" @success="deleteMessageSuccess()" />
<report-message-modal :show="showReportMessageModal" :message-id="selectedMessageId" @close="showReportMessageModal = false" @success="showReportMessageModal = false" />
<editor :showEditor="showEditor" @close="showEditor = false" :editorConvoMode="editorConvoMode" :current-message="{ conversation_id: newMessage?.conversation_id, receiver_ids: newMessage?.receiver_ids, content: { body: newMessage?.content?.body } }" :create-action="createConversation" :update-action="createMessage" />
<editor :showEditor="showEditor" @close="showEditor = false" :editorConvoMode="editorConvoMode" :current-message="{ conversation_id: newMessage?.conversation_id, receiver_ids: newMessage?.receiver_ids, content: { body: newMessage?.content?.body } }" :create-action="createConversation" :update-action="createMessage" :can-create="canCreateConversation" :can-update="canCreateMessage" />
</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/Posts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
<posts-move-thread-modal v-if="canMove()" :threadId="postData.data.thread?.id" :show="showPostsMoveThreadModal" @close="showPostsMoveThreadModal = false"/>
<posts-purge-thread-modal :threadId="postData.data.thread?.id" :boardId="postData.data.board?.id" :boardSlug="postData.data.board?.slug" :show="showPostsPurgeThreadModal" @close="showPostsPurgeThreadModal = false"/>
<posts-report-modal :selectedPost="selectedPost" :canReportPosts="true" :canReportUsers="true" :show="showPostsReportModal" @close="showPostsReportModal = false; selectedPost = null" />
<editor :showEditor="showEditor" @close="showEditor = false" :postEditorMode="true" :thread="postData.data?.thread" :quote="quote" :post="editPost" :createAction="createPost" :updateAction="updatePost" />
<editor :showEditor="showEditor" @close="showEditor = false" :postEditorMode="true" :thread="postData.data?.thread" :quote="quote" :post="editPost" :createAction="createPost" :updateAction="updatePost" :canCreate="canPost" />
</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/Threads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<pagination v-if="threadData.data?.board" :page="threadData.data.page" :limit="threadData.data.limit" :count="threadData.data.board.thread_count"></pagination>
</div>
<set-moderators-modal v-if="threadData.data?.board" :board="threadData.data.board" :show="showSetModerators" @close="showSetModerators = false"></set-moderators-modal>
<editor v-if="threadData.data?.board" :showEditor="showEditor" @close="showEditor = false" :threadEditorMode="true" :thread="{ title: '', board_id: threadData?.data?.board.id }" :createAction="createThread" />
<editor v-if="threadData.data?.board" :showEditor="showEditor" @close="showEditor = false" :threadEditorMode="true" :thread="{ title: '', board_id: threadData?.data?.board.id }" :createAction="createThread" :canCreate="canCreate" />
</template>

<script>
Expand Down

0 comments on commit 97f08b6

Please sign in to comment.