DEV: Relocate enable allowed PMs checkbox

To avoid confusion move the enable allowed PMs checkbox to the same page
that you add your allowed users.

Follow up to: 690f17bcbe
This commit is contained in:
Blake Erickson 2020-07-20 16:23:42 -06:00
parent 690f17bcbe
commit 30af3f24ef
4 changed files with 30 additions and 29 deletions

View File

@ -2,7 +2,6 @@ import I18n from "I18n";
import Controller from "@ember/controller";
import { NotificationLevels } from "discourse/lib/notification-levels";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed from "discourse-common/utils/decorators";
export default Controller.extend({
init() {
@ -93,11 +92,6 @@ export default Controller.extend({
this.isIOS = caps.isIOS;
},
@discourseComputed("model.user_option.allow_private_messages")
disableAllowPmUsersSetting(allowPrivateMessages) {
return !allowPrivateMessages;
},
actions: {
save() {
this.set("saved", false);

View File

@ -3,6 +3,7 @@ import { alias, gte, or, and } from "@ember/object/computed";
import { action, computed } from "@ember/object";
import Controller from "@ember/controller";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed from "discourse-common/utils/decorators";
export default Controller.extend({
ignoredUsernames: alias("model.ignored_usernames"),
@ -44,7 +45,8 @@ export default Controller.extend({
this.saveAttrNames = [
"muted_usernames",
"ignored_usernames",
"allowed_pm_usernames"
"allowed_pm_usernames",
"enable_allowed_pm_users"
];
},
@ -58,6 +60,11 @@ export default Controller.extend({
this.model.set("allowed_pm_usernames", usernames.uniq().join(","));
},
@discourseComputed("model.user_option.allow_private_messages")
disableAllowPmUsersSetting(allowPrivateMessages) {
return !allowPrivateMessages;
},
@action
save() {
this.set("saved", false);

View File

@ -61,15 +61,7 @@
labelKey="user.allow_private_messages"
checked=model.user_option.allow_private_messages}}
</div>
<div class="controls">
{{preference-checkbox
labelKey="user.allow_private_messages_from_specific_users"
checked=model.user_option.enable_allowed_pm_users
disabled=disableAllowPmUsersSetting}}
</div>
</div>
{{/if}}
{{plugin-outlet name="user-preferences-notifications" args=(hash model=model save=(action "save"))}}

View File

@ -25,8 +25,15 @@
<div class="instructions">{{i18n "user.muted_users_instructions"}}</div>
</div>
{{#if allowPmUsersEnabled}}
{{#if siteSettings.enable_personal_messages}}
<div class="control-group user-allow-pm">
<div class="controls">
{{preference-checkbox
labelKey="user.allow_private_messages_from_specific_users"
checked=model.user_option.enable_allowed_pm_users
disabled=disableAllowPmUsersSetting}}
</div>
{{#if allowPmUsersEnabled}}
<div class="controls tracking-controls">
<label>
{{d-icon "far-envelope" class="icon"}}
@ -41,6 +48,7 @@
}}
</div>
<div class="instructions">{{i18n "user.allowed_pm_users_instructions"}}</div>
{{/if}}
</div>
{{/if}}