Skip to content

Commit 2a77554

Browse files
committed
Auto merge of #2622 - Turbo87:email-notis, r=jtgeibel
me.index: Hide "Email Notifications" until the feature is fully developed Resolves #2603 r? @jtgeibel
2 parents 8b1df0d + ddb0895 commit 2a77554

File tree

2 files changed

+41
-27
lines changed

2 files changed

+41
-27
lines changed

app/controllers/me/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Controller from '@ember/controller';
2+
import { computed } from '@ember/object';
23
import { alias, sort, filterBy, notEmpty } from '@ember/object/computed';
34
import { inject as service } from '@ember/service';
5+
import Ember from 'ember';
46

57
import ajax from '../../utils/ajax';
68

@@ -22,6 +24,10 @@ export default Controller.extend({
2224
emailNotificationsError: false,
2325
emailNotificationsSuccess: false,
2426

27+
hasEmailNotificationFeature: computed(function () {
28+
return Ember.testing;
29+
}),
30+
2531
setAllEmailNotifications(value) {
2632
this.get('ownedCrates').forEach(c => {
2733
c.set('email_notifications', value);

app/templates/me/index.hbs

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,46 @@
2525
<form local-class="me-email-notifications" {{ action 'saveEmailNotifications' on='submit' }} >
2626
<h2>Email Notification Preferences</h2>
2727

28-
<p>
29-
To aid detection of unauthorized crate changes, we email you each time a new version of a crate you own is pushed.
30-
By receiving and reading these emails, you help protect the Rust ecosystem. You may also choose to turn these
31-
emails off for any of your crates listed below.
32-
</p>
28+
{{#if this.hasEmailNotificationFeature}}
29+
<p>
30+
To aid detection of unauthorized crate changes, we email you each time a new version of a crate you own is pushed.
31+
By receiving and reading these emails, you help protect the Rust ecosystem. You may also choose to turn these
32+
emails off for any of your crates listed below.
33+
</p>
3334

34-
<div local-class="notifications-row">
35-
<button type='button' local-class="select-all-button" {{action 'emailNotificationsSelectAll'}}>Select All</button>
36-
<button type='button' local-class="deselect-all-button" {{action 'emailNotificationsSelectNone'}}>Deselect All</button>
37-
</div>
35+
<div local-class="notifications-row">
36+
<button type='button' local-class="select-all-button" {{action 'emailNotificationsSelectAll'}}>Select All</button>
37+
<button type='button' local-class="deselect-all-button" {{action 'emailNotificationsSelectNone'}}>Deselect All</button>
38+
</div>
3839

39-
<ul local-class="notifications-list">
40-
{{#each this.ownedCrates as |ownedCrate|}}
41-
<OwnedCrateRow @ownedCrate={{ownedCrate}} />
42-
{{/each}}
43-
</ul>
40+
<ul local-class="notifications-list">
41+
{{#each this.ownedCrates as |ownedCrate|}}
42+
<OwnedCrateRow @ownedCrate={{ownedCrate}} />
43+
{{/each}}
44+
</ul>
4445

45-
<div local-class="notifications-row">
46-
{{#if this.emailNotificationsError}}
47-
<div local-class="notifications-error">
48-
An error occurred while saving your email preferences.
46+
<div local-class="notifications-row">
47+
{{#if this.emailNotificationsError}}
48+
<div local-class="notifications-error">
49+
An error occurred while saving your email preferences.
50+
</div>
51+
{{/if}}
52+
{{#if this.emailNotificationsSuccess}}
53+
<div local-class="notifications-success">
54+
Your email notification preferences have been updated!
55+
</div>
56+
{{/if}}
57+
<div local-class="right">
58+
<button type='submit' local-class="update-notifications-button">Update</button>
4959
</div>
50-
{{/if}}
51-
{{#if this.emailNotificationsSuccess}}
52-
<div local-class="notifications-success">
53-
Your email notification preferences have been updated!
54-
</div>
55-
{{/if}}
56-
<div local-class="right">
57-
<button type='submit' local-class="update-notifications-button">Update</button>
5860
</div>
59-
</div>
61+
{{else}}
62+
<p>
63+
To aid detection of unauthorized crate changes, we plan to email you each time a new version of a crate you own is
64+
pushed. This feature is still work-in-progress, if you want to help out have a look at
65+
<a href="https://github.com/rust-lang/crates.io/issues/1895">#1895</a>.
66+
</p>
67+
{{/if}}
6068
</form>
6169

6270
<div local-class="me-subheading">

0 commit comments

Comments
 (0)