Skip to content

Commit

Permalink
Merge pull request #10491 from nextcloud/fix/10419/hide-message-expir…
Browse files Browse the repository at this point in the history
…ation

Hide message expiration set-up for non-moderators
  • Loading branch information
Antreesy authored Sep 12, 2023
2 parents 7736c08 + 2957491 commit 946a1f1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@
<NotificationsSettings :conversation="conversation" />
</NcAppSettingsSection>

<NcAppSettingsSection id="conversation-settings"
<NcAppSettingsSection v-if="canFullModerate"
id="conversation-settings"
:title="t('spreed', 'Moderation')">
<ListableSettings v-if="canFullModerate"
:token="token" />
<LinkShareSettings v-if="canFullModerate"
ref="linkShareSettings" />
<ListableSettings :token="token" />
<LinkShareSettings ref="linkShareSettings" />
<ExpirationSettings :token="token" can-full-moderate />
</NcAppSettingsSection>
<NcAppSettingsSection v-else
id="conversation-settings"
:title="t('spreed', 'Setup summary')">
<ExpirationSettings :token="token" />
</NcAppSettingsSection>

Expand Down
35 changes: 27 additions & 8 deletions src/components/ConversationSettings/ExpirationSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,26 @@
<div class="app-settings-section__hint">
{{ t('spreed', 'Chat messages can be expired after a certain time. Note: Files shared in chat will not be deleted for the owner, but will no longer be shared in the conversation.') }}
</div>
<NcSelect :value="selectedOption"
:options="expirationOptions"
label="label"
close-on-select
:clearable="false"
@option:selected="changeExpiration" />

<template v-if="canFullModerate">
<label for="moderation_settings_message_expiration" class="app-settings-section__label">
{{ t('spreed', 'Set message expiration') }}
</label>
<NcSelect id="moderation_settings_message_expiration"
:value="selectedOption"
:options="expirationOptions"
label="label"
close-on-select
:clearable="false"
@option:selected="changeExpiration" />
</template>

<template v-else>
<h5 class="app-settings-section__subtitle">
{{ t('spreed', 'Current message expiration') }}
</h5>
<p>{{ selectedOption.label }}</p>
</template>
</div>
</template>

Expand All @@ -53,6 +67,11 @@ export default {
type: String,
default: null,
},

canFullModerate: {
type: Boolean,
default: false,
},
},

data() {
Expand Down Expand Up @@ -132,7 +151,7 @@ export default {
</script>

<style lang="scss" scoped>
:deep(.mx-input) {
margin: 0;
.app-settings-section__label {
display: block;
}
</style>

0 comments on commit 946a1f1

Please sign in to comment.