From ddb0895ac09eff3e71cd94b3a508d4d50ec1361f Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Fri, 10 Jul 2020 10:55:57 +0200 Subject: [PATCH] me.index: Hide "Email Notifications" until the feature is fully developed --- app/controllers/me/index.js | 6 ++++ app/templates/me/index.hbs | 62 +++++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/app/controllers/me/index.js b/app/controllers/me/index.js index afde321415c..819577fda16 100644 --- a/app/controllers/me/index.js +++ b/app/controllers/me/index.js @@ -1,6 +1,8 @@ import Controller from '@ember/controller'; +import { computed } from '@ember/object'; import { alias, sort, filterBy, notEmpty } from '@ember/object/computed'; import { inject as service } from '@ember/service'; +import Ember from 'ember'; import ajax from '../../utils/ajax'; @@ -22,6 +24,10 @@ export default Controller.extend({ emailNotificationsError: false, emailNotificationsSuccess: false, + hasEmailNotificationFeature: computed(function () { + return Ember.testing; + }), + setAllEmailNotifications(value) { this.get('ownedCrates').forEach(c => { c.set('email_notifications', value); diff --git a/app/templates/me/index.hbs b/app/templates/me/index.hbs index 6ec8ae9f64c..280de67f093 100644 --- a/app/templates/me/index.hbs +++ b/app/templates/me/index.hbs @@ -25,38 +25,46 @@

Email Notification Preferences

-

- To aid detection of unauthorized crate changes, we email you each time a new version of a crate you own is pushed. - By receiving and reading these emails, you help protect the Rust ecosystem. You may also choose to turn these - emails off for any of your crates listed below. -

+ {{#if this.hasEmailNotificationFeature}} +

+ To aid detection of unauthorized crate changes, we email you each time a new version of a crate you own is pushed. + By receiving and reading these emails, you help protect the Rust ecosystem. You may also choose to turn these + emails off for any of your crates listed below. +

-
- - -
+
+ + +
- + -
- {{#if this.emailNotificationsError}} -
- An error occurred while saving your email preferences. +
+ {{#if this.emailNotificationsError}} +
+ An error occurred while saving your email preferences. +
+ {{/if}} + {{#if this.emailNotificationsSuccess}} +
+ Your email notification preferences have been updated! +
+ {{/if}} +
+
- {{/if}} - {{#if this.emailNotificationsSuccess}} -
- Your email notification preferences have been updated! -
- {{/if}} -
-
-
+ {{else}} +

+ To aid detection of unauthorized crate changes, we plan to email you each time a new version of a crate you own is + pushed. This feature is still work-in-progress, if you want to help out have a look at + #1895. +

+ {{/if}}