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:
Martin Brennan 2024-12-20 09:58:42 +10:00 committed by GitHub
parent ec8bda943a
commit b3fa335c7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 114 additions and 204 deletions

View File

@ -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 = [
{
name: "account",
@ -97,7 +94,8 @@ export const ADMIN_NAV_MAP = [
{
name: "admin_moderation_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",
},
],
@ -170,100 +168,25 @@ export const ADMIN_NAV_MAP = [
name: "email_settings",
label: "admin.email_settings.title",
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",
route: "adminCustomizeEmailStyle",
label: "admin.email_settings.sidebar_link.appearance",
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",
label: "admin.security.title",
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",
route: "adminSiteSettingsCategory",
@ -283,7 +206,8 @@ export const ADMIN_NAV_MAP = [
{
name: "admin_logs_staff_action_logs",
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",
moderator: true,
},
@ -309,7 +233,8 @@ export const ADMIN_NAV_MAP = [
name: "admin_api_keys",
route: "adminApiKeys",
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",
@ -341,12 +266,6 @@ export const ADMIN_NAV_MAP = [
label: "admin.advanced.sidebar_link.user_api",
icon: "shuffle",
},
{
name: "admin_api_web_hooks",
route: "adminWebHooks",
label: "admin.advanced.sidebar_link.web_hooks",
icon: "globe",
},
{
name: "admin_onebox",
route: "adminSiteSettingsCategory",

View File

@ -3,10 +3,7 @@ import { warn } from "@ember/debug";
import { htmlSafe } from "@ember/template";
import { adminRouteValid } from "discourse/lib/admin-utilities";
import PreloadStore from "discourse/lib/preload-store";
import {
ADMIN_NAV_MAP,
LOGS_SCREENED_EMAILS_LINK_KEY,
} from "discourse/lib/sidebar/admin-nav-map";
import { ADMIN_NAV_MAP } from "discourse/lib/sidebar/admin-nav-map";
import BaseCustomSidebarPanel from "discourse/lib/sidebar/base-custom-sidebar-panel";
import BaseCustomSidebarSection from "discourse/lib/sidebar/base-custom-sidebar-section";
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) {
navConfig.forEach((section) => {
section.links = section.links.filter((link) => {
if (link.name === LOGS_SCREENED_EMAILS_LINK_KEY) {
return siteSettings.moderators_view_emails;
}
return link.moderator;
});
});

View File

@ -47,9 +47,6 @@ acceptance("Admin Sidebar - Sections", function (needs) {
assert
.dom(".sidebar-section[data-section-name='admin-email_settings']")
.exists("email settings section is displayed");
assert
.dom(".sidebar-section[data-section-name='admin-email_logs']")
.exists("email logs settings section is displayed");
assert
.dom(".sidebar-section[data-section-name='admin-security']")
.exists("security settings section is displayed");

View File

@ -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."
sidebar_title: "Reports"
sidebar_link:
all: "All"
all: "All reports"
new_features:
title: "What's new"
title: "What's new?"
check_for_updates: "Check for updates"
dashboard:
title: "Dashboard"
@ -5149,7 +5149,7 @@ en:
problems_found: "Some advice based on your current site settings"
dismiss_notice: "Dismiss"
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."
previous_announcements: "You can see previous new feature announcements on <a href='%{url}' target='_blank'>Discourse Meta</a>"
learn_more: "Learn more..."
@ -5242,7 +5242,7 @@ en:
type_of_web_hook_event:
label: "Type of event"
flags:
title: "Moderation Flags"
title: "Moderation"
description: "Description"
enabled: "Enabled?"
more_options:
@ -5583,66 +5583,57 @@ en:
sidebar_link:
backups: "Backups"
whats_new:
title: "What's New"
title: "What's new?"
keywords: "changelog|feature|release"
community:
title: "Community"
sidebar_link:
about_your_site: "About Your Site"
about_your_site: "About your site"
badges: "Badges"
login_and_authentication: "Login & Authentication"
login_and_authentication: "Login & authentication"
notifications: "Notifications"
permalinks: "Permalinks"
trust_levels: "Trust Levels"
trust_levels: "Trust levels"
users: "Users"
groups: "Groups"
user_fields: "User Fields"
watched_words: "Watched Words"
user_fields: "User fields"
watched_words: "Watched words"
legal: "Legal"
moderation_flags: "Moderation Flags"
moderation_flags:
title: "Moderation"
keywords: "flag|review"
appearance:
title: "Appearance"
sidebar_link:
font_style: "Font Style"
site_logo: "Site Logo"
color_schemes: "Color Palettes"
font_style: "Font style"
site_logo: "Site logo"
color_schemes: "Color palettes"
emoji: "Emoji"
navigation: "Navigation"
themes: "Themes"
components:
title: "Components"
keywords: "theme|extension"
site_texts: "Site Texts"
site_texts: "Site texts"
email_settings:
title: "Email Settings"
sidebar_link:
appearance: "Appearance"
preview_summary: "Preview Summary"
server_setup: "Server Setup"
email_logs:
title: "Email Logs"
sidebar_link:
sent: "Sent"
skipped: "Skipped"
bounced: "Bounced"
received: "Received"
rejected: "Rejected"
server_setup:
title: "Server setup"
keywords: "email|smtp|mailgun|sendgrid|sent|skipped|bounced|received|rejected|email logs|preview summary"
security:
title: "Security"
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"
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:
account:
@ -5651,7 +5642,7 @@ en:
title: "Backups"
description: "Take a backup of your site's data"
whats_new:
title: "What's New"
title: "What's new?"
description: "Discover new releases and improvements to Discourse"
config_areas:
@ -5709,7 +5700,7 @@ en:
your_organization_saved: "Your organization saved"
saved: "saved!"
flags:
header: "Moderation Flags"
header: "Moderation"
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 dont have to change them. However, if your site has particular requirements you can disable flags you dont need and add your own custom flags."
description: "Description"
@ -5791,18 +5782,19 @@ en:
advanced:
title: "Advanced"
sidebar_link:
api_keys: "API keys"
api_keys:
title: "API keys"
keywords: "token|webhook"
developer: "Developer"
embedding: "Embedding"
rate_limits: "Rate Limits"
rate_limits: "Rate limits"
user_api: "User API"
web_hooks: "Webhooks"
onebox: "Onebox"
files: "Files"
other_options: "Other"
search: "Search"
experimental: "Experimental"
all_site_settings: "All Site Settings"
all_site_settings: "All site settings"
navigation_menu:
sidebar: "Sidebar"

View File

@ -1,6 +1,8 @@
# 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!(:moderator)
@ -50,9 +52,14 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
it "collapses sections by default" do
visit("/admin")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(5)
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
@ -89,14 +96,22 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
visit("/admin")
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")
all_links_count = page.all(".sidebar-section-link-content-text").count
filter.filter("ie")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(2)
expect(links.map(&:text)).to eq(["User Fields", "Preview Summary"])
expect(links.map(&:text)).to eq(
[
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")
filter.filter("ieeee")
@ -112,14 +127,7 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
# When match section title, display all links
filter.filter("Email Sett")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(3)
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")
expect(links.map(&:text)).to eq(["Server setup", "Appearance"])
end
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
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_css(".sidebar-no-results")
no_results_description = page.find(".sidebar-no-results__description")
expect(no_results_description.text).to eq(
"We couldnt find anything matching ?.\n\nDid you want to search site settings or the admin user list?",
"We couldnt 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(
"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(
"admin user list?",
href: "/admin/users/list/active?username=%3F",
href: "/admin/users/list/active?username=#{unknown_filter}",
)
end
it "temporarily expands section when filter" do
visit("/admin")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(5)
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")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(2)
expect(links.map(&:text)).to eq(["User Fields", "Preview Summary"])
expect(links.map(&:text)).to eq(
[
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("")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(5)
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
@ -226,16 +250,28 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
it "allows sections to be expanded" do
visit("/admin")
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
expect(page).to have_selector(".sidebar-section-link-content-text", count: 5)
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
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
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")
expect(links.map(&:text)).to eq(
[
"Dashboard",
"Users",
"Groups",
"What's New",
"All",
"Watched Words",
"Screened IPs",
"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",
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.account.sidebar_link.whats_new.title"),
I18n.t("admin_js.admin.reports.sidebar_link.all"),
I18n.t("admin_js.admin.community.sidebar_link.watched_words"),
I18n.t("admin_js.admin.security.sidebar_link.staff_action_logs.title"),
],
)
end