mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: warn about mailing list mode if it is checked
This commit is contained in:
@@ -3,5 +3,17 @@ export default Em.Component.extend({
|
||||
|
||||
label: function() {
|
||||
return I18n.t(this.get('labelKey'));
|
||||
}.property('labelKey')
|
||||
}.property('labelKey'),
|
||||
|
||||
click() {
|
||||
const warning = this.get('warning');
|
||||
|
||||
if (warning && !this.get('checked')) {
|
||||
debugger;
|
||||
this.sendAction('warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -106,6 +106,22 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
|
||||
actions: {
|
||||
|
||||
checkMailingList(){
|
||||
Em.run.next(()=>{
|
||||
const postsPerDay = this.get('model.mailing_list_posts_per_day');
|
||||
if (!postsPerDay || postsPerDay < 2) {
|
||||
this.set('model.user_option.mailing_list_mode', true);
|
||||
return;
|
||||
}
|
||||
|
||||
bootbox.confirm(I18n.t("user.enable_mailing_list", {count: postsPerDay}), I18n.t("no_value"), I18n.t("yes_value"), (success) => {
|
||||
if (success) {
|
||||
this.set('model.user_option.mailing_list_mode', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
save() {
|
||||
this.set('saved', false);
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
{{preference-checkbox labelKey="user.email_private_messages" checked=model.user_option.email_private_messages}}
|
||||
{{preference-checkbox labelKey="user.email_direct" checked=model.user_option.email_direct}}
|
||||
{{#unless siteSettings.disable_mailing_list_mode}}
|
||||
{{preference-checkbox labelKey="user.mailing_list_mode" checked=model.user_option.mailing_list_mode}}
|
||||
{{preference-checkbox warning="checkMailingList" labelKey="user.mailing_list_mode" checked=model.user_option.mailing_list_mode}}
|
||||
{{/unless}}
|
||||
{{preference-checkbox labelKey="user.email_always" checked=model.user_option.email_always}}
|
||||
{{#unless model.user_option.email_always}}
|
||||
|
||||
Reference in New Issue
Block a user