diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-18 15:06:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-18 15:06:03 +0300 |
commit | 16d9f66e9651d35b52e5a167789befe7b861292c (patch) | |
tree | 38ffe73aeffa5bc8ceaa3357db302edce6d874f6 /app/assets/javascripts/sidebar | |
parent | 5333cb6c7c960aac58af40c898c87d050d829383 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/sidebar')
3 files changed, 31 insertions, 1 deletions
diff --git a/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions.vue b/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions.vue index 95a2c8cce6e..91fe5fc50a9 100644 --- a/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions.vue +++ b/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions.vue @@ -33,6 +33,8 @@ export default { <div class="block subscriptions"> <subscriptions :loading="store.isFetching.subscriptions" + :project-emails-disabled="store.projectEmailsDisabled" + :subscribe-disabled-description="store.subscribeDisabledDescription" :subscribed="store.subscribed" @toggleSubscription="onToggleSubscription" /> diff --git a/app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue b/app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue index ea5edb3ce3f..0e489b28593 100644 --- a/app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue +++ b/app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue @@ -26,6 +26,16 @@ export default { required: false, default: false, }, + projectEmailsDisabled: { + type: Boolean, + required: false, + default: false, + }, + subscribeDisabledDescription: { + type: String, + required: false, + default: '', + }, subscribed: { type: Boolean, required: false, @@ -42,11 +52,23 @@ export default { return this.subscribed === null; }, notificationIcon() { + if (this.projectEmailsDisabled) { + return ICON_OFF; + } return this.subscribed ? ICON_ON : ICON_OFF; }, notificationTooltip() { + if (this.projectEmailsDisabled) { + return this.subscribeDisabledDescription; + } return this.subscribed ? LABEL_ON : LABEL_OFF; }, + notificationText() { + if (this.projectEmailsDisabled) { + return this.subscribeDisabledDescription; + } + return __('Notifications'); + }, }, methods: { /** @@ -81,6 +103,7 @@ export default { <template> <div> <span + ref="tooltip" v-tooltip class="sidebar-collapsed-icon" :title="notificationTooltip" @@ -96,8 +119,9 @@ export default { class="sidebar-item-icon is-active" /> </span> - <span class="issuable-header-text hide-collapsed float-left"> {{ __('Notifications') }} </span> + <span class="issuable-header-text hide-collapsed float-left"> {{ notificationText }} </span> <toggle-button + v-if="!projectEmailsDisabled" ref="toggleButton" :is-loading="showLoadingState" :value="subscribed" diff --git a/app/assets/javascripts/sidebar/stores/sidebar_store.js b/app/assets/javascripts/sidebar/stores/sidebar_store.js index 63c4a2a3f84..66f7f9e3c66 100644 --- a/app/assets/javascripts/sidebar/stores/sidebar_store.js +++ b/app/assets/javascripts/sidebar/stores/sidebar_store.js @@ -28,6 +28,8 @@ export default class SidebarStore { this.moveToProjectId = 0; this.isLockDialogOpen = false; this.participants = []; + this.projectEmailsDisabled = false; + this.subscribeDisabledDescription = ''; this.subscribed = null; SidebarStore.singleton = this; @@ -53,6 +55,8 @@ export default class SidebarStore { } setSubscriptionsData(data) { + this.projectEmailsDisabled = data.project_emails_disabled || false; + this.subscribeDisabledDescription = data.subscribe_disabled_description; this.isFetching.subscriptions = false; this.subscribed = data.subscribed || false; } |