Skip to content

Commit

Permalink
Display disabled message form in read-only rooms
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Oct 13, 2020
1 parent cbb16c0 commit 51debd5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</transition>
<MessagesList
:token="token" />
<NewMessageForm v-if="!isReadOnly" />
<NewMessageForm />
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default {
*/
placeholderText: {
type: String,
default: t('spreed', 'Write message, @ to mention someone …'),
default: '',
},
/**
Expand Down
16 changes: 15 additions & 1 deletion src/components/NewMessageForm/NewMessageForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
</Actions>
</div>
<div
v-if="!isReadOnly"
class="new-message-form__button">
<EmojiPicker @select="addEmoji">
<button
Expand All @@ -80,11 +81,14 @@
ref="advancedInput"
v-model="text"
:token="token"
:active-input="!isReadOnly"
:placeholder-text="placeholderText"
@update:contentEditable="contentEditableToParsed"
@submit="handleSubmit"
@files-pasted="handleFiles" />
</div>
<button
:disabled="isReadOnly"
type="submit"
:aria-label="t('spreed', 'Send message')"
class="new-message-form__button submit icon-confirm-fade"
Expand Down Expand Up @@ -149,6 +153,16 @@ export default {
}
},
isReadOnly() {
return this.conversation.readOnly === CONVERSATION.STATE.READ_ONLY
},
placeholderText() {
return this.isReadOnly
? t('spreed', 'This conversation has been locked')
: t('spreed', 'Write message, @ to mention someone …')
},
messageToBeReplied() {
return this.$store.getters.getMessageToBeReplied(this.token)
},
Expand All @@ -158,7 +172,7 @@ export default {
},
canShareAndUploadFiles() {
return !this.currentUserIsGuest && this.conversation.readOnly === CONVERSATION.STATE.READ_WRITE
return !this.currentUserIsGuest && !this.isReadOnly
},
attachmentFolder() {
Expand Down

0 comments on commit 51debd5

Please sign in to comment.