mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Remove use of deprecated prop from user notifications templates (#20404)
The redesigned_user_page_nav_enabled property has been deprecated and will be dropped from Discourse core soon.
This commit is contained in:
parent
2fc2d7d828
commit
64cf7e444b
@ -1,9 +0,0 @@
|
|||||||
<div class="control-group private-messages">
|
|
||||||
<label class="control-label">{{i18n "user.private_messages"}}</label>
|
|
||||||
<div class="controls">
|
|
||||||
<PreferenceCheckbox
|
|
||||||
@labelKey="user.allow_private_messages"
|
|
||||||
@checked={{@model.user_option.allow_private_messages}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,7 +1,5 @@
|
|||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { NotificationLevels } from "discourse/lib/notification-levels";
|
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
@ -30,71 +28,6 @@ export default Controller.extend({
|
|||||||
{ name: I18n.t("user.like_notification_frequency.first_time"), value: 2 },
|
{ name: I18n.t("user.like_notification_frequency.first_time"), value: 2 },
|
||||||
{ name: I18n.t("user.like_notification_frequency.never"), value: 3 },
|
{ name: I18n.t("user.like_notification_frequency.never"), value: 3 },
|
||||||
];
|
];
|
||||||
|
|
||||||
this.autoTrackDurations = [
|
|
||||||
{ name: I18n.t("user.auto_track_options.never"), value: -1 },
|
|
||||||
{ name: I18n.t("user.auto_track_options.immediately"), value: 0 },
|
|
||||||
{
|
|
||||||
name: I18n.t("user.auto_track_options.after_30_seconds"),
|
|
||||||
value: 30000,
|
|
||||||
},
|
|
||||||
{ name: I18n.t("user.auto_track_options.after_1_minute"), value: 60000 },
|
|
||||||
{
|
|
||||||
name: I18n.t("user.auto_track_options.after_2_minutes"),
|
|
||||||
value: 120000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("user.auto_track_options.after_3_minutes"),
|
|
||||||
value: 180000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("user.auto_track_options.after_4_minutes"),
|
|
||||||
value: 240000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("user.auto_track_options.after_5_minutes"),
|
|
||||||
value: 300000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("user.auto_track_options.after_10_minutes"),
|
|
||||||
value: 600000,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
this.notificationLevelsForReplying = [
|
|
||||||
{
|
|
||||||
name: I18n.t("topic.notifications.watching.title"),
|
|
||||||
value: NotificationLevels.WATCHING,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("topic.notifications.tracking.title"),
|
|
||||||
value: NotificationLevels.TRACKING,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("topic.notifications.regular.title"),
|
|
||||||
value: NotificationLevels.REGULAR,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
this.considerNewTopicOptions = [
|
|
||||||
{ name: I18n.t("user.new_topic_duration.not_viewed"), value: -1 },
|
|
||||||
{ name: I18n.t("user.new_topic_duration.after_1_day"), value: 60 * 24 },
|
|
||||||
{ name: I18n.t("user.new_topic_duration.after_2_days"), value: 60 * 48 },
|
|
||||||
{
|
|
||||||
name: I18n.t("user.new_topic_duration.after_1_week"),
|
|
||||||
value: 7 * 60 * 24,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("user.new_topic_duration.after_2_weeks"),
|
|
||||||
value: 2 * 7 * 60 * 24,
|
|
||||||
},
|
|
||||||
{ name: I18n.t("user.new_topic_duration.last_here"), value: -2 },
|
|
||||||
];
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("currentUser.can_send_private_messages")
|
|
||||||
showMessageSettings() {
|
|
||||||
return this.currentUser?.can_send_private_messages;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
<div class="control-group notifications">
|
<div class="control-group notifications">
|
||||||
<label class="control-label">{{i18n "user.notifications"}}</label>
|
<label class="control-label">{{i18n "user.notifications"}}</label>
|
||||||
|
|
||||||
{{#unless this.currentUser.redesigned_user_page_nav_enabled}}
|
|
||||||
<UserPreferences::TopicTracking
|
|
||||||
@considerNewTopicOptions={{this.considerNewTopicOptions}}
|
|
||||||
@model={{this.model}}
|
|
||||||
@autoTrackDurations={{this.autoTrackDurations}}
|
|
||||||
@notificationLevelsForReplying={{this.notificationLevelsForReplying}}
|
|
||||||
/>
|
|
||||||
{{/unless}}
|
|
||||||
|
|
||||||
<div class="controls controls-dropdown">
|
<div class="controls controls-dropdown">
|
||||||
<label>{{i18n "user.like_notification_frequency.title"}}</label>
|
<label>{{i18n "user.like_notification_frequency.title"}}</label>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
@ -44,12 +35,6 @@
|
|||||||
|
|
||||||
<UserNotificationSchedule @model={{this.model}} />
|
<UserNotificationSchedule @model={{this.model}} />
|
||||||
|
|
||||||
{{#if this.showMessageSettings}}
|
|
||||||
{{#unless this.currentUser.redesigned_user_page_nav_enabled}}
|
|
||||||
<UserPreferences::AllowPrivateMessages @model={{this.model}} />
|
|
||||||
{{/unless}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
<PluginOutlet
|
<PluginOutlet
|
||||||
@name="user-preferences-notifications"
|
@name="user-preferences-notifications"
|
||||||
|
@ -2,12 +2,45 @@
|
|||||||
|
|
||||||
<div class="user-preferences__tracking-topics-wrapper">
|
<div class="user-preferences__tracking-topics-wrapper">
|
||||||
<label class="control-label">{{i18n "user.topics_settings"}}</label>
|
<label class="control-label">{{i18n "user.topics_settings"}}</label>
|
||||||
<UserPreferences::TopicTracking
|
|
||||||
@considerNewTopicOptions={{this.considerNewTopicOptions}}
|
<div class="user-preferences_tracking-topics-controls">
|
||||||
@model={{this.model}}
|
<div class="controls controls-dropdown">
|
||||||
@autoTrackDurations={{this.autoTrackDurations}}
|
<label>{{i18n "user.new_topic_duration.label"}}</label>
|
||||||
@notificationLevelsForReplying={{this.notificationLevelsForReplying}}
|
<ComboBox
|
||||||
/>
|
@class="duration"
|
||||||
|
@valueProperty="value"
|
||||||
|
@content={{this.considerNewTopicOptions}}
|
||||||
|
@value={{this.model.user_option.new_topic_duration_minutes}}
|
||||||
|
@onChange={{action
|
||||||
|
(mut this.model.user_option.new_topic_duration_minutes)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="controls controls-dropdown">
|
||||||
|
<label>{{i18n "user.auto_track_topics"}}</label>
|
||||||
|
<ComboBox
|
||||||
|
@valueProperty="value"
|
||||||
|
@content={{this.autoTrackDurations}}
|
||||||
|
@value={{this.model.user_option.auto_track_topics_after_msecs}}
|
||||||
|
@onChange={{action
|
||||||
|
(mut this.model.user_option.auto_track_topics_after_msecs)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="controls controls-dropdown">
|
||||||
|
<label>{{i18n "user.notification_level_when_replying"}}</label>
|
||||||
|
<ComboBox
|
||||||
|
@valueProperty="value"
|
||||||
|
@content={{this.notificationLevelsForReplying}}
|
||||||
|
@value={{this.model.user_option.notification_level_when_replying}}
|
||||||
|
@onChange={{action
|
||||||
|
(mut this.model.user_option.notification_level_when_replying)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="user-preferences__tracking-categories-tags-wrapper">
|
<div class="user-preferences__tracking-categories-tags-wrapper">
|
||||||
|
@ -29,9 +29,15 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if this.currentUser.can_send_private_messages}}
|
{{#if this.currentUser.can_send_private_messages}}
|
||||||
{{#if this.currentUser.redesigned_user_page_nav_enabled}}
|
<div class="control-group private-messages">
|
||||||
<UserPreferences::AllowPrivateMessages @model={{this.model}} />
|
<label class="control-label">{{i18n "user.private_messages"}}</label>
|
||||||
{{/if}}
|
<div class="controls">
|
||||||
|
<PreferenceCheckbox
|
||||||
|
@labelKey="user.allow_private_messages"
|
||||||
|
@checked={{this.model.user_option.allow_private_messages}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="control-group user-allow-pm">
|
<div class="control-group user-allow-pm">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
@ -71,14 +71,14 @@ acceptance("User Preferences", function (needs) {
|
|||||||
await click(".pref-activity-summary input[type=checkbox]");
|
await click(".pref-activity-summary input[type=checkbox]");
|
||||||
await savePreferences();
|
await savePreferences();
|
||||||
|
|
||||||
await click(".user-nav__preferences-notifications a");
|
await click(".user-nav__preferences-tracking a");
|
||||||
|
|
||||||
await selectKit(
|
await selectKit(
|
||||||
".control-group.notifications .combo-box.duration"
|
".user-preferences_tracking-topics-controls .combo-box.duration"
|
||||||
).expand();
|
).expand();
|
||||||
|
|
||||||
await selectKit(
|
await selectKit(
|
||||||
".control-group.notifications .combo-box.duration"
|
".user-preferences_tracking-topics-controls .combo-box.duration"
|
||||||
).selectRowByValue(1440);
|
).selectRowByValue(1440);
|
||||||
|
|
||||||
await savePreferences();
|
await savePreferences();
|
||||||
|
@ -4,9 +4,7 @@ import { test } from "qunit";
|
|||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
|
|
||||||
acceptance("User Preferences - Tracking", function (needs) {
|
acceptance("User Preferences - Tracking", function (needs) {
|
||||||
needs.user({
|
needs.user();
|
||||||
redesigned_user_page_nav_enabled: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
let putRequestData;
|
let putRequestData;
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ acceptance(
|
|||||||
id: 5,
|
id: 5,
|
||||||
username: "charlie",
|
username: "charlie",
|
||||||
groups: [{ id: 14, name: "awesome_group", has_messages: true }],
|
groups: [{ id: 14, name: "awesome_group", has_messages: true }],
|
||||||
redesigned_user_page_nav_enabled: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.site({
|
needs.site({
|
||||||
@ -955,9 +954,7 @@ acceptance(
|
|||||||
acceptance(
|
acceptance(
|
||||||
"User Private Messages - user with uppercase username",
|
"User Private Messages - user with uppercase username",
|
||||||
function (needs) {
|
function (needs) {
|
||||||
needs.user({
|
needs.user();
|
||||||
redesigned_user_page_nav_enabled: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
needs.pretender((server, helper) => {
|
needs.pretender((server, helper) => {
|
||||||
const response = cloneJSON(userFixtures["/u/charlie.json"]);
|
const response = cloneJSON(userFixtures["/u/charlie.json"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user