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 Controller from "@ember/controller";
|
||||||
import { NotificationLevels } from "discourse/lib/notification-levels";
|
import { NotificationLevels } from "discourse/lib/notification-levels";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
init() {
|
init() {
|
||||||
|
@ -93,11 +92,6 @@ export default Controller.extend({
|
||||||
this.isIOS = caps.isIOS;
|
this.isIOS = caps.isIOS;
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("model.user_option.allow_private_messages")
|
|
||||||
disableAllowPmUsersSetting(allowPrivateMessages) {
|
|
||||||
return !allowPrivateMessages;
|
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
save() {
|
save() {
|
||||||
this.set("saved", false);
|
this.set("saved", false);
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { alias, gte, or, and } from "@ember/object/computed";
|
||||||
import { action, computed } from "@ember/object";
|
import { action, computed } from "@ember/object";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
ignoredUsernames: alias("model.ignored_usernames"),
|
ignoredUsernames: alias("model.ignored_usernames"),
|
||||||
|
@ -44,7 +45,8 @@ export default Controller.extend({
|
||||||
this.saveAttrNames = [
|
this.saveAttrNames = [
|
||||||
"muted_usernames",
|
"muted_usernames",
|
||||||
"ignored_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(","));
|
this.model.set("allowed_pm_usernames", usernames.uniq().join(","));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@discourseComputed("model.user_option.allow_private_messages")
|
||||||
|
disableAllowPmUsersSetting(allowPrivateMessages) {
|
||||||
|
return !allowPrivateMessages;
|
||||||
|
},
|
||||||
|
|
||||||
@action
|
@action
|
||||||
save() {
|
save() {
|
||||||
this.set("saved", false);
|
this.set("saved", false);
|
||||||
|
|
|
@ -61,15 +61,7 @@
|
||||||
labelKey="user.allow_private_messages"
|
labelKey="user.allow_private_messages"
|
||||||
checked=model.user_option.allow_private_messages}}
|
checked=model.user_option.allow_private_messages}}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{plugin-outlet name="user-preferences-notifications" args=(hash model=model save=(action "save"))}}
|
{{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 class="instructions">{{i18n "user.muted_users_instructions"}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if allowPmUsersEnabled}}
|
{{#if siteSettings.enable_personal_messages}}
|
||||||
<div class="control-group user-allow-pm">
|
<div class="control-group user-allow-pm">
|
||||||
<div class="controls tracking-controls">
|
<div class="controls">
|
||||||
<label>
|
{{preference-checkbox
|
||||||
{{d-icon "far-envelope" class="icon"}}
|
labelKey="user.allow_private_messages_from_specific_users"
|
||||||
<span>{{i18n "user.allowed_pm_users"}}</span>
|
checked=model.user_option.enable_allowed_pm_users
|
||||||
</label>
|
disabled=disableAllowPmUsersSetting}}
|
||||||
{{user-chooser
|
|
||||||
value=allowedPmUsernames
|
|
||||||
onChange=(action "onChangeAllowedPmUsernames")
|
|
||||||
options=(hash
|
|
||||||
excludeCurrentUser=true
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</div>
|
</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>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue