UX: Admin sidebar link changes (#30365)
Make all links in the admin sidebar follow https://meta.discourse.org/t/formatting-text-in-discourse-documentation-and-uis/324637 Remove the following links, and add keywords to their root links. Email logs section is removed entirely. * Email Settings > Preview Summary * Email Logs > Sent * Email Logs > Skipped * Email Logs > Bounced * Email Logs > Received * Email Logs > Rejected * Security > Error Logs * Security > Screened Emails * Security > Screened IPs * Security > Screened URLs * Security > Search Logs * Advanced > Webhooks
This commit is contained in:
parent
ec8bda943a
commit
b3fa335c7d
|
@ -1,6 +1,3 @@
|
||||||
import getURL from "discourse-common/lib/get-url";
|
|
||||||
|
|
||||||
export const LOGS_SCREENED_EMAILS_LINK_KEY = "admin_logs_screened_emails";
|
|
||||||
export const ADMIN_NAV_MAP = [
|
export const ADMIN_NAV_MAP = [
|
||||||
{
|
{
|
||||||
name: "account",
|
name: "account",
|
||||||
|
@ -97,7 +94,8 @@ export const ADMIN_NAV_MAP = [
|
||||||
{
|
{
|
||||||
name: "admin_moderation_flags",
|
name: "admin_moderation_flags",
|
||||||
route: "adminConfig.flags",
|
route: "adminConfig.flags",
|
||||||
label: "admin.community.sidebar_link.moderation_flags",
|
label: "admin.community.sidebar_link.moderation_flags.title",
|
||||||
|
keywords: "admin.community.sidebar_link.moderation_flags.keywords",
|
||||||
icon: "flag",
|
icon: "flag",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -170,100 +168,25 @@ export const ADMIN_NAV_MAP = [
|
||||||
name: "email_settings",
|
name: "email_settings",
|
||||||
label: "admin.email_settings.title",
|
label: "admin.email_settings.title",
|
||||||
links: [
|
links: [
|
||||||
|
{
|
||||||
|
name: "admin_server_setup",
|
||||||
|
route: "adminEmail.index",
|
||||||
|
label: "admin.email_settings.sidebar_link.server_setup.title",
|
||||||
|
icon: "gear",
|
||||||
|
keywords: "admin.email_settings.sidebar_link.server_setup.keywords",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "admin_appearance",
|
name: "admin_appearance",
|
||||||
route: "adminCustomizeEmailStyle",
|
route: "adminCustomizeEmailStyle",
|
||||||
label: "admin.email_settings.sidebar_link.appearance",
|
label: "admin.email_settings.sidebar_link.appearance",
|
||||||
icon: "envelope",
|
icon: "envelope",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "admin_preview_summary",
|
|
||||||
route: "adminEmail.previewDigest",
|
|
||||||
label: "admin.email_settings.sidebar_link.preview_summary",
|
|
||||||
icon: "notification.private_message",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "admin_server_setup",
|
|
||||||
route: "adminEmail.index",
|
|
||||||
label: "admin.email_settings.sidebar_link.server_setup",
|
|
||||||
icon: "gear",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "email_logs",
|
|
||||||
label: "admin.email_logs.title",
|
|
||||||
links: [
|
|
||||||
{
|
|
||||||
name: "admin_email_sent",
|
|
||||||
route: "adminEmail.sent",
|
|
||||||
label: "admin.email_logs.sidebar_link.sent",
|
|
||||||
icon: "arrow-right",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "admin_email_skipped",
|
|
||||||
route: "adminEmail.skipped",
|
|
||||||
label: "admin.email_logs.sidebar_link.skipped",
|
|
||||||
icon: "angles-right",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "admin_email_bounced",
|
|
||||||
route: "adminEmail.bounced",
|
|
||||||
label: "admin.email_logs.sidebar_link.bounced",
|
|
||||||
icon: "xmark",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "admin_email_received",
|
|
||||||
route: "adminEmail.received",
|
|
||||||
label: "admin.email_logs.sidebar_link.received",
|
|
||||||
icon: "inbox",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "admin_email_rejected",
|
|
||||||
route: "adminEmail.rejected",
|
|
||||||
label: "admin.email_logs.sidebar_link.rejected",
|
|
||||||
icon: "ban",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "security",
|
name: "security",
|
||||||
label: "admin.security.title",
|
label: "admin.security.title",
|
||||||
links: [
|
links: [
|
||||||
{
|
|
||||||
name: "admin_logs_error_logs",
|
|
||||||
href: getURL("/logs"),
|
|
||||||
label: "admin.security.sidebar_link.error_logs",
|
|
||||||
icon: "up-right-from-square",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: LOGS_SCREENED_EMAILS_LINK_KEY,
|
|
||||||
route: "adminLogs.screenedEmails",
|
|
||||||
label: "admin.security.sidebar_link.screened_emails",
|
|
||||||
icon: "envelope",
|
|
||||||
moderator: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "admin_logs_screened_ip_addresses",
|
|
||||||
route: "adminLogs.screenedIpAddresses",
|
|
||||||
label: "admin.security.sidebar_link.screened_ips",
|
|
||||||
icon: "globe",
|
|
||||||
moderator: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "admin_logs_screened_urls",
|
|
||||||
route: "adminLogs.screenedUrls",
|
|
||||||
label: "admin.security.sidebar_link.screened_urls",
|
|
||||||
icon: "globe",
|
|
||||||
moderator: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "admin_logs_search_logs",
|
|
||||||
route: "adminSearchLogs",
|
|
||||||
label: "admin.security.sidebar_link.search_logs",
|
|
||||||
icon: "magnifying-glass",
|
|
||||||
moderator: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "admin_security",
|
name: "admin_security",
|
||||||
route: "adminSiteSettingsCategory",
|
route: "adminSiteSettingsCategory",
|
||||||
|
@ -283,7 +206,8 @@ export const ADMIN_NAV_MAP = [
|
||||||
{
|
{
|
||||||
name: "admin_logs_staff_action_logs",
|
name: "admin_logs_staff_action_logs",
|
||||||
route: "adminLogs.staffActionLogs",
|
route: "adminLogs.staffActionLogs",
|
||||||
label: "admin.security.sidebar_link.staff_action_logs",
|
label: "admin.security.sidebar_link.staff_action_logs.title",
|
||||||
|
keywords: "admin.security.sidebar_link.staff_action_logs.keywords",
|
||||||
icon: "user-shield",
|
icon: "user-shield",
|
||||||
moderator: true,
|
moderator: true,
|
||||||
},
|
},
|
||||||
|
@ -309,7 +233,8 @@ export const ADMIN_NAV_MAP = [
|
||||||
name: "admin_api_keys",
|
name: "admin_api_keys",
|
||||||
route: "adminApiKeys",
|
route: "adminApiKeys",
|
||||||
icon: "key",
|
icon: "key",
|
||||||
label: "admin.advanced.sidebar_link.api_keys",
|
label: "admin.advanced.sidebar_link.api_keys.title",
|
||||||
|
keywords: "admin.advanced.sidebar_link.api_keys.keywords",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "admin_developer",
|
name: "admin_developer",
|
||||||
|
@ -341,12 +266,6 @@ export const ADMIN_NAV_MAP = [
|
||||||
label: "admin.advanced.sidebar_link.user_api",
|
label: "admin.advanced.sidebar_link.user_api",
|
||||||
icon: "shuffle",
|
icon: "shuffle",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "admin_api_web_hooks",
|
|
||||||
route: "adminWebHooks",
|
|
||||||
label: "admin.advanced.sidebar_link.web_hooks",
|
|
||||||
icon: "globe",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "admin_onebox",
|
name: "admin_onebox",
|
||||||
route: "adminSiteSettingsCategory",
|
route: "adminSiteSettingsCategory",
|
||||||
|
|
|
@ -3,10 +3,7 @@ import { warn } from "@ember/debug";
|
||||||
import { htmlSafe } from "@ember/template";
|
import { htmlSafe } from "@ember/template";
|
||||||
import { adminRouteValid } from "discourse/lib/admin-utilities";
|
import { adminRouteValid } from "discourse/lib/admin-utilities";
|
||||||
import PreloadStore from "discourse/lib/preload-store";
|
import PreloadStore from "discourse/lib/preload-store";
|
||||||
import {
|
import { ADMIN_NAV_MAP } from "discourse/lib/sidebar/admin-nav-map";
|
||||||
ADMIN_NAV_MAP,
|
|
||||||
LOGS_SCREENED_EMAILS_LINK_KEY,
|
|
||||||
} from "discourse/lib/sidebar/admin-nav-map";
|
|
||||||
import BaseCustomSidebarPanel from "discourse/lib/sidebar/base-custom-sidebar-panel";
|
import BaseCustomSidebarPanel from "discourse/lib/sidebar/base-custom-sidebar-panel";
|
||||||
import BaseCustomSidebarSection from "discourse/lib/sidebar/base-custom-sidebar-section";
|
import BaseCustomSidebarSection from "discourse/lib/sidebar/base-custom-sidebar-section";
|
||||||
import BaseCustomSidebarSectionLink from "discourse/lib/sidebar/base-custom-sidebar-section-link";
|
import BaseCustomSidebarSectionLink from "discourse/lib/sidebar/base-custom-sidebar-section-link";
|
||||||
|
@ -411,9 +408,6 @@ export default class AdminSidebarPanel extends BaseCustomSidebarPanel {
|
||||||
if (!currentUser.admin && currentUser.moderator) {
|
if (!currentUser.admin && currentUser.moderator) {
|
||||||
navConfig.forEach((section) => {
|
navConfig.forEach((section) => {
|
||||||
section.links = section.links.filter((link) => {
|
section.links = section.links.filter((link) => {
|
||||||
if (link.name === LOGS_SCREENED_EMAILS_LINK_KEY) {
|
|
||||||
return siteSettings.moderators_view_emails;
|
|
||||||
}
|
|
||||||
return link.moderator;
|
return link.moderator;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,9 +47,6 @@ acceptance("Admin Sidebar - Sections", function (needs) {
|
||||||
assert
|
assert
|
||||||
.dom(".sidebar-section[data-section-name='admin-email_settings']")
|
.dom(".sidebar-section[data-section-name='admin-email_settings']")
|
||||||
.exists("email settings section is displayed");
|
.exists("email settings section is displayed");
|
||||||
assert
|
|
||||||
.dom(".sidebar-section[data-section-name='admin-email_logs']")
|
|
||||||
.exists("email logs settings section is displayed");
|
|
||||||
assert
|
assert
|
||||||
.dom(".sidebar-section[data-section-name='admin-security']")
|
.dom(".sidebar-section[data-section-name='admin-security']")
|
||||||
.exists("security settings section is displayed");
|
.exists("security settings section is displayed");
|
||||||
|
|
|
@ -5127,10 +5127,10 @@ en:
|
||||||
meta_doc: "Explore our <a href='https://meta.discourse.org/t/-/240233' rel='noopener noreferrer' target='_blank'>documentation</a> for a detailed overview of the reports."
|
meta_doc: "Explore our <a href='https://meta.discourse.org/t/-/240233' rel='noopener noreferrer' target='_blank'>documentation</a> for a detailed overview of the reports."
|
||||||
sidebar_title: "Reports"
|
sidebar_title: "Reports"
|
||||||
sidebar_link:
|
sidebar_link:
|
||||||
all: "All"
|
all: "All reports"
|
||||||
|
|
||||||
new_features:
|
new_features:
|
||||||
title: "What's new"
|
title: "What's new?"
|
||||||
check_for_updates: "Check for updates"
|
check_for_updates: "Check for updates"
|
||||||
dashboard:
|
dashboard:
|
||||||
title: "Dashboard"
|
title: "Dashboard"
|
||||||
|
@ -5149,7 +5149,7 @@ en:
|
||||||
problems_found: "Some advice based on your current site settings"
|
problems_found: "Some advice based on your current site settings"
|
||||||
dismiss_notice: "Dismiss"
|
dismiss_notice: "Dismiss"
|
||||||
new_features:
|
new_features:
|
||||||
title: "What's new"
|
title: "What's new?"
|
||||||
subtitle: "We are releasing new features and improvements all the time. This page covers the highlights, but you can click 'Learn more' to see extensive release notes."
|
subtitle: "We are releasing new features and improvements all the time. This page covers the highlights, but you can click 'Learn more' to see extensive release notes."
|
||||||
previous_announcements: "You can see previous new feature announcements on <a href='%{url}' target='_blank'>Discourse Meta</a>"
|
previous_announcements: "You can see previous new feature announcements on <a href='%{url}' target='_blank'>Discourse Meta</a>"
|
||||||
learn_more: "Learn more..."
|
learn_more: "Learn more..."
|
||||||
|
@ -5242,7 +5242,7 @@ en:
|
||||||
type_of_web_hook_event:
|
type_of_web_hook_event:
|
||||||
label: "Type of event"
|
label: "Type of event"
|
||||||
flags:
|
flags:
|
||||||
title: "Moderation Flags"
|
title: "Moderation"
|
||||||
description: "Description"
|
description: "Description"
|
||||||
enabled: "Enabled?"
|
enabled: "Enabled?"
|
||||||
more_options:
|
more_options:
|
||||||
|
@ -5583,66 +5583,57 @@ en:
|
||||||
sidebar_link:
|
sidebar_link:
|
||||||
backups: "Backups"
|
backups: "Backups"
|
||||||
whats_new:
|
whats_new:
|
||||||
title: "What's New"
|
title: "What's new?"
|
||||||
keywords: "changelog|feature|release"
|
keywords: "changelog|feature|release"
|
||||||
|
|
||||||
community:
|
community:
|
||||||
title: "Community"
|
title: "Community"
|
||||||
sidebar_link:
|
sidebar_link:
|
||||||
about_your_site: "About Your Site"
|
about_your_site: "About your site"
|
||||||
badges: "Badges"
|
badges: "Badges"
|
||||||
login_and_authentication: "Login & Authentication"
|
login_and_authentication: "Login & authentication"
|
||||||
notifications: "Notifications"
|
notifications: "Notifications"
|
||||||
permalinks: "Permalinks"
|
permalinks: "Permalinks"
|
||||||
trust_levels: "Trust Levels"
|
trust_levels: "Trust levels"
|
||||||
users: "Users"
|
users: "Users"
|
||||||
groups: "Groups"
|
groups: "Groups"
|
||||||
user_fields: "User Fields"
|
user_fields: "User fields"
|
||||||
watched_words: "Watched Words"
|
watched_words: "Watched words"
|
||||||
legal: "Legal"
|
legal: "Legal"
|
||||||
moderation_flags: "Moderation Flags"
|
moderation_flags:
|
||||||
|
title: "Moderation"
|
||||||
|
keywords: "flag|review"
|
||||||
|
|
||||||
appearance:
|
appearance:
|
||||||
title: "Appearance"
|
title: "Appearance"
|
||||||
sidebar_link:
|
sidebar_link:
|
||||||
font_style: "Font Style"
|
font_style: "Font style"
|
||||||
site_logo: "Site Logo"
|
site_logo: "Site logo"
|
||||||
color_schemes: "Color Palettes"
|
color_schemes: "Color palettes"
|
||||||
emoji: "Emoji"
|
emoji: "Emoji"
|
||||||
navigation: "Navigation"
|
navigation: "Navigation"
|
||||||
themes: "Themes"
|
themes: "Themes"
|
||||||
components:
|
components:
|
||||||
title: "Components"
|
title: "Components"
|
||||||
keywords: "theme|extension"
|
keywords: "theme|extension"
|
||||||
site_texts: "Site Texts"
|
site_texts: "Site texts"
|
||||||
|
|
||||||
email_settings:
|
email_settings:
|
||||||
title: "Email Settings"
|
title: "Email Settings"
|
||||||
sidebar_link:
|
sidebar_link:
|
||||||
appearance: "Appearance"
|
appearance: "Appearance"
|
||||||
preview_summary: "Preview Summary"
|
server_setup:
|
||||||
server_setup: "Server Setup"
|
title: "Server setup"
|
||||||
|
keywords: "email|smtp|mailgun|sendgrid|sent|skipped|bounced|received|rejected|email logs|preview summary"
|
||||||
email_logs:
|
|
||||||
title: "Email Logs"
|
|
||||||
sidebar_link:
|
|
||||||
sent: "Sent"
|
|
||||||
skipped: "Skipped"
|
|
||||||
bounced: "Bounced"
|
|
||||||
received: "Received"
|
|
||||||
rejected: "Rejected"
|
|
||||||
|
|
||||||
security:
|
security:
|
||||||
title: "Security"
|
title: "Security"
|
||||||
sidebar_link:
|
sidebar_link:
|
||||||
error_logs: "Error Logs"
|
|
||||||
screened_emails: "Screened Emails"
|
|
||||||
screened_ips: "Screened IPs"
|
|
||||||
screened_urls: "Screened URLs"
|
|
||||||
search_logs: "Search Logs"
|
|
||||||
security: "Security settings"
|
security: "Security settings"
|
||||||
spam: "Spam settings"
|
spam: "Spam settings"
|
||||||
staff_action_logs: "Staff Action Logs"
|
staff_action_logs:
|
||||||
|
title: "Staff action logs"
|
||||||
|
keywords: "error logs|screened emails|screened ips|screened urls|search logs"
|
||||||
|
|
||||||
section_landing_pages:
|
section_landing_pages:
|
||||||
account:
|
account:
|
||||||
|
@ -5651,7 +5642,7 @@ en:
|
||||||
title: "Backups"
|
title: "Backups"
|
||||||
description: "Take a backup of your site's data"
|
description: "Take a backup of your site's data"
|
||||||
whats_new:
|
whats_new:
|
||||||
title: "What's New"
|
title: "What's new?"
|
||||||
description: "Discover new releases and improvements to Discourse"
|
description: "Discover new releases and improvements to Discourse"
|
||||||
|
|
||||||
config_areas:
|
config_areas:
|
||||||
|
@ -5709,7 +5700,7 @@ en:
|
||||||
your_organization_saved: "Your organization saved"
|
your_organization_saved: "Your organization saved"
|
||||||
saved: "saved!"
|
saved: "saved!"
|
||||||
flags:
|
flags:
|
||||||
header: "Moderation Flags"
|
header: "Moderation"
|
||||||
edit_header: "Edit Flag"
|
edit_header: "Edit Flag"
|
||||||
subheader: "The flagging system in Discourse helps you and your moderator team manage content and user behavior, keeping your community respectful and healthy. The defaults are suitable for most communities and you don’t have to change them. However, if your site has particular requirements you can disable flags you don’t need and add your own custom flags."
|
subheader: "The flagging system in Discourse helps you and your moderator team manage content and user behavior, keeping your community respectful and healthy. The defaults are suitable for most communities and you don’t have to change them. However, if your site has particular requirements you can disable flags you don’t need and add your own custom flags."
|
||||||
description: "Description"
|
description: "Description"
|
||||||
|
@ -5791,18 +5782,19 @@ en:
|
||||||
advanced:
|
advanced:
|
||||||
title: "Advanced"
|
title: "Advanced"
|
||||||
sidebar_link:
|
sidebar_link:
|
||||||
api_keys: "API keys"
|
api_keys:
|
||||||
|
title: "API keys"
|
||||||
|
keywords: "token|webhook"
|
||||||
developer: "Developer"
|
developer: "Developer"
|
||||||
embedding: "Embedding"
|
embedding: "Embedding"
|
||||||
rate_limits: "Rate Limits"
|
rate_limits: "Rate limits"
|
||||||
user_api: "User API"
|
user_api: "User API"
|
||||||
web_hooks: "Webhooks"
|
|
||||||
onebox: "Onebox"
|
onebox: "Onebox"
|
||||||
files: "Files"
|
files: "Files"
|
||||||
other_options: "Other"
|
other_options: "Other"
|
||||||
search: "Search"
|
search: "Search"
|
||||||
experimental: "Experimental"
|
experimental: "Experimental"
|
||||||
all_site_settings: "All Site Settings"
|
all_site_settings: "All site settings"
|
||||||
|
|
||||||
navigation_menu:
|
navigation_menu:
|
||||||
sidebar: "Sidebar"
|
sidebar: "Sidebar"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
describe "Admin Revamp | Sidebar Navigation", type: :system do
|
describe "Admin | Sidebar Navigation", type: :system do
|
||||||
|
UNFILTERED_LINK_COUNT = 41
|
||||||
|
|
||||||
fab!(:admin)
|
fab!(:admin)
|
||||||
fab!(:moderator)
|
fab!(:moderator)
|
||||||
|
|
||||||
|
@ -50,9 +52,14 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
|
||||||
it "collapses sections by default" do
|
it "collapses sections by default" do
|
||||||
visit("/admin")
|
visit("/admin")
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
links = page.all(".sidebar-section-link-content-text")
|
||||||
expect(links.count).to eq(5)
|
|
||||||
expect(links.map(&:text)).to eq(
|
expect(links.map(&:text)).to eq(
|
||||||
["Dashboard", "Users", "Groups", "All Site Settings", "What's New"],
|
[
|
||||||
|
I18n.t("admin_js.admin.dashboard.title"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.users"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.groups"),
|
||||||
|
I18n.t("admin_js.admin.advanced.sidebar_link.all_site_settings"),
|
||||||
|
I18n.t("admin_js.admin.account.sidebar_link.whats_new.title"),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,14 +96,22 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
|
||||||
visit("/admin")
|
visit("/admin")
|
||||||
sidebar.toggle_all_sections
|
sidebar.toggle_all_sections
|
||||||
|
|
||||||
expect(page).to have_selector(".sidebar-section-link-content-text", minimum: 50)
|
expect(page).to have_selector(
|
||||||
|
".sidebar-section-link-content-text",
|
||||||
|
minimum: UNFILTERED_LINK_COUNT,
|
||||||
|
)
|
||||||
expect(page).to have_no_css(".sidebar-no-results")
|
expect(page).to have_no_css(".sidebar-no-results")
|
||||||
all_links_count = page.all(".sidebar-section-link-content-text").count
|
all_links_count = page.all(".sidebar-section-link-content-text").count
|
||||||
|
|
||||||
filter.filter("ie")
|
filter.filter("ie")
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
links = page.all(".sidebar-section-link-content-text")
|
||||||
expect(links.count).to eq(2)
|
expect(links.map(&:text)).to eq(
|
||||||
expect(links.map(&:text)).to eq(["User Fields", "Preview Summary"])
|
[
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.user_fields"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.moderation_flags.title"),
|
||||||
|
I18n.t("admin_js.admin.email_settings.sidebar_link.server_setup.title"),
|
||||||
|
],
|
||||||
|
)
|
||||||
expect(page).to have_no_css(".sidebar-no-results")
|
expect(page).to have_no_css(".sidebar-no-results")
|
||||||
|
|
||||||
filter.filter("ieeee")
|
filter.filter("ieeee")
|
||||||
|
@ -112,14 +127,7 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
|
||||||
# When match section title, display all links
|
# When match section title, display all links
|
||||||
filter.filter("Email Sett")
|
filter.filter("Email Sett")
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
links = page.all(".sidebar-section-link-content-text")
|
||||||
expect(links.count).to eq(3)
|
expect(links.map(&:text)).to eq(["Server setup", "Appearance"])
|
||||||
expect(links.map(&:text)).to eq(["Appearance", "Preview Summary", "Server Setup"])
|
|
||||||
|
|
||||||
filter.filter(" preview ")
|
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
|
||||||
expect(links.count).to eq(1)
|
|
||||||
expect(links.map(&:text)).to eq(["Preview Summary"])
|
|
||||||
expect(page).to have_no_css(".sidebar-no-results")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "escapes the filtered expression for regex expressions" do
|
it "escapes the filtered expression for regex expressions" do
|
||||||
|
@ -154,42 +162,58 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
|
||||||
it "encodes the url param in the links when the filter has no results" do
|
it "encodes the url param in the links when the filter has no results" do
|
||||||
visit("/admin")
|
visit("/admin")
|
||||||
|
|
||||||
filter.filter("?")
|
unknown_filter = "blahblah"
|
||||||
|
filter.filter(unknown_filter)
|
||||||
expect(page).to have_no_css(".sidebar-section-link-content-text")
|
expect(page).to have_no_css(".sidebar-section-link-content-text")
|
||||||
expect(page).to have_css(".sidebar-no-results")
|
expect(page).to have_css(".sidebar-no-results")
|
||||||
|
|
||||||
no_results_description = page.find(".sidebar-no-results__description")
|
no_results_description = page.find(".sidebar-no-results__description")
|
||||||
expect(no_results_description.text).to eq(
|
expect(no_results_description.text).to eq(
|
||||||
"We couldn’t find anything matching ‘?’.\n\nDid you want to search site settings or the admin user list?",
|
"We couldn’t find anything matching ‘#{unknown_filter}’.\n\nDid you want to search site settings or the admin user list?",
|
||||||
)
|
)
|
||||||
expect(no_results_description).to have_link(
|
expect(no_results_description).to have_link(
|
||||||
"search site settings",
|
"search site settings",
|
||||||
href: "/admin/site_settings/category/all_results?filter=%3F",
|
href: "/admin/site_settings/category/all_results?filter=#{unknown_filter}",
|
||||||
)
|
)
|
||||||
expect(no_results_description).to have_link(
|
expect(no_results_description).to have_link(
|
||||||
"admin user list?",
|
"admin user list?",
|
||||||
href: "/admin/users/list/active?username=%3F",
|
href: "/admin/users/list/active?username=#{unknown_filter}",
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "temporarily expands section when filter" do
|
it "temporarily expands section when filter" do
|
||||||
visit("/admin")
|
visit("/admin")
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
links = page.all(".sidebar-section-link-content-text")
|
||||||
expect(links.count).to eq(5)
|
|
||||||
expect(links.map(&:text)).to eq(
|
expect(links.map(&:text)).to eq(
|
||||||
["Dashboard", "Users", "Groups", "All Site Settings", "What's New"],
|
[
|
||||||
|
I18n.t("admin_js.admin.dashboard.title"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.users"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.groups"),
|
||||||
|
I18n.t("admin_js.admin.advanced.sidebar_link.all_site_settings"),
|
||||||
|
I18n.t("admin_js.admin.account.sidebar_link.whats_new.title"),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
filter.filter("ie")
|
filter.filter("ie")
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
links = page.all(".sidebar-section-link-content-text")
|
||||||
expect(links.count).to eq(2)
|
expect(links.map(&:text)).to eq(
|
||||||
expect(links.map(&:text)).to eq(["User Fields", "Preview Summary"])
|
[
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.user_fields"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.moderation_flags.title"),
|
||||||
|
I18n.t("admin_js.admin.email_settings.sidebar_link.server_setup.title"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
filter.filter("")
|
filter.filter("")
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
links = page.all(".sidebar-section-link-content-text")
|
||||||
expect(links.count).to eq(5)
|
|
||||||
expect(links.map(&:text)).to eq(
|
expect(links.map(&:text)).to eq(
|
||||||
["Dashboard", "Users", "Groups", "All Site Settings", "What's New"],
|
[
|
||||||
|
I18n.t("admin_js.admin.dashboard.title"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.users"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.groups"),
|
||||||
|
I18n.t("admin_js.admin.advanced.sidebar_link.all_site_settings"),
|
||||||
|
I18n.t("admin_js.admin.account.sidebar_link.whats_new.title"),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -226,16 +250,28 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
|
||||||
it "allows sections to be expanded" do
|
it "allows sections to be expanded" do
|
||||||
visit("/admin")
|
visit("/admin")
|
||||||
sidebar.toggle_all_sections
|
sidebar.toggle_all_sections
|
||||||
expect(page).to have_selector(".sidebar-section-link-content-text", minimum: 50)
|
expect(page).to have_selector(
|
||||||
|
".sidebar-section-link-content-text",
|
||||||
|
minimum: UNFILTERED_LINK_COUNT,
|
||||||
|
)
|
||||||
|
|
||||||
sidebar.toggle_all_sections
|
sidebar.toggle_all_sections
|
||||||
expect(page).to have_selector(".sidebar-section-link-content-text", count: 5)
|
expect(page).to have_selector(".sidebar-section-link-content-text", count: 5)
|
||||||
expect(all(".sidebar-section-link-content-text").map(&:text)).to eq(
|
expect(all(".sidebar-section-link-content-text").map(&:text)).to eq(
|
||||||
["Dashboard", "Users", "Groups", "All Site Settings", "What's New"],
|
[
|
||||||
|
I18n.t("admin_js.admin.dashboard.title"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.users"),
|
||||||
|
I18n.t("admin_js.admin.community.sidebar_link.groups"),
|
||||||
|
I18n.t("admin_js.admin.advanced.sidebar_link.all_site_settings"),
|
||||||
|
I18n.t("admin_js.admin.account.sidebar_link.whats_new.title"),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
sidebar.toggle_all_sections
|
sidebar.toggle_all_sections
|
||||||
expect(page).to have_selector(".sidebar-section-link-content-text", minimum: 50)
|
expect(page).to have_selector(
|
||||||
|
".sidebar-section-link-content-text",
|
||||||
|
minimum: UNFILTERED_LINK_COUNT,
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "accepts hidden keywords like installed plugin names for filter" do
|
it "accepts hidden keywords like installed plugin names for filter" do
|
||||||
|
@ -286,41 +322,13 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
links = page.all(".sidebar-section-link-content-text")
|
||||||
expect(links.map(&:text)).to eq(
|
expect(links.map(&:text)).to eq(
|
||||||
[
|
[
|
||||||
"Dashboard",
|
I18n.t("admin_js.admin.dashboard.title"),
|
||||||
"Users",
|
I18n.t("admin_js.admin.community.sidebar_link.users"),
|
||||||
"Groups",
|
I18n.t("admin_js.admin.community.sidebar_link.groups"),
|
||||||
"What's New",
|
I18n.t("admin_js.admin.account.sidebar_link.whats_new.title"),
|
||||||
"All",
|
I18n.t("admin_js.admin.reports.sidebar_link.all"),
|
||||||
"Watched Words",
|
I18n.t("admin_js.admin.community.sidebar_link.watched_words"),
|
||||||
"Screened IPs",
|
I18n.t("admin_js.admin.security.sidebar_link.staff_action_logs.title"),
|
||||||
"Screened URLs",
|
|
||||||
"Search Logs",
|
|
||||||
"Staff Action Logs",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "displays limited links for moderator with screened emails if allowed" do
|
|
||||||
SiteSetting.moderators_view_emails = true
|
|
||||||
sign_in(moderator)
|
|
||||||
visit("/admin")
|
|
||||||
|
|
||||||
sidebar.toggle_all_sections
|
|
||||||
|
|
||||||
links = page.all(".sidebar-section-link-content-text")
|
|
||||||
expect(links.map(&:text)).to eq(
|
|
||||||
[
|
|
||||||
"Dashboard",
|
|
||||||
"Users",
|
|
||||||
"Groups",
|
|
||||||
"What's New",
|
|
||||||
"All",
|
|
||||||
"Watched Words",
|
|
||||||
"Screened Emails",
|
|
||||||
"Screened IPs",
|
|
||||||
"Screened URLs",
|
|
||||||
"Search Logs",
|
|
||||||
"Staff Action Logs",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue