From 4635ce2926ed660c87a016a8834eafc2fcdcae07 Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 29 Nov 2024 16:33:25 +0100 Subject: [PATCH 1/4] Remove constant definition from global scope in embed.js (#33107) --- public/embed.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/public/embed.js b/public/embed.js index 53372a3890..bc1fac3864 100644 --- a/public/embed.js +++ b/public/embed.js @@ -1,8 +1,5 @@ // @ts-check - -const allowedPrefixes = (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.dataset.allowedPrefixes) ? document.currentScript.dataset.allowedPrefixes.split(' ') : []; - -(function () { +(function (allowedPrefixes) { 'use strict'; /** @@ -127,4 +124,4 @@ const allowedPrefixes = (document.currentScript && document.currentScript.tagNam container.appendChild(iframe); }); }); -})(); +})((document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.dataset.allowedPrefixes) ? document.currentScript.dataset.allowedPrefixes.split(' ') : []); From 986a3676d31aecaa204825945de90fcb22e269e5 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 29 Nov 2024 17:33:06 +0100 Subject: [PATCH 2/4] Change server rules to be collapsible (#33039) --- app/javascript/entrypoints/public.tsx | 74 +++++-------------- .../styles/mastodon-light/diff.scss | 11 --- app/javascript/styles/mastodon/about.scss | 32 +++++++- .../styles/mastodon/components.scss | 60 --------------- app/views/auth/registrations/rules.html.haml | 5 +- 5 files changed, 51 insertions(+), 131 deletions(-) diff --git a/app/javascript/entrypoints/public.tsx b/app/javascript/entrypoints/public.tsx index c1e8418014..9e8ff9caa1 100644 --- a/app/javascript/entrypoints/public.tsx +++ b/app/javascript/entrypoints/public.tsx @@ -230,62 +230,6 @@ function loaded() { } }, ); - - Rails.delegate( - document, - 'button.status__content__spoiler-link', - 'click', - function () { - if (!(this instanceof HTMLButtonElement)) return; - - const statusEl = this.parentNode?.parentNode; - - if ( - !( - statusEl instanceof HTMLDivElement && - statusEl.classList.contains('.status__content') - ) - ) - return; - - if (statusEl.dataset.spoiler === 'expanded') { - statusEl.dataset.spoiler = 'folded'; - this.textContent = new IntlMessageFormat( - localeData['status.show_more'] ?? 'Show more', - locale, - ).format() as string; - } else { - statusEl.dataset.spoiler = 'expanded'; - this.textContent = new IntlMessageFormat( - localeData['status.show_less'] ?? 'Show less', - locale, - ).format() as string; - } - }, - ); - - document - .querySelectorAll('button.status__content__spoiler-link') - .forEach((spoilerLink) => { - const statusEl = spoilerLink.parentNode?.parentNode; - - if ( - !( - statusEl instanceof HTMLDivElement && - statusEl.classList.contains('.status__content') - ) - ) - return; - - const message = - statusEl.dataset.spoiler === 'expanded' - ? (localeData['status.show_less'] ?? 'Show less') - : (localeData['status.show_more'] ?? 'Show more'); - spoilerLink.textContent = new IntlMessageFormat( - message, - locale, - ).format() as string; - }); } Rails.delegate( @@ -439,6 +383,24 @@ Rails.delegate(document, '#registration_new_user,#new_user', 'submit', () => { }); }); +Rails.delegate(document, '.rules-list button', 'click', ({ target }) => { + if (!(target instanceof HTMLElement)) { + return; + } + + const button = target.closest('button'); + + if (!button) { + return; + } + + if (button.ariaExpanded === 'true') { + button.ariaExpanded = 'false'; + } else { + button.ariaExpanded = 'true'; + } +}); + function main() { ready(loaded).catch((error: unknown) => { console.error(error); diff --git a/app/javascript/styles/mastodon-light/diff.scss b/app/javascript/styles/mastodon-light/diff.scss index f2fbfefc85..b19075139a 100644 --- a/app/javascript/styles/mastodon-light/diff.scss +++ b/app/javascript/styles/mastodon-light/diff.scss @@ -108,17 +108,6 @@ background: lighten($white, 4%); } -// Change the background colors of status__content__spoiler-link -.reply-indicator__content .status__content__spoiler-link, -.status__content .status__content__spoiler-link { - background: $ui-base-color; - - &:hover, - &:focus { - background: lighten($ui-base-color, 4%); - } -} - .account-gallery__item a { background-color: $ui-base-color; } diff --git a/app/javascript/styles/mastodon/about.scss b/app/javascript/styles/mastodon/about.scss index 48fe9449f0..9307c21883 100644 --- a/app/javascript/styles/mastodon/about.scss +++ b/app/javascript/styles/mastodon/about.scss @@ -31,13 +31,41 @@ $fluid-breakpoint: $maximum-width + 20px; padding-inline-start: 3em; font-weight: 500; counter-increment: list-counter; + min-height: 4ch; + + button { + background: transparent; + border: 0; + padding: 0; + margin: 0; + text-align: start; + font: inherit; + + &:hover, + &:focus, + &:active { + background: transparent; + } + + &[aria-expanded='false'] .rules-list__hint { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + + @supports (-webkit-line-clamp: 2) { + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + white-space: normal; + } + } + } &::before { content: counter(list-counter); position: absolute; inset-inline-start: 0; - top: 50%; - transform: translateY(-50%); + top: 1em; background: $highlight-text-color; color: $ui-base-color; border-radius: 50%; diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index b5ab74858d..f028f3b2e9 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -1077,26 +1077,6 @@ body > [data-popper-placement] { color: $highlight-text-color; } - .status__content__spoiler-link { - background: $action-button-color; - - &:hover, - &:focus { - background: lighten($action-button-color, 7%); - text-decoration: none; - } - - &::-moz-focus-inner { - border: 0; - } - - &::-moz-focus-inner, - &:focus, - &:active { - outline: 0 !important; - } - } - .status__content__text { display: none; @@ -1354,21 +1334,6 @@ body > [data-popper-placement] { color: $dark-text-color; } -.status__content__spoiler-link { - display: inline-block; - border-radius: 2px; - background: transparent; - border: 0; - color: $inverted-text-color; - font-weight: 700; - font-size: 11px; - padding: 0 6px; - text-transform: uppercase; - line-height: 20px; - cursor: pointer; - vertical-align: top; -} - .status__wrapper--filtered { color: $dark-text-color; border: 0; @@ -1736,11 +1701,6 @@ body > [data-popper-placement] { height: 24px; margin: -1px 0 0; } - - .status__content__spoiler-link { - line-height: 24px; - margin: -1px 0 0; - } } .media-gallery, @@ -2288,17 +2248,6 @@ a.account__display-name { .status__avatar { opacity: 0.5; } - - a.status__content__spoiler-link { - background: $ui-base-lighter-color; - color: $inverted-text-color; - - &:hover, - &:focus { - background: lighten($ui-base-lighter-color, 7%); - text-decoration: none; - } - } } .notification__report { @@ -6310,15 +6259,6 @@ a.status-card { color: $primary-text-color; } - .status__content__spoiler-link { - color: $primary-text-color; - background: $ui-primary-color; - - &:hover { - background: lighten($ui-primary-color, 8%); - } - } - .dialog-option { align-items: center; gap: 12px; diff --git a/app/views/auth/registrations/rules.html.haml b/app/views/auth/registrations/rules.html.haml index 3a05ed54f0..69459c0233 100644 --- a/app/views/auth/registrations/rules.html.haml +++ b/app/views/auth/registrations/rules.html.haml @@ -19,8 +19,9 @@ %ol.rules-list - @rules.each do |rule| %li - .rules-list__text= rule.text - .rules-list__hint= rule.hint + %button{ type: 'button', aria: { expanded: 'false' } } + .rules-list__text= rule.text + .rules-list__hint= rule.hint .stacked-actions - accept_path = @invite_code.present? ? public_invite_url(invite_code: @invite_code, accept: @accept_token) : new_user_registration_path(accept: @accept_token) From 4de108e755db3ff98b644dd2df642c1eaeed9d0a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 29 Nov 2024 17:44:05 +0100 Subject: [PATCH 3/4] Change "social web" to "fediverse" in a few banners in web UI (#33101) --- app/javascript/mastodon/features/explore/links.jsx | 2 +- app/javascript/mastodon/features/explore/statuses.jsx | 2 +- app/javascript/mastodon/features/explore/tags.jsx | 2 +- app/javascript/mastodon/features/firehose/index.jsx | 2 +- .../mastodon/features/public_timeline/index.jsx | 2 +- app/javascript/mastodon/locales/en.json | 8 ++++---- app/javascript/styles/mastodon/components.scss | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/javascript/mastodon/features/explore/links.jsx b/app/javascript/mastodon/features/explore/links.jsx index 035e5aaad8..68cf0283ea 100644 --- a/app/javascript/mastodon/features/explore/links.jsx +++ b/app/javascript/mastodon/features/explore/links.jsx @@ -45,7 +45,7 @@ class Links extends PureComponent { const banner = ( - + ); diff --git a/app/javascript/mastodon/features/explore/statuses.jsx b/app/javascript/mastodon/features/explore/statuses.jsx index 414b47fcdd..883f6906b6 100644 --- a/app/javascript/mastodon/features/explore/statuses.jsx +++ b/app/javascript/mastodon/features/explore/statuses.jsx @@ -58,7 +58,7 @@ class Statuses extends PureComponent { return ( } + prepend={} alwaysPrepend timelineId='explore' statusIds={statusIds} diff --git a/app/javascript/mastodon/features/explore/tags.jsx b/app/javascript/mastodon/features/explore/tags.jsx index 90cf3c32a7..b803d5fa1b 100644 --- a/app/javascript/mastodon/features/explore/tags.jsx +++ b/app/javascript/mastodon/features/explore/tags.jsx @@ -44,7 +44,7 @@ class Tags extends PureComponent { const banner = ( - + ); diff --git a/app/javascript/mastodon/features/firehose/index.jsx b/app/javascript/mastodon/features/firehose/index.jsx index f65bee45ec..ff80aac220 100644 --- a/app/javascript/mastodon/features/firehose/index.jsx +++ b/app/javascript/mastodon/features/firehose/index.jsx @@ -133,7 +133,7 @@ const Firehose = ({ feedType, multiColumn }) => { diff --git a/app/javascript/mastodon/features/public_timeline/index.jsx b/app/javascript/mastodon/features/public_timeline/index.jsx index 91351901f5..aa5a02645d 100644 --- a/app/javascript/mastodon/features/public_timeline/index.jsx +++ b/app/javascript/mastodon/features/public_timeline/index.jsx @@ -142,7 +142,7 @@ class PublicTimeline extends PureComponent { } + prepend={} timelineId={`public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`} onLoadMore={this.handleLoadMore} trackScroll={!pinned} diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 44910c6280..a02eb7741b 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -236,10 +236,10 @@ "disabled_account_banner.text": "Your account {disabledAccount} is currently disabled.", "dismissable_banner.community_timeline": "These are the most recent public posts from people whose accounts are hosted by {domain}.", "dismissable_banner.dismiss": "Dismiss", - "dismissable_banner.explore_links": "These are news stories being shared the most on the social web today. Newer news stories posted by more different people are ranked higher.", - "dismissable_banner.explore_statuses": "These are posts from across the social web that are gaining traction today. Newer posts with more boosts and favorites are ranked higher.", - "dismissable_banner.explore_tags": "These are hashtags that are gaining traction on the social web today. Hashtags that are used by more different people are ranked higher.", - "dismissable_banner.public_timeline": "These are the most recent public posts from people on the social web that people on {domain} follow.", + "dismissable_banner.explore_links": "These news stories are being shared the most on the fediverse today. Newer news stories posted by more different people are ranked higher.", + "dismissable_banner.explore_statuses": "These posts from across the fediverse are gaining traction today. Newer posts with more boosts and favorites are ranked higher.", + "dismissable_banner.explore_tags": "These hashtags are gaining traction on the fediverse today. Hashtags that are used by more different people are ranked higher.", + "dismissable_banner.public_timeline": "These are the most recent public posts from people on the fediverse that people on {domain} follow.", "domain_block_modal.block": "Block server", "domain_block_modal.block_account_instead": "Block @{name} instead", "domain_block_modal.they_can_interact_with_old_posts": "People from this server can interact with your old posts.", diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index f028f3b2e9..a80bf59713 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -968,7 +968,7 @@ body > [data-popper-placement] { p { font-size: 15px; line-height: 22px; - color: $darker-text-color; + color: $secondary-text-color; margin-bottom: 20px; strong { From 75ecc6df068ec2c21b26f05692eb5dfdc35671fa Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sat, 30 Nov 2024 16:37:17 -0500 Subject: [PATCH 4/4] Fix typo `dimsiss` -> `dismiss` in changelog (#33116) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0696f0b31c..240f6d1532 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,7 +68,7 @@ The following changelog entries focus on changes visible to users, administrator - `GET /api/v2/notifications`: https://docs.joinmastodon.org/methods/grouped_notifications/#get-grouped - `GET /api/v2/notifications/:group_key`: https://docs.joinmastodon.org/methods/grouped_notifications/#get-notification-group - `GET /api/v2/notifications/:group_key/accounts`: https://docs.joinmastodon.org/methods/grouped_notifications/#get-group-accounts - - `POST /api/v2/notifications/:group_key/dimsiss`: https://docs.joinmastodon.org/methods/grouped_notifications/#dismiss-group + - `POST /api/v2/notifications/:group_key/dismiss`: https://docs.joinmastodon.org/methods/grouped_notifications/#dismiss-group - `GET /api/v2/notifications/:unread_count`: https://docs.joinmastodon.org/methods/grouped_notifications/#unread-group-count - **Add notification policies, filtered notifications and notification requests** (#29366, #29529, #29433, #29565, #29567, #29572, #29575, #29588, #29646, #29652, #29658, #29666, #29693, #29699, #29737, #29706, #29570, #29752, #29810, #29826, #30114, #30251, #30559, #29868, #31008, #31011, #30996, #31149, #31220, #31222, #31225, #31242, #31262, #31250, #31273, #31310, #31316, #31322, #31329, #31324, #31331, #31343, #31342, #31309, #31358, #31378, #31406, #31256, #31456, #31419, #31457, #31508, #31540, #31541, #31723, #32062 and #32281 by @ClearlyClaire, @Gargron, @TheEssem, @mgmn, @oneiros, and @renchap)\ The old “Block notifications from non-followers”, “Block notifications from people you don't follow” and “Block direct messages from people you don't follow” notification settings have been replaced by a new set of settings found directly in the notification column.\