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:
parent
690f17bcbe
commit
30af3f24ef
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"))}}
|
||||
|
|
|
@ -25,22 +25,30 @@
|
|||
<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 tracking-controls">
|
||||
<label>
|
||||
{{d-icon "far-envelope" class="icon"}}
|
||||
<span>{{i18n "user.allowed_pm_users"}}</span>
|
||||
</label>
|
||||
{{user-chooser
|
||||
value=allowedPmUsernames
|
||||
onChange=(action "onChangeAllowedPmUsernames")
|
||||
options=(hash
|
||||
excludeCurrentUser=true
|
||||
)
|
||||
}}
|
||||
<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 class="instructions">{{i18n "user.allowed_pm_users_instructions"}}</div>
|
||||
{{#if allowPmUsersEnabled}}
|
||||
<div class="controls tracking-controls">
|
||||
<label>
|
||||
{{d-icon "far-envelope" class="icon"}}
|
||||
<span>{{i18n "user.allowed_pm_users"}}</span>
|
||||
</label>
|
||||
{{user-chooser
|
||||
value=allowedPmUsernames
|
||||
onChange=(action "onChangeAllowedPmUsernames")
|
||||
options=(hash
|
||||
excludeCurrentUser=true
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
<div class="instructions">{{i18n "user.allowed_pm_users_instructions"}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue