Skip to content

Commit

Permalink
Merge pull request #27 from epochtalk/todos
Browse files Browse the repository at this point in the history
Todos
  • Loading branch information
akinsey authored Feb 1, 2022
2 parents f33bb2f + 026e741 commit 5a4da43
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
14 changes: 10 additions & 4 deletions src/components/modals/posts/MoveThread.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<template>
<modal :name="$options.name" :show="show" @close="close()">
<modal :name="$options.name" :show="show" @close="close()" :focusInput="focusInput">
<template v-slot:header>Move Thread</template>
<template v-slot:body>
<form name="$parent.form" class="css-form" novalidate>
<label>Select a board to move this thread to:</label>
<div class="control-full-width">
<!-- TODO(boka): modal-focus="{{PostsParentCtrl.showMoveThreadModal}}" -->
<select name="boards" id="moveThreadBoards" v-model="newBoard">
<select name="boards" id="moveThreadBoards" v-model="newBoard" ref="focusInput" class="boards-select">
<optgroup v-for="(boards, parentName) in boardsMovelist" :label="parentName" :key="parentName">
<option v-for="board in boards" :value="board" :key="decode(board.name)">{{decode(board.name)}}</option>
</optgroup>
Expand Down Expand Up @@ -52,7 +51,8 @@ export default {
const v = reactive({
threadId: props.threadId,
boardsMovelist: {},
newBoard: null
newBoard: null,
focusInput: null
})
boardsApi.movelist()
Expand All @@ -74,3 +74,9 @@ export default {
}
}
</script>
<style lang="scss">
.boards-select:focus {
border-color: darken($border-color, 10%);
background-color: $color-highlighted;
}
</style>
1 change: 0 additions & 1 deletion src/components/modals/posts/PurgePost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<template v-slot:body>
<form action="." class="css-form">
<h3 class="thin-underline">Purge Post</h3>
<p>Are you sure you want to permanently delete this post?</p>
<div class="clear">
<button id="purge-btn" class="fill-row" @click.prevent="purgePost()" type="submit">
Expand Down
2 changes: 0 additions & 2 deletions src/components/modals/posts/Report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

<template v-slot:body>
<form action="." class="css-form" @submit.prevent="submitReport()">
<h3 class="thin-underline">Purge Post</h3>
<p v-if="canReportPosts && canReportUsers && !selectedPost.reported">Which would you like to report?</p>
<!-- TODO(boka): default radio button choice -->
<input v-if="canReportUsers" type="radio" ref="focusInput" name="reportPost" v-model="offendingId" :value="selectedPost.user.id" id="reportUser" required checked="true"><label v-if="canReportUsers" for="reportUser">{{selectedPost.user.username}}</label>
<input v-if="canReportPosts" type="radio" name="reportPost" v-model="offendingId" :value="selectedPost.id" id="reportPost" required><label v-if="canReportPosts" for="reportPost">{{selectedPost.user.username}}'s Post</label>
<label>Reason for Report</label>
Expand Down
24 changes: 15 additions & 9 deletions src/views/Messages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,18 @@ export default {
}
}
const addQuote = message => console.log(message)
const canDeleteConversation = () => v.loggedIn && $auth.permissionUtils.hasPermission('conversations.delete.allow')
const canDeleteMessage = (messageUserId) => {
const canDeleteConversation = () => v.loggedIn && v.controlAccess.deleteConversations
const canDeleteMessage = messageSenderId => {
if (!v.loggedIn) return false
if (!$auth.permissionUtils.hasPermission('messages.delete.allow')) return false
return messageUserId === v.authedUser.id || $auth.permissionUtils.hasPermission('messages.delete.bypass.owner')
}
if (!v.controlAccess.deleteMessages) return false
const canCreateConversation = () => v.loggedIn && $auth.permissionUtils.hasPermission('conversations.create.allow')
const canCreateMessage = () => v.loggedIn && $auth.permissionUtils.hasPermission('messages.create.allow')
// check message ownership/bypass
if (messageSenderId === v.authedUser.id) return true
else if (v.controlAccess.ownerBypassDeleteMessages) return true
else return false
}
const canCreateConversation = () => v.loggedIn && v.controlAccess.createConversations
const canCreateMessage = () => v.loggedIn && v.controlAccess.createMessages
// Stops split view in mobile from breaking after creating new conversation
// Hacky, handle mobile split view
Expand Down Expand Up @@ -362,6 +363,11 @@ export default {
showEditor: false,
editorConvoMode: false,
controlAccess: {
createConversations: $auth.permissionUtils.hasPermission('conversations.create.allow'),
deleteConversations: $auth.permissionUtils.hasPermission('conversations.delete.allow'),
createMessages: $auth.permissionUtils.hasPermission('messages.create.allow'),
deleteMessages: $auth.permissionUtils.hasPermission('messages.delete.allow'),
ownerBypassDeleteMessages: $auth.permissionUtils.hasPermission('messages.delete.bypass.owner'),
reportMessages: $auth.permissionUtils.hasPermission('reports.createMessageReport')
}
})
Expand Down

0 comments on commit 5a4da43

Please sign in to comment.