mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
DEV: Remove use of deprecated prop from user preferences templates (#20403)
The `redesigned_user_page_nav_enabled` property has been deprecated and will be dropped from Discourse core soon.
This commit is contained in:
parent
a3712781e1
commit
2fc2d7d828
|
@ -1,95 +0,0 @@
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.account"
|
|
||||||
@class="user-nav__preferences-account"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "user"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.account"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
|
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.security"
|
|
||||||
@class="user-nav__preferences-security"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "lock"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.security"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
|
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.profile"
|
|
||||||
@class="user-nav__preferences-profile"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "user"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.profile"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
|
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.emails"
|
|
||||||
@class="user-nav__preferences-emails"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "envelope"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.emails"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
|
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.notifications"
|
|
||||||
@class="user-nav__preferences-notifications"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "bell"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.notifications"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
|
|
||||||
{{#if @model.can_change_tracking_preferences}}
|
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.tracking"
|
|
||||||
@class="user-nav__preferences-tracking"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "plus"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.tracking"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.users"
|
|
||||||
@class="user-nav__preferences-users"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "users"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.users"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
|
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.interface"
|
|
||||||
@class="user-nav__preferences-interface"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "desktop"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.interface"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
|
|
||||||
{{#if (not (eq @siteSettings.navigation_menu "legacy"))}}
|
|
||||||
<DNavigationItem
|
|
||||||
@route="preferences.sidebar"
|
|
||||||
@class="user-nav__preferences-sidebar"
|
|
||||||
@ariaCurrentContext={{@ariaCurrentContext}}
|
|
||||||
>
|
|
||||||
{{d-icon "bars"}}
|
|
||||||
<span>{{i18n "user.preferences_nav.sidebar"}}</span>
|
|
||||||
</DNavigationItem>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<PluginOutlet
|
|
||||||
@name="user-preferences-nav-under-interface"
|
|
||||||
@connectorTagName="div"
|
|
||||||
@outletArgs={{hash model=@model}}
|
|
||||||
/>
|
|
||||||
<PluginOutlet
|
|
||||||
@name="user-preferences-nav"
|
|
||||||
@connectorTagName="li"
|
|
||||||
@outletArgs={{hash model=@model}}
|
|
||||||
/>
|
|
|
@ -1,110 +1,104 @@
|
||||||
{{#if this.currentUser.redesigned_user_page_nav_enabled}}
|
<DSection @pageClass="user-preferences" />
|
||||||
<DSection @pageClass="user-preferences" />
|
|
||||||
<div class="user-navigation user-navigation-secondary">
|
<div class="user-navigation user-navigation-secondary">
|
||||||
<HorizontalOverflowNav @ariaLabel="User secondary - preferences">
|
<HorizontalOverflowNav @ariaLabel="User secondary - preferences">
|
||||||
<UserNav::PreferencesNav
|
<DNavigationItem
|
||||||
@currentUser={{this.currentUser}}
|
@route="preferences.account"
|
||||||
@model={{this.model}}
|
@class="user-nav__preferences-account"
|
||||||
@siteSettings={{this.siteSettings}}
|
@ariaCurrentContext="subNav"
|
||||||
@ariaCurrentContext="subNav"
|
|
||||||
/>
|
|
||||||
</HorizontalOverflowNav>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<DSection @pageClass="user-preferences" @class="user-secondary-navigation">
|
|
||||||
<MobileNav
|
|
||||||
@class="preferences-nav"
|
|
||||||
@desktopClass="preferences-list action-list nav-stacked"
|
|
||||||
>
|
>
|
||||||
<li class="nav-account">
|
{{d-icon "user"}}
|
||||||
<LinkTo @route="preferences.account">
|
<span>{{i18n "user.preferences_nav.account"}}</span>
|
||||||
{{i18n "user.preferences_nav.account"}}
|
</DNavigationItem>
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
<li class="nav-security">
|
|
||||||
<LinkTo @route="preferences.security">
|
|
||||||
{{i18n "user.preferences_nav.security"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
<li class="nav-profile">
|
|
||||||
<LinkTo @route="preferences.profile">
|
|
||||||
{{i18n "user.preferences_nav.profile"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
<li class="nav-emails">
|
|
||||||
<LinkTo @route="preferences.emails">
|
|
||||||
{{i18n "user.preferences_nav.emails"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
<li class="nav-notifications">
|
|
||||||
<LinkTo @route="preferences.notifications">
|
|
||||||
{{i18n "user.preferences_nav.notifications"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{#if this.model.can_change_tracking_preferences}}
|
|
||||||
<li class="indent nav-categories">
|
|
||||||
<LinkTo @route="preferences.categories">
|
|
||||||
{{i18n "user.preferences_nav.categories"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
<li class="indent nav-users">
|
|
||||||
<LinkTo @route="preferences.users">
|
|
||||||
{{i18n "user.preferences_nav.users"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{#if
|
|
||||||
(and
|
|
||||||
this.model.can_change_tracking_preferences
|
|
||||||
this.siteSettings.tagging_enabled
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
<li class="indent nav-tags">
|
|
||||||
<LinkTo @route="preferences.tags">
|
|
||||||
{{i18n "user.preferences_nav.tags"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
<li class="nav-interface">
|
|
||||||
<LinkTo @route="preferences.interface">
|
|
||||||
{{i18n "user.preferences_nav.interface"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{{#if (not (eq this.siteSettings.navigation_menu "legacy"))}}
|
<DNavigationItem
|
||||||
<li class="indent nav-sidebar">
|
@route="preferences.security"
|
||||||
<LinkTo @route="preferences.sidebar">
|
@class="user-nav__preferences-security"
|
||||||
{{i18n "user.preferences_nav.sidebar"}}
|
@ariaCurrentContext="subNav"
|
||||||
</LinkTo>
|
>
|
||||||
</li>
|
{{d-icon "lock"}}
|
||||||
{{/if}}
|
<span>{{i18n "user.preferences_nav.security"}}</span>
|
||||||
|
</DNavigationItem>
|
||||||
|
|
||||||
<span>
|
<DNavigationItem
|
||||||
<PluginOutlet
|
@route="preferences.profile"
|
||||||
@name="user-preferences-nav-under-interface"
|
@class="user-nav__preferences-profile"
|
||||||
@connectorTagName="div"
|
@ariaCurrentContext="subNav"
|
||||||
@outletArgs={{hash model=this.model}}
|
>
|
||||||
/>
|
{{d-icon "user"}}
|
||||||
</span>
|
<span>{{i18n "user.preferences_nav.profile"}}</span>
|
||||||
|
</DNavigationItem>
|
||||||
|
|
||||||
{{#if this.model.userApiKeys}}
|
<DNavigationItem
|
||||||
<li class="nav-apps">
|
@route="preferences.emails"
|
||||||
<LinkTo @route="preferences.apps">
|
@class="user-nav__preferences-emails"
|
||||||
{{i18n "user.preferences_nav.apps"}}
|
@ariaCurrentContext="subNav"
|
||||||
</LinkTo>
|
>
|
||||||
</li>
|
{{d-icon "envelope"}}
|
||||||
{{/if}}
|
<span>{{i18n "user.preferences_nav.emails"}}</span>
|
||||||
|
</DNavigationItem>
|
||||||
|
|
||||||
<span>
|
<DNavigationItem
|
||||||
<PluginOutlet
|
@route="preferences.notifications"
|
||||||
@name="user-preferences-nav"
|
@class="user-nav__preferences-notifications"
|
||||||
@connectorTagName="li"
|
@ariaCurrentContext="subNav"
|
||||||
@outletArgs={{hash model=this.model}}
|
>
|
||||||
/>
|
{{d-icon "bell"}}
|
||||||
</span>
|
<span>{{i18n "user.preferences_nav.notifications"}}</span>
|
||||||
</MobileNav>
|
</DNavigationItem>
|
||||||
</DSection>
|
|
||||||
{{/if}}
|
{{#if this.model.can_change_tracking_preferences}}
|
||||||
|
<DNavigationItem
|
||||||
|
@route="preferences.tracking"
|
||||||
|
@class="user-nav__preferences-tracking"
|
||||||
|
@ariaCurrentContext="subNav"
|
||||||
|
>
|
||||||
|
{{d-icon "plus"}}
|
||||||
|
<span>{{i18n "user.preferences_nav.tracking"}}</span>
|
||||||
|
</DNavigationItem>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<DNavigationItem
|
||||||
|
@route="preferences.users"
|
||||||
|
@class="user-nav__preferences-users"
|
||||||
|
@ariaCurrentContext="subNav"
|
||||||
|
>
|
||||||
|
{{d-icon "users"}}
|
||||||
|
<span>{{i18n "user.preferences_nav.users"}}</span>
|
||||||
|
</DNavigationItem>
|
||||||
|
|
||||||
|
<DNavigationItem
|
||||||
|
@route="preferences.interface"
|
||||||
|
@class="user-nav__preferences-interface"
|
||||||
|
@ariaCurrentContext="subNav"
|
||||||
|
>
|
||||||
|
{{d-icon "desktop"}}
|
||||||
|
<span>{{i18n "user.preferences_nav.interface"}}</span>
|
||||||
|
</DNavigationItem>
|
||||||
|
|
||||||
|
{{#if (not (eq this.siteSettings.navigation_menu "legacy"))}}
|
||||||
|
<DNavigationItem
|
||||||
|
@route="preferences.sidebar"
|
||||||
|
@class="user-nav__preferences-sidebar"
|
||||||
|
@ariaCurrentContext="subNav"
|
||||||
|
>
|
||||||
|
{{d-icon "bars"}}
|
||||||
|
<span>{{i18n "user.preferences_nav.sidebar"}}</span>
|
||||||
|
</DNavigationItem>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<PluginOutlet
|
||||||
|
@name="user-preferences-nav-under-interface"
|
||||||
|
@connectorTagName="div"
|
||||||
|
@outletArgs={{hash model=this.model}}
|
||||||
|
/>
|
||||||
|
<PluginOutlet
|
||||||
|
@name="user-preferences-nav"
|
||||||
|
@connectorTagName="li"
|
||||||
|
@outletArgs={{hash model=this.model}}
|
||||||
|
/>
|
||||||
|
</HorizontalOverflowNav>
|
||||||
|
</div>
|
||||||
|
|
||||||
<section class="user-content user-preferences" id="user-content">
|
<section class="user-content user-preferences" id="user-content">
|
||||||
<span>
|
<span>
|
||||||
|
|
|
@ -100,9 +100,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if this.currentUser.redesigned_user_page_nav_enabled}}
|
<UserPreferences::UserApiKeys @model={{@model}} />
|
||||||
<UserPreferences::UserApiKeys @model={{@model}} />
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
<PluginOutlet
|
<PluginOutlet
|
||||||
|
|
|
@ -44,6 +44,7 @@ acceptance("User Preferences", function (needs) {
|
||||||
document.body.classList.contains("user-preferences-page"),
|
document.body.classList.contains("user-preferences-page"),
|
||||||
"has the body class"
|
"has the body class"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
"/u/eviltrout/preferences/account",
|
"/u/eviltrout/preferences/account",
|
||||||
|
@ -62,15 +63,15 @@ acceptance("User Preferences", function (needs) {
|
||||||
await fillIn(".pref-name input[type=text]", "Jon Snow");
|
await fillIn(".pref-name input[type=text]", "Jon Snow");
|
||||||
await savePreferences();
|
await savePreferences();
|
||||||
|
|
||||||
await click(".preferences-nav .nav-profile a");
|
await click(".user-nav__preferences-profile a");
|
||||||
await fillIn("#edit-location", "Westeros");
|
await fillIn("#edit-location", "Westeros");
|
||||||
await savePreferences();
|
await savePreferences();
|
||||||
|
|
||||||
await click(".preferences-nav .nav-emails a");
|
await click(".user-nav__preferences-emails a");
|
||||||
await click(".pref-activity-summary input[type=checkbox]");
|
await click(".pref-activity-summary input[type=checkbox]");
|
||||||
await savePreferences();
|
await savePreferences();
|
||||||
|
|
||||||
await click(".preferences-nav .nav-notifications a");
|
await click(".user-nav__preferences-notifications a");
|
||||||
|
|
||||||
await selectKit(
|
await selectKit(
|
||||||
".control-group.notifications .combo-box.duration"
|
".control-group.notifications .combo-box.duration"
|
||||||
|
@ -82,7 +83,7 @@ acceptance("User Preferences", function (needs) {
|
||||||
|
|
||||||
await savePreferences();
|
await savePreferences();
|
||||||
|
|
||||||
await click(".preferences-nav .nav-categories a");
|
await click(".user-nav__preferences-tracking a");
|
||||||
|
|
||||||
const categorySelector = selectKit(
|
const categorySelector = selectKit(
|
||||||
".tracking-controls .category-selector "
|
".tracking-controls .category-selector "
|
||||||
|
@ -90,26 +91,25 @@ acceptance("User Preferences", function (needs) {
|
||||||
|
|
||||||
await categorySelector.expand();
|
await categorySelector.expand();
|
||||||
await categorySelector.fillInFilter("faq");
|
await categorySelector.fillInFilter("faq");
|
||||||
|
|
||||||
|
const tagSelector = selectKit(".tracking-controls .tag-chooser");
|
||||||
|
await tagSelector.expand();
|
||||||
|
await tagSelector.fillInFilter("monkey");
|
||||||
|
|
||||||
await savePreferences();
|
await savePreferences();
|
||||||
|
|
||||||
this.siteSettings.tagging_enabled = false;
|
this.siteSettings.tagging_enabled = false;
|
||||||
|
|
||||||
await visit("/");
|
await visit("/u/eviltrout/preferences/tracking");
|
||||||
await visit("/u/eviltrout/preferences");
|
|
||||||
|
|
||||||
assert.ok(
|
assert.notOk(
|
||||||
!exists(".preferences-nav .nav-tags a"),
|
exists(".tag-notifications"),
|
||||||
"tags tab isn't there when tags are disabled"
|
"updating tags tracking preferences isn't visible when tags are disabled"
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(".preferences-nav .nav-interface a");
|
await click(".user-nav__preferences-interface a");
|
||||||
await click(".control-group.other input[type=checkbox]:nth-of-type(1)");
|
await click(".control-group.other input[type=checkbox]:nth-of-type(1)");
|
||||||
await savePreferences();
|
await savePreferences();
|
||||||
|
|
||||||
assert.ok(
|
|
||||||
!exists(".preferences-nav .nav-apps a"),
|
|
||||||
"apps tab isn't there when you have no authorized apps"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,8 @@ acceptance("User Preferences - Security", function (needs) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Viewing user api keys when user has redesign user page navigation enabled", async function (assert) {
|
test("Viewing user api keys", async function (assert) {
|
||||||
updateCurrentUser({
|
updateCurrentUser({
|
||||||
redesigned_user_page_nav_enabled: true,
|
|
||||||
user_api_keys: [
|
user_api_keys: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user