Skip to content

Commit

Permalink
Read-only conversation tweaks
Browse files Browse the repository at this point in the history
Moved isConversationReadOnly condition on the reply action button
instead of affecting all possible (future) actions.

Now using `showError` instead of the global OC notification, the
displayed border now has the correct color.

Renamed "room" to "conversation" in the error message.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Oct 13, 2020
1 parent efdbcd4 commit 9b50e33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/components/MessagesList/MessagesGroup/Message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ the main body of the message as well as a quote.
{{ messageTime }}
</h6>
<Actions
v-show="showActions && hasActions && !isConversationReadOnly"
v-show="showActions && hasActions"
class="message__main__right__actions">
<ActionButton
v-if="isReplyable"
Expand Down Expand Up @@ -217,7 +217,7 @@ export default {
computed: {
hasActions() {
return this.isReplyable
return this.isReplyable && !this.isConversationReadOnly
},
isConversationReadOnly() {
Expand Down
12 changes: 3 additions & 9 deletions src/components/NewMessageForm/NewMessageForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

<script>
import AdvancedInput from './AdvancedInput/AdvancedInput'
import { getFilePickerBuilder } from '@nextcloud/dialogs'
import { getFilePickerBuilder, showError } from '@nextcloud/dialogs'
import { postNewMessage } from '../../services/messagesService'
import Quote from '../Quote'
import Actions from '@nextcloud/vue/dist/Components/Actions'
Expand Down Expand Up @@ -277,15 +277,9 @@ export default {
}
// 403 when room is read-only, 412 when switched to lobby mode
if (statusCode === 403 || statusCode === 412) {
OC.Notification.show(
t('spreed', 'No permission to post messages in this room'),
{ type: 'error' }
)
showError(t('spreed', 'No permission to post messages in this conversation'))
} else {
OC.Notification.show(
t('spreed', 'Could not post message: {errorMessage}', { errorMessage: error.message || error }),
{ type: 'error' }
)
showError(t('spreed', 'Could not post message: {errorMessage}', { errorMessage: error.message || error }))
}
// restore message to allow re-sending
Expand Down

0 comments on commit 9b50e33

Please sign in to comment.