Skip to content

Commit

Permalink
Merge pull request #5363 from nextcloud/bugfix/noid/allow-actions-whe…
Browse files Browse the repository at this point in the history
…n-locked

Allow some actions on locked rooms
  • Loading branch information
marcoambrosini committed Mar 12, 2021
2 parents efbe25c + 79e7e1b commit 75c9c7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions lib/Model/Message.php
Expand Up @@ -156,6 +156,10 @@ public function getActorDisplayName(): string {
* Specifies whether a message can be replied to
*/
public function isReplyable(): bool {
if ($this->getRoom()->getReadOnly() === Room::READ_ONLY) {
return false;
}

return $this->getMessageType() !== 'system' &&
$this->getMessageType() !== 'command' &&
$this->getMessageType() !== 'comment_deleted' &&
Expand Down
18 changes: 10 additions & 8 deletions src/components/MessagesList/MessagesGroup/Message/Message.vue
Expand Up @@ -118,6 +118,7 @@ the main body of the message as well as a quote.
</div>
<!-- Message Actions -->
<div
v-if="hasActions"
v-show="showActions"
class="message-body__main__right__actions"
:class="{ 'tall' : isTallEnough }">
Expand All @@ -130,7 +131,6 @@ the main body of the message as well as a quote.
</ActionButton>
</Actions>
<Actions
v-show="hasActionsMenu"
:force-menu="true"
container="#content-vue">
<ActionButton
Expand All @@ -141,14 +141,12 @@ the main body of the message as well as a quote.
{{ t('spreed', 'Reply privately') }}
</ActionButton>
<ActionButton
v-if="isReplyable"
icon="icon-external"
:close-after-click="true"
@click.stop.prevent="handleCopyMessageLink">
{{ t('spreed', 'Copy message link') }}
</ActionButton>
<ActionButton
v-if="isReplyable"
:close-after-click="true"
@click.stop="handleMarkAsUnread">
{{ t('spreed', 'Mark as unread') }}
Expand All @@ -165,7 +163,7 @@ the main body of the message as well as a quote.
</ActionButton>
</template>
<template v-if="isDeleteable">
<ActionSeparator v-if="isReplyable || messageActions.length > 0" />
<ActionSeparator />
<ActionButton
icon="icon-delete"
:close-after-click="true"
Expand Down Expand Up @@ -398,10 +396,6 @@ export default {
return this.$store.getters.message(this.token, this.id)
},
hasActionsMenu() {
return (this.isPrivateReplyable || this.isReplyable || this.isDeleteable || this.messageActions.length > 0) && !this.isConversationReadOnly
},
isConversationReadOnly() {
return this.conversation.readOnly === CONVERSATION.STATE.READ_ONLY
},
Expand Down Expand Up @@ -519,6 +513,10 @@ export default {
return this.isSystemMessage || !this.showActions || this.isTallEnough
},
hasActions() {
return !this.isSystemMessage
},
isTemporaryUpload() {
return this.isTemporary && this.messageParameters.file
},
Expand Down Expand Up @@ -555,6 +553,10 @@ export default {
},
isDeleteable() {
if (this.isConversationReadOnly) {
return false
}
const isFileShare = this.message === '{file}'
&& this.messageParameters?.file
Expand Down

0 comments on commit 75c9c7a

Please sign in to comment.