From e3c4e906464d252070a3f790462b30539e0fa1be Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 13 Feb 2024 12:48:01 +0100 Subject: [PATCH 01/43] Fix new list button being blank (#2616) --- .../flavours/glitch/features/lists/components/new_list_form.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx b/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx index 000ab3ad5..04ff85c65 100644 --- a/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx +++ b/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx @@ -68,7 +68,7 @@ class NewListForm extends PureComponent { - {horizontal && } + + ) : spoilerButton} @@ -229,9 +200,9 @@ export default class Card extends PureComponent { } return ( -
+
{embed} - {!compact && description} + {description}
); } else if (card.get('image')) { @@ -250,7 +221,7 @@ export default class Card extends PureComponent { } return ( - + {embed} {description} diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index 30366b938..f2decf9b5 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -3486,15 +3486,16 @@ input.glitch-setting-text { } .status-card { - position: relative; display: flex; + align-items: center; + position: relative; font-size: 14px; - border: 1px solid lighten($ui-base-color, 8%); - border-radius: 4px; - color: $dark-text-color; + color: $darker-text-color; margin-top: 14px; text-decoration: none; overflow: hidden; + border: 1px solid lighten($ui-base-color, 8%); + border-radius: 8px; &__actions { bottom: 0; @@ -3505,11 +3506,13 @@ input.glitch-setting-text { display: flex; justify-content: center; align-items: center; + cursor: pointer; & > div { background: rgba($base-shadow-color, 0.6); border-radius: 8px; padding: 12px 9px; + backdrop-filter: blur(10px) saturate(180%) contrast(75%) brightness(70%); flex: 0 0 auto; display: flex; justify-content: center; @@ -3539,19 +3542,37 @@ input.glitch-setting-text { position: relative; bottom: -1px; } - - a .fa, - a:hover .fa { - color: inherit; - } } } a.status-card { cursor: pointer; - &:hover { - background: lighten($ui-base-color, 8%); + &:hover, + &:focus, + &:active { + .status-card__title, + .status-card__host, + .status-card__author, + .status-card__description { + color: $highlight-text-color; + } + } +} + +.status-card a { + color: inherit; + text-decoration: none; + + &:hover, + &:focus, + &:active { + .status-card__title, + .status-card__host, + .status-card__author, + .status-card__description { + color: $highlight-text-color; + } } } @@ -3577,41 +3598,66 @@ a.status-card { .status-card__title { display: block; - font-weight: 500; - margin-bottom: 5px; - color: $darker-text-color; + font-weight: 700; + font-size: 19px; + line-height: 24px; + color: $primary-text-color; overflow: hidden; - text-overflow: ellipsis; white-space: nowrap; - text-decoration: none; + text-overflow: ellipsis; +} + +.status-card.expanded .status-card__title { + white-space: normal; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; } .status-card__content { flex: 1 1 auto; overflow: hidden; - padding: 14px; - padding-inline-start: 8px; -} - -.status-card__description { - color: $darker-text-color; - overflow: hidden; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; + padding: 8px 10px; // intentional glitch-soc change to reduce padding + box-sizing: border-box; + max-width: 100%; } .status-card__host { display: block; - margin-top: 5px; - font-size: 13px; + font-size: 14px; + margin-bottom: 8px; + white-space: nowrap; overflow: hidden; text-overflow: ellipsis; +} + +.status-card__author { + display: block; + margin-top: 8px; + font-size: 14px; + color: $primary-text-color; white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + + strong { + font-weight: 500; + } +} + +.status-card__description { + display: block; + margin-top: 8px; + font-size: 14px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } .status-card__image { - flex: 0 0 100px; + flex: 0 0 auto; + width: 96px; // intentional glitch-soc change to better use space + aspect-ratio: 1; background: lighten($ui-base-color, 8%); position: relative; @@ -3626,50 +3672,7 @@ a.status-card { } } -.status-card.horizontal { - display: block; - - .status-card__image { - width: 100%; - } - - .status-card__image-image, - .status-card__image-preview { - border-radius: 4px 4px 0 0; - } - - .status-card__title { - white-space: inherit; - } -} - -.status-card.compact { - border-color: lighten($ui-base-color, 4%); - - &.interactive { - border: 0; - } - - .status-card__content { - padding: 8px; - padding-top: 10px; - } - - .status-card__title { - white-space: nowrap; - } - - .status-card__image { - flex: 0 0 60px; - } -} - -a.status-card.compact:hover { - background-color: lighten($ui-base-color, 4%); -} - .status-card__image-image { - border-radius: 4px 0 0 4px; display: block; margin: 0; width: 100%; @@ -3680,7 +3683,6 @@ a.status-card.compact:hover { } .status-card__image-preview { - border-radius: 4px 0 0 4px; display: block; margin: 0; width: 100%; @@ -3697,6 +3699,37 @@ a.status-card.compact:hover { } } +.status-card.expanded { + flex-direction: column; + align-items: flex-start; +} + +.status-card.expanded .status-card__image { + width: 100%; + aspect-ratio: auto; +} + +.status-card__image, +.status-card__image-image, +.status-card__image-preview { + border-start-start-radius: 8px; + border-start-end-radius: 0; + border-end-end-radius: 0; + border-end-start-radius: 8px; +} + +.status-card.expanded .status-card__image, +.status-card.expanded .status-card__image-image, +.status-card.expanded .status-card__image-preview { + border-start-end-radius: 8px; + border-end-end-radius: 0; + border-end-start-radius: 0; +} + +.status-card.expanded > a { + width: 100%; +} + .notification, .status { position: relative; From 5f50b634cf89a84b5b507fc72ae989564e9962f9 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 20 Feb 2024 18:49:59 +0100 Subject: [PATCH 29/43] Further reduce CSS and markup differences with upstream (#2635) * Further reduce CSS differences with upstream * Reduce differences in markup and CSS with upstream * Redo collapsible post notifications * Reduce CSS differences further * Reduce differences with upstream regarding `.status` and `.status__wrapper` * Further reduce differences with upstream * Reduce differences with upstream in DisplayName --- .../flavours/glitch/components/account.jsx | 2 +- .../glitch/components/collapse_button.jsx | 45 ++ .../glitch/components/display_name.tsx | 11 +- .../flavours/glitch/components/status.jsx | 114 +++-- .../glitch/components/status_header.jsx | 31 +- .../glitch/components/status_icons.jsx | 21 +- .../glitch/components/status_prepend.jsx | 28 +- .../notifications/components/admin_report.jsx | 4 +- .../notifications/components/admin_signup.jsx | 4 +- .../notifications/components/follow.jsx | 4 +- .../components/follow_request.jsx | 4 +- .../features/ui/components/boost_modal.jsx | 12 +- .../ui/components/favourite_modal.jsx | 14 +- .../flavours/glitch/styles/components.scss | 454 +++++++++--------- 14 files changed, 389 insertions(+), 359 deletions(-) create mode 100644 app/javascript/flavours/glitch/components/collapse_button.jsx diff --git a/app/javascript/flavours/glitch/components/account.jsx b/app/javascript/flavours/glitch/components/account.jsx index 266a3ca99..fd7caea6d 100644 --- a/app/javascript/flavours/glitch/components/account.jsx +++ b/app/javascript/flavours/glitch/components/account.jsx @@ -147,7 +147,7 @@ class Account extends ImmutablePureComponent {
- + {!minimal && (
{account.get('followers_count') !== -1 && ( diff --git a/app/javascript/flavours/glitch/components/collapse_button.jsx b/app/javascript/flavours/glitch/components/collapse_button.jsx new file mode 100644 index 000000000..36cda4536 --- /dev/null +++ b/app/javascript/flavours/glitch/components/collapse_button.jsx @@ -0,0 +1,45 @@ +import PropTypes from 'prop-types'; +import { useCallback } from 'react'; + +import { defineMessages, useIntl } from 'react-intl'; + +import ExpandLessIcon from '@/material-icons/400-24px/expand_less.svg?react'; + +import { IconButton } from './icon_button'; + +const messages = defineMessages({ + collapse: { id: 'status.collapse', defaultMessage: 'Collapse' }, + uncollapse: { id: 'status.uncollapse', defaultMessage: 'Uncollapse' }, +}); + +export const CollapseButton = ({ collapsed, setCollapsed }) => { + const intl = useIntl(); + + const handleCollapsedClick = useCallback((e) => { + if (e.button === 0) { + setCollapsed(!collapsed); + e.preventDefault(); + } + }, [collapsed, setCollapsed]); + + return ( + + ); +}; + +CollapseButton.propTypes = { + collapsed: PropTypes.bool, + setCollapsed: PropTypes.func.isRequired, +}; diff --git a/app/javascript/flavours/glitch/components/display_name.tsx b/app/javascript/flavours/glitch/components/display_name.tsx index 82b66b574..dd7d12f70 100644 --- a/app/javascript/flavours/glitch/components/display_name.tsx +++ b/app/javascript/flavours/glitch/components/display_name.tsx @@ -1,7 +1,5 @@ import React from 'react'; -import classNames from 'classnames'; - import type { List } from 'immutable'; import type { Account } from 'flavours/glitch/models/account'; @@ -14,7 +12,6 @@ interface Props { account?: Account; others?: List; localDomain?: string; - inline?: boolean; } export class DisplayName extends React.PureComponent { @@ -51,7 +48,7 @@ export class DisplayName extends React.PureComponent { }; render() { - const { others, localDomain, inline } = this.props; + const { others, localDomain } = this.props; let displayName: React.ReactNode, suffix: React.ReactNode, @@ -114,13 +111,11 @@ export class DisplayName extends React.PureComponent { return ( - {displayName} - {inline ? ' ' : null} - {suffix} + {displayName} {suffix} ); } diff --git a/app/javascript/flavours/glitch/components/status.jsx b/app/javascript/flavours/glitch/components/status.jsx index 62b58a5ec..42076f089 100644 --- a/app/javascript/flavours/glitch/components/status.jsx +++ b/app/javascript/flavours/glitch/components/status.jsx @@ -23,6 +23,7 @@ import { MediaGallery, Video, Audio } from '../features/ui/util/async-components import { displayMedia } from '../initial_state'; import AttachmentList from './attachment_list'; +import { CollapseButton } from './collapse_button'; import { getHashtagBarForStatus } from './hashtag_bar'; import StatusActionBar from './status_action_bar'; import StatusContent from './status_content'; @@ -510,7 +511,6 @@ class Status extends ImmutablePureComponent { render () { const { - handleRef, parseClick, setCollapsed, } = this; @@ -763,7 +763,13 @@ class Status extends ImmutablePureComponent { account={account} parseClick={parseClick} notificationId={this.props.notificationId} - /> + > + {muted && settings.getIn(['collapsed', 'enabled']) && ( +
+ +
+ )} + ); } @@ -771,85 +777,77 @@ class Status extends ImmutablePureComponent { rebloggedByText = intl.formatMessage({ id: 'status.reblogged_by', defaultMessage: '{name} boosted' }, { name: account.get('acct') }); } - const computedClass = classNames('status', `status-${status.get('visibility')}`, { - collapsed: isCollapsed, - 'has-background': isCollapsed && background, - 'status__wrapper-reply': !!status.get('in_reply_to_id'), - 'status--in-thread': !!rootId, - 'status--first-in-thread': previousId && (!connectUp || connectToRoot), - unread, - muted, - }, 'focusable'); - const {statusContentProps, hashtagBar} = getHashtagBarForStatus(status); contentMedia.push(hashtagBar); return (
- {!muted && prepend} + {prepend} - {(connectReply || connectUp || connectToRoot) &&
} +
+ {(connectReply || connectUp || connectToRoot) &&
} -
- - {muted && prepend} - {!muted || !isCollapsed ? ( + {(!muted || !isCollapsed) && ( +
- ) : null} - - +
+ )} + -
- - {!isCollapsed || !(muted || !settings.getIn(['collapsed', 'show_action_bar'])) ? ( - - ) : null} - {notification ? ( - - ) : null} + {(!isCollapsed || !(muted || !settings.getIn(['collapsed', 'show_action_bar']))) && ( + + )} + {notification && ( + + )} +
); diff --git a/app/javascript/flavours/glitch/components/status_header.jsx b/app/javascript/flavours/glitch/components/status_header.jsx index 1c51707ce..692dca5c7 100644 --- a/app/javascript/flavours/glitch/components/status_header.jsx +++ b/app/javascript/flavours/glitch/components/status_header.jsx @@ -45,26 +45,19 @@ export default class StatusHeader extends PureComponent { } return ( - + + + ); } diff --git a/app/javascript/flavours/glitch/components/status_icons.jsx b/app/javascript/flavours/glitch/components/status_icons.jsx index 2727d3410..8ee84fe26 100644 --- a/app/javascript/flavours/glitch/components/status_icons.jsx +++ b/app/javascript/flavours/glitch/components/status_icons.jsx @@ -6,7 +6,6 @@ import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import ExpandLessIcon from '@/material-icons/400-24px/expand_less.svg?react'; import ForumIcon from '@/material-icons/400-24px/forum.svg?react'; import HomeIcon from '@/material-icons/400-24px/home.svg?react'; import ImageIcon from '@/material-icons/400-24px/image.svg?react'; @@ -17,8 +16,7 @@ import MusicNoteIcon from '@/material-icons/400-24px/music_note.svg?react'; import { Icon } from 'flavours/glitch/components/icon'; import { languages } from 'flavours/glitch/initial_state'; - -import { IconButton } from './icon_button'; +import { CollapseButton } from './collapse_button'; import { VisibilityIcon } from './visibility_icon'; const messages = defineMessages({ @@ -118,6 +116,7 @@ class StatusIcons extends PureComponent { mediaIcons, collapsible, collapsed, + setCollapsed, settings, intl, } = this.props; @@ -143,21 +142,7 @@ class StatusIcons extends PureComponent { />} {settings.get('media') && !!mediaIcons && mediaIcons.map(icon => this.renderIcon(icon))} {settings.get('visibility') && } - {collapsible && ( - - )} + {collapsible && }
); } diff --git a/app/javascript/flavours/glitch/components/status_prepend.jsx b/app/javascript/flavours/glitch/components/status_prepend.jsx index 355f65a3e..41902e60b 100644 --- a/app/javascript/flavours/glitch/components/status_prepend.jsx +++ b/app/javascript/flavours/glitch/components/status_prepend.jsx @@ -23,6 +23,7 @@ export default class StatusPrepend extends PureComponent { account: ImmutablePropTypes.map.isRequired, parseClick: PropTypes.func.isRequired, notificationId: PropTypes.number, + children: PropTypes.node, }; handleClick = (e) => { @@ -38,11 +39,13 @@ export default class StatusPrepend extends PureComponent { href={account.get('url')} className='status__display-name' > - + + + ); switch (type) { @@ -112,7 +115,7 @@ export default class StatusPrepend extends PureComponent { render () { const { Message } = this; - const { type } = this.props; + const { type, children } = this.props; let iconId, iconComponent; @@ -146,14 +149,13 @@ export default class StatusPrepend extends PureComponent { return !type ? null : ( ); } diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx index d16a775ea..5ca8b59a5 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx @@ -95,9 +95,7 @@ class AdminReport extends ImmutablePureComponent {
-
- -
+ diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx index 60affd444..4c815099b 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx @@ -86,9 +86,7 @@ class NotificationAdminSignup extends ImmutablePureComponent {
-
- -
+
-
- -
+
-
- -
+
-
-
- - - -
+
+ + + +
diff --git a/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx index 388bc5762..138f44f21 100644 --- a/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx @@ -8,7 +8,6 @@ import { withRouter } from 'react-router-dom'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; - import StarIcon from '@/material-icons/400-24px/star-fill.svg?react'; import AttachmentList from 'flavours/glitch/components/attachment_list'; import { Avatar } from 'flavours/glitch/components/avatar'; @@ -54,13 +53,11 @@ class FavouriteModal extends ImmutablePureComponent {
-
- + diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index f2decf9b5..9d5b73af4 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -412,7 +412,7 @@ body > [data-popper-placement] { .compose-form__warning { color: $inverted-text-color; - margin-bottom: 15px; + margin-bottom: 10px; background: $ui-primary-color; box-shadow: 0 2px 6px rgba($base-shadow-color, 0.3); padding: 8px 10px; @@ -1033,8 +1033,7 @@ body > [data-popper-placement] { .status { padding: 10px 14px; - position: relative; - height: auto; + min-height: 54px; border-bottom: 1px solid lighten($ui-base-color, 8%); cursor: auto; @@ -1090,17 +1089,69 @@ body > [data-popper-placement] { color: $primary-text-color; background: $ui-primary-color; - &:hover { + &:hover, + &:focus { background: lighten($ui-primary-color, 8%); } } } } + &--in-thread { + $thread-margin: 46px + 10px; + + border-bottom: 0; + + .status__content, + .status__action-bar { + margin-inline-start: $thread-margin; + width: calc(100% - ($thread-margin)); + } + } + + &--first-in-thread { + border-top: 1px solid lighten($ui-base-color, 8%); + } + + &__line { + height: 10px - 4px; + border-inline-start: 2px solid lighten($ui-base-color, 8%); + width: 0; + position: absolute; + top: 0; + inset-inline-start: 14px + ((46px - 2px) * 0.5); + + &--full { + top: 0; + height: 100%; + + &::before { + content: ''; + display: block; + position: absolute; + top: 10px - 4px; + height: 46px + 4px + 4px; + width: 2px; + background: $ui-base-color; + inset-inline-start: -2px; + } + } + + &--first { + top: 10px + 46px + 4px; + height: calc(100% - (10px + 46px + 4px)); + + &::before { + display: none; + } + } + } + &.collapsed { background-position: center; background-size: cover; user-select: none; + min-height: 0; &.has-background::before { display: block; @@ -1161,25 +1212,30 @@ body > [data-popper-placement] { rgba(mix($ui-base-color, $ui-highlight-color, 95%), 1) ); } - - .notification__message { - margin-bottom: 0; - } - - .status__info .notification__message > span { - white-space: nowrap; - } } +} +.status__wrapper.collapsed { .notification__message { - margin: -10px 0 10px; + margin-bottom: 0; + white-space: nowrap; + } +} + +.notification__message-collapse-button { + text-align: end; + flex-grow: 2; + + .status__collapse-button .icon { + width: 24px; + height: 24px; } } .status__relative-time { - display: inline-block; - color: $dark-text-color; + display: block; font-size: 14px; + color: $dark-text-color; text-align: end; white-space: nowrap; overflow: hidden; @@ -1198,24 +1254,37 @@ body > [data-popper-placement] { overflow: hidden; } -.status__info__account .status__display-name { - display: block; +.status__info .status__display-name { max-width: 100%; + display: flex; + font-size: 15px; + line-height: 22px; + align-items: center; + gap: 10px; + overflow: hidden; + + .display-name { + bdi { + overflow: hidden; + text-overflow: ellipsis; + } + + &__account { + white-space: nowrap; + display: block; + overflow: hidden; + text-overflow: ellipsis; + } + } } .status__info { + font-size: 15px; + padding-bottom: 10px; display: flex; justify-content: space-between; - font-size: 15px; - - > span { - text-overflow: ellipsis; - overflow: hidden; - } - - .notification__message > span { - word-wrap: break-word; - } + gap: 10px; + cursor: pointer; } .status__info__icons { @@ -1223,23 +1292,21 @@ body > [data-popper-placement] { align-items: center; height: 1em; color: $action-button-color; - - .status__media-icon, - .status__visibility-icon, - .status__reply-icon, - .text-icon { - padding-inline-start: 2px; - padding-inline-end: 2px; - } + gap: 4px; & > .icon { width: 16px; height: 16px; } +} - .status__collapse-button.active > .icon { - transform: rotate(-180deg); - } +.status__collapse-button { + // compensate for large padding built into the icon + margin: -4px; +} + +.status__collapse-button.active > .icon { + transform: rotate(-180deg); } .no-reduce-motion .status__collapse-button { @@ -1256,12 +1323,6 @@ body > [data-popper-placement] { } } -.status__info__account { - display: flex; - align-items: center; - justify-content: flex-start; -} - .status-check-box__status { display: block; box-sizing: border-box; @@ -1298,6 +1359,8 @@ body > [data-popper-placement] { } .status__prepend { + padding: 8px 14px; // intentionally reduced padding in glitch-soc + padding-bottom: 0; display: inline-flex; gap: 10px; font-size: 14px; @@ -1317,14 +1380,14 @@ body > [data-popper-placement] { } .status__action-bar { - align-items: center; display: flex; + align-items: center; gap: 18px; margin-top: 8px; -} -.status__action-bar-spacer { - flex-grow: 1; + &-spacer { + flex-grow: 1; + } } .detailed-status__action-bar-dropdown { @@ -1375,7 +1438,7 @@ body > [data-popper-placement] { } .detailed-status__meta { - margin-top: 15px; + margin-top: 16px; color: $dark-text-color; font-size: 14px; line-height: 18px; @@ -1418,11 +1481,6 @@ body > [data-popper-placement] { } } -.notification__favourite-icon-wrapper { - inset-inline-start: 0; - position: absolute; -} - .detailed-status__link { display: inline-flex; align-items: center; @@ -1656,10 +1714,10 @@ a .account__avatar { } } -a.status__display-name, +.status__display-name, .reply-indicator__display-name, .detailed-status__display-name, -.account__display-name { +a.account__display-name { &:hover .display-name strong { text-decoration: underline; } @@ -1698,15 +1756,9 @@ a.status__display-name, } } -.status__relative-time, -.detailed-status__datetime { - &:hover { - text-decoration: underline; - } -} - .status__avatar { - margin-inline-end: 10px; + width: 46px; + height: 46px; } .muted { @@ -1738,41 +1790,53 @@ a.status__display-name, } .notification__report { - padding: 8px 10px; - padding-inline-start: 68px; - position: relative; + padding: 10px; // deliberate glitch-soc change border-bottom: 1px solid lighten($ui-base-color, 8%); - min-height: 54px; + display: flex; + gap: 10px; &__avatar { - position: absolute; - inset-inline-start: 10px; - top: 10px; + flex: 0 0 auto; } &__details { + flex: 1 1 auto; display: flex; justify-content: space-between; align-items: center; color: $darker-text-color; + gap: 10px; font-size: 15px; line-height: 22px; + white-space: nowrap; + overflow: hidden; + + & > div { + overflow: hidden; + text-overflow: ellipsis; + } strong { font-weight: 500; } } + + &__actions { + flex: 0 0 auto; + } } .notification__message { - margin-inline-start: 42px; - padding-top: 8px; - padding-inline-start: 26px; + padding: 8px 14px 0; // padding intentionally reduced for glitch-soc cursor: default; color: $darker-text-color; font-size: 15px; - position: relative; + + // line-height: 22px; omitted in glitch-soc for space saving + font-weight: 500; + display: flex; align-items: center; + gap: 10px; .icon { color: $highlight-text-color; @@ -1785,7 +1849,7 @@ a.status__display-name, } > span { - display: block; + display: inline; overflow: hidden; text-overflow: ellipsis; } @@ -1837,53 +1901,17 @@ a.status__display-name, text-overflow: ellipsis; overflow: hidden; } - - a { - color: inherit; - text-decoration: inherit; - } - - strong { - display: block; - } - - > a:hover { - strong { - text-decoration: underline; - } - } - - &.inline { - padding: 0; - height: 18px; - font-size: 15px; - line-height: 18px; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - - strong { - display: inline; - height: auto; - font-size: inherit; - line-height: inherit; - } - - span { - display: inline; - height: auto; - font-size: inherit; - line-height: inherit; - } - } } .display-name__html { font-weight: 500; } -.display-name__account { - font-size: 14px; +.status__relative-time, +.detailed-status__datetime { + &:hover { + text-decoration: underline; + } } .image-loader { @@ -3730,59 +3758,6 @@ a.status-card { width: 100%; } -.notification, -.status { - position: relative; - - &--in-thread { - border-bottom: 0; - - .status__content, - .status__action-bar { - margin-inline-start: 46px + 10px; - width: calc(100% - (46px + 10px)); - } - } - - &--first-in-thread { - border-top: 1px solid lighten($ui-base-color, 8%); - } - - &__line { - height: 10px - 4px; - border-inline-start: 2px solid lighten($ui-base-color, 8%); - width: 0; - position: absolute; - top: 0; - inset-inline-start: 14px + ((46px - 2px) * 0.5); - - &--full { - top: 0; - height: 100%; - - &::before { - content: ''; - display: block; - position: absolute; - top: 10px - 4px; - height: 46px + 4px + 4px; - width: 2px; - background: $ui-base-color; - inset-inline-start: -2px; - } - } - - &--first { - top: 10px + 46px + 4px; - height: calc(100% - (10px + 46px + 4px)); - - &::before { - display: none; - } - } - } -} - .load-more { display: block; color: $dark-text-color; @@ -3929,6 +3904,7 @@ a.status-card { margin: 0; border: 0; padding: 13px; + padding-inline-end: 0; color: inherit; background: transparent; font: inherit; @@ -3963,7 +3939,6 @@ a.status-card { .column-header__buttons { height: 48px; display: flex; - margin-inline-start: 0; } .column-header__links { @@ -5073,6 +5048,12 @@ a.status-card { font-weight: 500; display: block; color: $inverted-text-color; + + @each $lang in $cjk-langs { + &:lang(#{$lang}) { + font-weight: 700; + } + } } } @@ -5109,12 +5090,6 @@ a.status-card { strong { font-weight: 500; - - @each $lang in $cjk-langs { - &:lang(#{$lang}) { - font-weight: 700; - } - } } a { @@ -5270,7 +5245,6 @@ a.status-card { .status__content { position: relative; - margin: 10px 0; font-size: 15px; line-height: 20px; word-wrap: break-word; @@ -6092,27 +6066,7 @@ a.status-card { flex-direction: column; .status__relative-time { - color: $dark-text-color; - float: right; - font-size: 14px; - width: auto; - margin: initial; - padding: initial; - } - - .status__visibility-icon { - color: $dark-text-color; - font-size: 14px; - padding: 0 4px; - } - - .status__display-name { - display: flex; - } - - .status__avatar { - height: 48px; - width: 48px; + order: 2; } .status__content__spoiler-link { @@ -6161,15 +6115,6 @@ a.status-card { } } -.boost-modal__status-header { - font-size: 15px; -} - -.boost-modal__status-time { - float: right; - font-size: 14px; -} - .mute-modal, .block-modal { line-height: 24px; @@ -7462,11 +7407,8 @@ img.modal-warning { .notification__filter-bar, .account__section-headline { - background: darken( - $ui-base-color, - 4% - ); // deliberate glitch-soc choice for now - + // deliberate glitch-soc choice for now + background: darken($ui-base-color, 4%); border-bottom: 1px solid lighten($ui-base-color, 8%); cursor: default; display: flex; @@ -7605,6 +7547,90 @@ noscript { } } +@media screen and (width <= 630px) and (height <= 400px) { + $duration: 400ms; + $delay: 100ms; + + .search { + will-change: margin-top; + transition: margin-top $duration $delay; + } + + .navigation-bar { + will-change: padding-bottom; + transition: padding-bottom $duration $delay; + } + + .navigation-bar { + & > a:first-child { + will-change: margin-top, margin-inline-start, margin-inline-end, width; + transition: + margin-top $duration $delay, + margin-inline-start $duration ($duration + $delay), + margin-inline-end $duration ($duration + $delay); + } + + & > .navigation-bar__profile-edit { + will-change: margin-top; + transition: margin-top $duration $delay; + } + + .navigation-bar__actions { + & > .icon-button.close { + will-change: opacity transform; + transition: + opacity $duration * 0.5 $delay, + transform $duration $delay; + } + + & > .compose__action-bar .icon-button { + will-change: opacity transform; + transition: + opacity $duration * 0.5 $delay + $duration * 0.5, + transform $duration $delay; + } + } + } + + .is-composing { + .search { + margin-top: -50px; + } + + .navigation-bar { + padding-bottom: 0; + + & > a:first-child { + margin: -100px 10px 0 -50px; + } + + .navigation-bar__profile { + padding-top: 2px; + } + + .navigation-bar__profile-edit { + position: absolute; + margin-top: -60px; + } + + .navigation-bar__actions { + .icon-button.close { + pointer-events: auto; + opacity: 1; + transform: scale(1, 1) translate(0, 0); + bottom: 5px; + } + + .compose__action-bar .icon-button { + pointer-events: none; + opacity: 0; + transform: scale(0, 1) translate(100%, 0); + } + } + } + } +} + .embed-modal { width: auto; max-width: 80vw; @@ -8682,7 +8708,7 @@ noscript { } .notification, -.status { +.status__wrapper { position: relative; &.unread { From 4ad7fadb824c6219e2c3a17d30e9f53554398099 Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Tue, 20 Feb 2024 20:19:58 +0100 Subject: [PATCH 30/43] Fix logging error in streaming server (#2636) Logger changed upstream causing `log.silly` to error and crash the server for local only statuses --- streaming/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streaming/index.js b/streaming/index.js index 0d7bf2fc8..b9bdb44f2 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -767,7 +767,7 @@ const startServer = async () => { // Only send local-only statuses to logged-in users if ((event === 'update' || event === 'status.update') && payload.local_only && !(req.accountId && allowLocalOnly)) { - log.silly(req.requestId, `Message ${payload.id} filtered because it was local-only`); + log.debug(`Message ${payload.id} filtered because it was local-only`); return; } From bf6e57b420ed929ac9d670d1f12e2a1cf5eab80a Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 20 Feb 2024 23:06:17 +0100 Subject: [PATCH 31/43] Further reduce CSS and markup differences with upstream (#2637) * Reduce differences in `MovedNote` markup and styling * Remove unused setting toggle meta text support * Fix various CSS discrepancies with upstream * Further reduce differences with upstream --- .../components/moved_note.jsx | 42 ++--- .../components/setting_toggle.jsx | 4 +- .../flavours/glitch/styles/components.scss | 168 ++++-------------- 3 files changed, 50 insertions(+), 164 deletions(-) diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx b/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx index 9ccf5bd17..cb8836ef7 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx @@ -1,54 +1,38 @@ import { FormattedMessage } from 'react-intl'; -import { withRouter } from 'react-router-dom'; - import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; - -import TripIcon from '@/material-icons/400-24px/trip.svg?react'; -import { Icon } from 'flavours/glitch/components/icon'; -import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router'; - import { AvatarOverlay } from '../../../components/avatar_overlay'; import { DisplayName } from '../../../components/display_name'; +import { Permalink } from '../../../components/permalink'; -class MovedNote extends ImmutablePureComponent { +export default class MovedNote extends ImmutablePureComponent { static propTypes = { from: ImmutablePropTypes.map.isRequired, to: ImmutablePropTypes.map.isRequired, - ...WithRouterPropTypes, - }; - - handleAccountClick = e => { - if (e.button === 0) { - e.preventDefault(); - this.props.history.push(`/@${this.props.to.get('acct')}`); - } - - e.stopPropagation(); }; render () { const { from, to } = this.props; - const displayNameHtml = { __html: from.get('display_name_html') }; return ( -
-
-
- }} /> +
+
+ }} />
- -
- -
+
+ +
+ +
+ + +
); } } - -export default withRouter(MovedNote); diff --git a/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx b/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx index 2f849c548..9bf4b147a 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx @@ -12,7 +12,6 @@ export default class SettingToggle extends PureComponent { settings: ImmutablePropTypes.map.isRequired, settingPath: PropTypes.array.isRequired, label: PropTypes.node.isRequired, - meta: PropTypes.node, onChange: PropTypes.func.isRequired, defaultValue: PropTypes.bool, disabled: PropTypes.bool, @@ -23,14 +22,13 @@ export default class SettingToggle extends PureComponent { }; render () { - const { prefix, settings, settingPath, label, meta, defaultValue, disabled } = this.props; + const { prefix, settings, settingPath, label, defaultValue, disabled } = this.props; const id = ['setting-toggle', prefix, ...settingPath].filter(Boolean).join('-'); return (
- {meta && {meta}}
); } diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index 9d5b73af4..9e21cc36b 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -374,7 +374,7 @@ body > [data-popper-placement] { } .compose-form { - padding: 10px; + padding: 10px; // glitch: reduced padding &__sensitive-button { padding: 10px; @@ -1032,7 +1032,7 @@ body > [data-popper-placement] { } .status { - padding: 10px 14px; + padding: 10px 14px; // glitch: reduced padding min-height: 54px; border-bottom: 1px solid lighten($ui-base-color, 8%); cursor: auto; @@ -1050,9 +1050,11 @@ body > [data-popper-placement] { opacity: 1; animation: fade 150ms linear; + .media-gallery, .video-player, - .audio-player { - margin-top: 8px; + .audio-player, + .attachment-list { + margin-top: 8px; // glitch: reduced margins } &.status-direct { @@ -1085,7 +1087,7 @@ body > [data-popper-placement] { color: $highlight-text-color; } - a.status__content__spoiler-link { + &__spoiler-link { color: $primary-text-color; background: $ui-primary-color; @@ -1251,7 +1253,6 @@ body > [data-popper-placement] { .status__display-name { color: $dark-text-color; - overflow: hidden; } .status__info .status__display-name { @@ -1359,7 +1360,7 @@ body > [data-popper-placement] { } .status__prepend { - padding: 8px 14px; // intentionally reduced padding in glitch-soc + padding: 8px 14px; // glitch: reduced padding padding-bottom: 0; display: inline-flex; gap: 10px; @@ -1400,7 +1401,7 @@ body > [data-popper-placement] { .detailed-status { background: lighten($ui-base-color, 4%); - padding: 14px 10px; + padding: 14px 10px; // glitch: reduced padding border-top: 1px solid lighten($ui-base-color, 8%); &--flex { @@ -1456,7 +1457,7 @@ body > [data-popper-placement] { border-bottom: 1px solid lighten($ui-base-color, 8%); display: flex; flex-direction: row; - padding: 8px 0; + padding: 8px 0; // glitch: reduced padding } .compose-form__textarea-icons { @@ -1527,7 +1528,7 @@ body > [data-popper-placement] { } .account { - padding: 10px; + padding: 10px; // glitch: reduced padding border-bottom: 1px solid lighten($ui-base-color, 8%); .account__display-name { @@ -1790,7 +1791,7 @@ a.account__display-name { } .notification__report { - padding: 10px; // deliberate glitch-soc change + padding: 10px; // glitch: reduced padding border-bottom: 1px solid lighten($ui-base-color, 8%); display: flex; gap: 10px; @@ -1827,12 +1828,12 @@ a.account__display-name { } .notification__message { - padding: 8px 14px 0; // padding intentionally reduced for glitch-soc + padding: 8px 14px; // glitch: reduced padding + padding-bottom: 0; cursor: default; color: $darker-text-color; font-size: 15px; - - // line-height: 22px; omitted in glitch-soc for space saving + line-height: 22px; font-weight: 500; display: flex; align-items: center; @@ -1885,7 +1886,6 @@ a.account__display-name { text-decoration: none; &:hover { - color: $primary-text-color; text-decoration: underline; } } @@ -1975,7 +1975,7 @@ a.account__display-name { } .navigation-bar { - padding: 10px; + padding: 10px; // glitch: reduced padding display: flex; align-items: center; flex-shrink: 0; @@ -2012,6 +2012,7 @@ a.account__display-name { display: flex; flex-direction: column; flex: 1 1 auto; + line-height: 20px; } .navigation-bar__profile-account { @@ -2056,14 +2057,14 @@ a.account__display-name { .dropdown-menu__separator { border-bottom: 1px solid var(--dropdown-border-color); - margin: 2px 0; + margin: 2px 0; // glitch: reduced margins height: 0; } .dropdown-menu { background: var(--dropdown-background-color); border: 1px solid var(--dropdown-border-color); - padding: 2px; + padding: 2px; // glitch: reduced padding border-radius: 4px; box-shadow: var(--dropdown-shadow); z-index: 9999; @@ -2093,8 +2094,8 @@ a.account__display-name { &__container { &__header { border-bottom: 1px solid var(--dropdown-border-color); - padding: 6px 14px; - padding-bottom: 12px; + padding: 6px 14px; // glitch: reduced padding + padding-bottom: 12px; // glitch: reduced padding margin-bottom: 4px; font-size: 13px; line-height: 18px; @@ -2150,7 +2151,7 @@ a.account__display-name { font: inherit; display: block; width: 100%; - padding: 6px 14px; + padding: 6px 14px; // glitch: reduced padding border: 0; margin: 0; background: transparent; @@ -2931,6 +2932,8 @@ $ui-header-height: 55px; display: flex; flex-direction: column; min-height: 310px; + padding-bottom: 71px; + margin-bottom: -71px; } .compose-form__autosuggest-wrapper { @@ -3645,7 +3648,7 @@ a.status-card { .status-card__content { flex: 1 1 auto; overflow: hidden; - padding: 8px 10px; // intentional glitch-soc change to reduce padding + padding: 8px 10px; // glitch: reduced padding box-sizing: border-box; max-width: 100%; } @@ -3684,7 +3687,7 @@ a.status-card { .status-card__image { flex: 0 0 auto; - width: 96px; // intentional glitch-soc change to better use space + width: 96px; // glitch: intentional change to better use space aspect-ratio: 1; background: lighten($ui-base-color, 8%); position: relative; @@ -4392,12 +4395,12 @@ a.status-card { z-index: 100; &--minified { - display: flex; + display: flex; // glitch: media icon in spoiler button inset-inline-start: 4px; top: 4px; width: auto; height: auto; - align-items: center; + align-items: center; // glitch: media icon in spoiler button } &--click-thru { @@ -4616,8 +4619,7 @@ a.status-card { line-height: 24px; } -.setting-toggle__label, -.setting-meta__label { +.setting-toggle__label { color: $darker-text-color; display: inline-block; margin-bottom: 14px; @@ -4625,10 +4627,6 @@ a.status-card { vertical-align: middle; } -.setting-meta__label { - float: right; -} - .limited-account-hint { p { color: $secondary-text-color; @@ -5162,43 +5160,6 @@ a.status-card { } } -.account__moved-note { - padding: 14px 10px; - padding-bottom: 16px; - background: lighten($ui-base-color, 4%); - border-top: 1px solid lighten($ui-base-color, 8%); - border-bottom: 1px solid lighten($ui-base-color, 8%); - - &__message { - position: relative; - margin-inline-start: 58px; - color: $dark-text-color; - padding: 8px 0; - padding-top: 0; - padding-bottom: 4px; - font-size: 14px; - - > span { - display: block; - overflow: hidden; - text-overflow: ellipsis; - } - } - - &__icon-wrapper { - inset-inline-start: -26px; - position: absolute; - } - - .detailed-status__display-avatar { - position: relative; - } - - .detailed-status__display-name { - margin-bottom: 0; - } -} - @keyframes spring-flip-in { 0% { transform: rotate(0deg); @@ -5340,16 +5301,6 @@ a.status-card { } } -.notification-favourite { - .status.status-direct { - background: transparent; - - .icon-button.disabled { - color: lighten($action-button-color, 13%); - } - } -} - .language-dropdown { &__dropdown { background: $simple-background-color; @@ -6666,6 +6617,7 @@ a.status-card { z-index: 9999; } +// glitch: deprecated settings modal img.modal-warning { display: block; margin: auto; @@ -6673,65 +6625,19 @@ img.modal-warning { width: 60px; } -.column { - overflow: hidden; - - .wide .columns-area:not(.columns-area--mobile) & { +// glitch: optional wide mode +.wide .columns-area:not(.columns-area--mobile) { + .column { flex: auto; min-width: 330px; max-width: 400px; } - > .scrollable { - background: $ui-base-color; - border-radius: 0 0 4px 4px; - } -} - -.drawer { - padding: 10px 5px; - flex: none; - - &:first-child { - padding-inline-start: 10px; - } - - &:last-child { - padding-inline-end: 10px; - } - - @media screen and (width <= 630px) { - flex: auto; - } - - @media screen and (width <= 630px) { - &, - &:first-child, - &:last-child { - padding: 0; - } - } - - .wide & { + .drawer { min-width: 300px; max-width: 400px; flex: 1 1 200px; } - - @media screen and (width <= 630px) { - :root & { - // Overrides `.wide` for single-column view - flex: auto; - width: 100%; - min-width: 0; - max-width: none; - padding: 0; - } - } - - .react-swipeable-view-container & { - height: 100%; - } } .media-gallery__item__badges { @@ -6769,7 +6675,7 @@ img.modal-warning { font-size: 14px; border: 1px solid lighten($ui-base-color, 8%); border-radius: 4px; - margin-top: 14px; // glitch-soc change to reduce margins + margin-top: 14px; // glitch: reduced margins overflow: hidden; &__icon { @@ -6811,7 +6717,7 @@ img.modal-warning { &.compact { border: 0; - margin-top: 4px; // glitch-soc addition to reduce margins + margin-top: 4px; // glitch: reduced margins .attachment-list__list { padding: 0; @@ -6908,8 +6814,6 @@ img.modal-warning { overflow: hidden; position: relative; width: 100%; - display: flex; - justify-content: center; } .media-gallery__item-gifv-thumbnail { From 154a3119fb45401dcd785b085b28fe18202b091c Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 21 Feb 2024 17:50:41 +0100 Subject: [PATCH 32/43] Further reduce CSS differences with upstream (#2638) --- .../flavours/glitch/styles/components.scss | 153 ++++++++---------- 1 file changed, 66 insertions(+), 87 deletions(-) diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index 9e21cc36b..b37ffe322 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -852,21 +852,33 @@ body > [data-popper-placement] { clear: both; } +.status__content, .reply-indicator__content { position: relative; - font-size: 14px; + font-size: 15px; line-height: 20px; word-wrap: break-word; font-weight: 400; overflow: hidden; - padding-top: 5px; - color: $inverted-text-color; - white-space: pre-wrap; + text-overflow: ellipsis; + padding-top: 2px; + color: $primary-text-color; + + &:focus { + outline: 0; + } + + .emojione { + width: 20px; + height: 20px; + margin: -3px 0 0; + } p, pre { margin-bottom: 20px; white-space: pre-wrap; + unicode-bidi: plaintext; &:last-child { margin-bottom: 0; @@ -874,8 +886,9 @@ body > [data-popper-placement] { } a { - color: $lighter-text-color; + color: $secondary-text-color; text-decoration: none; + unicode-bidi: isolate; &:hover { text-decoration: underline; @@ -892,10 +905,45 @@ body > [data-popper-placement] { } } - .emojione { - width: 20px; - height: 20px; - margin: -5px 0 0; + a.unhandled-link { + color: $highlight-text-color; + + .link-origin-tag { + color: $gold-star; + font-size: 0.8em; + } + } + + .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 { + overflow: visible; + + .status__content__spoiler { + display: none; + + &.status__content__spoiler--visible { + display: block; + } } } @@ -1503,6 +1551,15 @@ body > [data-popper-placement] { line-height: 18px; } +.reply-indicator__content { + color: $inverted-text-color; + font-size: 14px; + + a { + color: $lighter-text-color; + } +} + .domain { padding: 10px; border-bottom: 1px solid lighten($ui-base-color, 8%); @@ -5204,84 +5261,6 @@ a.status-card { } } -.status__content { - position: relative; - font-size: 15px; - line-height: 20px; - word-wrap: break-word; - font-weight: 400; - overflow: visible; - padding-top: 5px; - - &:focus { - outline: 0; - } - - .emojione { - width: 20px; - height: 20px; - margin: -3px 0 0; - } - - p, - pre { - margin-bottom: 20px; - white-space: pre-wrap; - unicode-bidi: plaintext; - - &:last-child { - margin-bottom: 0; - } - } - - a { - color: $secondary-text-color; - text-decoration: none; - unicode-bidi: isolate; - - &:hover { - text-decoration: underline; - } - - &.mention { - &:hover { - text-decoration: none; - - span { - text-decoration: underline; - } - } - } - } - - .status__content__spoiler { - display: none; - - &.status__content__spoiler--visible { - display: block; - } - } - - a.unhandled-link { - color: $highlight-text-color; - - .link-origin-tag { - color: $gold-star; - font-size: 0.8em; - } - } - - .status__content__spoiler-link { - background: lighten($ui-base-color, 30%); - - &:hover, - &:focus { - background: lighten($ui-base-color, 33%); - text-decoration: none; - } - } -} - .notif-cleaning { .status, .notification { From 604c93332f860105aca0d02d1654b1220f7ca679 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 21 Feb 2024 19:30:54 +0100 Subject: [PATCH 33/43] Fix pillbar button colors (#2639) --- app/javascript/flavours/glitch/styles/components.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index b37ffe322..831efb01e 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -4185,7 +4185,7 @@ a.status-card { margin: 0; font-size: inherit; flex: auto; - background-color: $ui-base-color; + background-color: lighten($ui-base-color, 8%); transition: all 0.2s ease; transition-property: background-color, box-shadow; From fff378177eaf9c39ce817a715121ecd56c564adc Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 22 Feb 2024 18:45:54 +0100 Subject: [PATCH 34/43] Further reduce differences with upstream (mainly private mention styling) (#2641) * Use upstream's CSS for private mentions styling * Further reduce differences with upstream --- .../flavours/glitch/styles/components.scss | 239 +++++++++++------- 1 file changed, 144 insertions(+), 95 deletions(-) diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index 831efb01e..954a014f3 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -774,6 +774,28 @@ body > [data-popper-placement] { opacity 0.4s ease; } +.compose-form__textarea-icons { + display: block; + position: absolute; + top: 29px; + inset-inline-end: 5px; + bottom: 5px; + overflow: hidden; + + & > .textarea_icon { + display: block; + margin-top: 2px; + margin-inline-start: 2px; + width: 24px; + height: 24px; + color: $lighter-text-color; + font-size: 18px; + line-height: 24px; + text-align: center; + opacity: 0.8; + } +} + .sign-in-banner { padding: 10px; @@ -933,10 +955,6 @@ body > [data-popper-placement] { outline: 0 !important; } } -} - -.status__content { - overflow: visible; .status__content__spoiler { display: none; @@ -947,6 +965,11 @@ body > [data-popper-placement] { } } +.status__content { + // glitch: necessary for fullwidth media options + overflow: visible; +} + .announcements__item__content { word-wrap: break-word; overflow-y: auto; @@ -990,6 +1013,30 @@ body > [data-popper-placement] { } } +.status__content__read-more-button, +.status__content__translate-button { + display: flex; + align-items: center; + font-size: 15px; + line-height: 22px; + color: $highlight-text-color; + border: 0; + background: transparent; + padding: 0; + padding-top: 16px; + text-decoration: none; + + &:hover, + &:active { + text-decoration: underline; + } + + .icon { + width: 15px; + height: 15px; + } +} + .translate-button { margin-top: 16px; font-size: 15px; @@ -1002,7 +1049,7 @@ body > [data-popper-placement] { .status__content__spoiler-link { display: inline-flex; border-radius: 2px; - background: lighten($ui-base-color, 30%); + background: transparent; border: 0; color: $inverted-text-color; font-weight: 700; @@ -1064,14 +1111,6 @@ body > [data-popper-placement] { outline: 0; background: lighten($ui-base-color, 4%); - &.status.status-direct { - background: mix(lighten($ui-base-color, 4%), $ui-highlight-color, 95%); - - &.muted { - background: transparent; - } - } - .detailed-status, .detailed-status__action-bar { background: lighten($ui-base-color, 8%); @@ -1105,11 +1144,6 @@ body > [data-popper-placement] { margin-top: 8px; // glitch: reduced margins } - &.status-direct { - background: mix($ui-base-color, $ui-highlight-color, 95%); - border-bottom-color: lighten($ui-base-color, 12%); - } - &.light { .status__relative-time, .status__visibility-icon { @@ -1157,6 +1191,10 @@ body > [data-popper-placement] { margin-inline-start: $thread-margin; width: calc(100% - ($thread-margin)); } + + .status__content__read-more-button { + margin-inline-start: $thread-margin; + } } &--first-in-thread { @@ -1256,6 +1294,7 @@ body > [data-popper-placement] { ); } + // TODO: review &.status-direct > .status__content::after { background: linear-gradient( rgba(mix($ui-base-color, $ui-highlight-color, 95%), 0), @@ -1372,6 +1411,50 @@ body > [data-popper-placement] { } } +@keyframes spring-flip-in { + 0% { + transform: rotate(0deg); + } + + 30% { + transform: rotate(-242.4deg); + } + + 60% { + transform: rotate(-158.35deg); + } + + 90% { + transform: rotate(-187.5deg); + } + + 100% { + transform: rotate(-180deg); + } +} + +@keyframes spring-flip-out { + 0% { + transform: rotate(-180deg); + } + + 30% { + transform: rotate(62.4deg); + } + + 60% { + transform: rotate(-21.635deg); + } + + 90% { + transform: rotate(7.5deg); + } + + 100% { + transform: rotate(0deg); + } +} + .status-check-box__status { display: block; box-sizing: border-box; @@ -1428,6 +1511,18 @@ body > [data-popper-placement] { } } +.status__wrapper-direct { + background: mix($ui-base-color, $ui-highlight-color, 95%); + + &:focus { + background: mix(lighten($ui-base-color, 4%), $ui-highlight-color, 95%); + } + + .status__prepend { + color: $highlight-text-color; + } +} + .status__action-bar { display: flex; align-items: center; @@ -1473,6 +1568,11 @@ body > [data-popper-placement] { height: 24px; margin: -1px 0 0; } + + .status__content__spoiler-link { + line-height: 24px; + margin: -1px 0 0; + } } .media-gallery, @@ -1508,25 +1608,29 @@ body > [data-popper-placement] { padding: 8px 0; // glitch: reduced padding } -.compose-form__textarea-icons { - display: block; - position: absolute; - top: 29px; - inset-inline-end: 5px; - bottom: 5px; - overflow: hidden; +.detailed-status__wrapper-direct { + .detailed-status, + .detailed-status__action-bar { + background: mix($ui-base-color, $ui-highlight-color, 95%); + } - & > .textarea_icon { - display: block; - margin-top: 2px; - margin-inline-start: 2px; - width: 24px; - height: 24px; - color: $lighter-text-color; - font-size: 18px; - line-height: 24px; - text-align: center; - opacity: 0.8; + &:focus { + .detailed-status, + .detailed-status__action-bar { + background: mix(lighten($ui-base-color, 4%), $ui-highlight-color, 95%); + } + } + + .detailed-status__action-bar { + border-top-color: mix( + lighten($ui-base-color, 8%), + $ui-highlight-color, + 95% + ); + } + + .status__prepend { + color: $highlight-text-color; } } @@ -4659,10 +4763,10 @@ a.status-card { margin-bottom: 4px; display: block; background-color: rgba($black, 0.45); - text-transform: uppercase; font-size: 11px; - font-weight: 500; - padding: 4px; + text-transform: uppercase; + font-weight: 700; + padding: 2px 6px; border-radius: 4px; opacity: 0.7; @@ -5217,50 +5321,6 @@ a.status-card { } } -@keyframes spring-flip-in { - 0% { - transform: rotate(0deg); - } - - 30% { - transform: rotate(-242.4deg); - } - - 60% { - transform: rotate(-158.35deg); - } - - 90% { - transform: rotate(-187.5deg); - } - - 100% { - transform: rotate(-180deg); - } -} - -@keyframes spring-flip-out { - 0% { - transform: rotate(-180deg); - } - - 30% { - transform: rotate(62.4deg); - } - - 60% { - transform: rotate(-21.635deg); - } - - 90% { - transform: rotate(7.5deg); - } - - 100% { - transform: rotate(0deg); - } -} - .notif-cleaning { .status, .notification { @@ -5268,18 +5328,6 @@ a.status-card { } } -.notification-follow, -.notification-follow-request { - position: relative; - - // same like Status - border-bottom: 1px solid lighten($ui-base-color, 8%); - - .account { - border-bottom: 0 none; - } -} - .language-dropdown { &__dropdown { background: $simple-background-color; @@ -8614,6 +8662,7 @@ noscript { inset-inline-end: 20px; width: 300px; + // glitch: feature to chose which side the pop-in player is displayed &.left { inset-inline-end: unset; inset-inline-start: 20px; From 7cd5866ddc1e5db080ccb200f7d631d6866105f1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 13:59:51 +0100 Subject: [PATCH 35/43] Update dependency doorkeeper to v5.6.9 (#29196) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0b53df82e..79d3b1e63 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -219,7 +219,7 @@ GEM docile (1.4.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (5.6.8) + doorkeeper (5.6.9) railties (>= 5) dotenv (2.8.1) dotenv-rails (2.8.1) @@ -811,7 +811,7 @@ GEM xorcist (1.1.3) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.12) + zeitwerk (2.6.13) PLATFORMS ruby From 840ce1e0cb4ba47861fac9876819a0e4b3928552 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 09:11:22 +0000 Subject: [PATCH 36/43] Update dependency webmock to v3.21.2 (#29290) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 79d3b1e63..fac511d02 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -793,7 +793,7 @@ GEM webfinger (1.2.0) activesupport httpclient (>= 2.4) - webmock (3.20.0) + webmock (3.21.2) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) From fec49022ed00323d1176c51b0949f45ee78d8fb7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:17:41 +0100 Subject: [PATCH 37/43] Update dependency selenium-webdriver to v4.18.1 (#29287) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fac511d02..8dd1a7ed0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -691,7 +691,7 @@ GEM scenic (1.7.0) activerecord (>= 4.0.0) railties (>= 4.0.0) - selenium-webdriver (4.17.0) + selenium-webdriver (4.18.1) base64 (~> 0.2) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) From d10848946c391e343e0b19f88672a159c2293fc5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:37:52 +0100 Subject: [PATCH 38/43] Update dependency rails to v7.1.3.2 (#29342) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 110 +++++++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8dd1a7ed0..b88a06256 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,35 +10,35 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + actioncable (7.1.3.2) + actionpack (= 7.1.3.2) + activesupport (= 7.1.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actionmailbox (7.1.3.2) + actionpack (= 7.1.3.2) + activejob (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3) - actionpack (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activesupport (= 7.1.3) + actionmailer (7.1.3.2) + actionpack (= 7.1.3.2) + actionview (= 7.1.3.2) + activejob (= 7.1.3.2) + activesupport (= 7.1.3.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3) - actionview (= 7.1.3) - activesupport (= 7.1.3) + actionpack (7.1.3.2) + actionview (= 7.1.3.2) + activesupport (= 7.1.3.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -46,15 +46,15 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3) - actionpack (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actiontext (7.1.3.2) + actionpack (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3) - activesupport (= 7.1.3) + actionview (7.1.3.2) + activesupport (= 7.1.3.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -64,22 +64,22 @@ GEM activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.1.3) - activesupport (= 7.1.3) + activejob (7.1.3.2) + activesupport (= 7.1.3.2) globalid (>= 0.3.6) - activemodel (7.1.3) - activesupport (= 7.1.3) - activerecord (7.1.3) - activemodel (= 7.1.3) - activesupport (= 7.1.3) + activemodel (7.1.3.2) + activesupport (= 7.1.3.2) + activerecord (7.1.3.2) + activemodel (= 7.1.3.2) + activesupport (= 7.1.3.2) timeout (>= 0.4.0) - activestorage (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activesupport (= 7.1.3) + activestorage (7.1.3.2) + actionpack (= 7.1.3.2) + activejob (= 7.1.3.2) + activerecord (= 7.1.3.2) + activesupport (= 7.1.3.2) marcel (~> 1.0) - activesupport (7.1.3) + activesupport (7.1.3.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -444,7 +444,7 @@ GEM uri net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.4.9.1) + net-imap (0.4.10) date net-protocol net-ldap (0.19.0) @@ -532,7 +532,7 @@ GEM activesupport (>= 3.0.0) raabro (1.4.0) racc (1.7.3) - rack (2.2.8) + rack (2.2.8.1) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (2.0.1) @@ -554,20 +554,20 @@ GEM rackup (1.0.0) rack (< 3) webrick - rails (7.1.3) - actioncable (= 7.1.3) - actionmailbox (= 7.1.3) - actionmailer (= 7.1.3) - actionpack (= 7.1.3) - actiontext (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activemodel (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + rails (7.1.3.2) + actioncable (= 7.1.3.2) + actionmailbox (= 7.1.3.2) + actionmailer (= 7.1.3.2) + actionpack (= 7.1.3.2) + actiontext (= 7.1.3.2) + actionview (= 7.1.3.2) + activejob (= 7.1.3.2) + activemodel (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) bundler (>= 1.15.0) - railties (= 7.1.3) + railties (= 7.1.3.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -582,9 +582,9 @@ GEM rails-i18n (7.0.8) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + railties (7.1.3.2) + actionpack (= 7.1.3.2) + activesupport (= 7.1.3.2) irb rackup (>= 1.0.0) rake (>= 12.2) From 3dae23816bdcf149c6ab974a338b8c1514949d4c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 12:26:48 +0100 Subject: [PATCH 39/43] Update dependency haml_lint to v0.57.0 (#29181) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b88a06256..07e6afb1c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -309,7 +309,7 @@ GEM activesupport (>= 5.1) haml (>= 4.0.6) railties (>= 5.1) - haml_lint (0.56.0) + haml_lint (0.57.0) haml (>= 5.0) parallel (~> 1.10) rainbow From d908ed8e86d08e67c91a41f6f90bd33c6552446f Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Tue, 20 Feb 2024 11:10:58 +0100 Subject: [PATCH 40/43] Remove unused dependencies (#29289) --- package.json | 6 +----- yarn.lock | 19 +++---------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index abb65a98d..f38457272 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,6 @@ "mark-loader": "^0.1.6", "marky": "^1.2.5", "mini-css-extract-plugin": "^1.6.2", - "mkdirp": "^3.0.1", "path-complete-extname": "^1.0.0", "postcss": "^8.4.24", "postcss-loader": "^4.3.0", @@ -121,7 +120,6 @@ "redux-immutable": "^4.0.0", "regenerator-runtime": "^0.14.0", "requestidlecallback": "^0.3.0", - "rimraf": "^5.0.1", "sass": "^1.62.1", "sass-loader": "^10.2.0", "stacktrace-js": "^2.0.2", @@ -178,7 +176,6 @@ "@types/redux-immutable": "^4.0.3", "@types/requestidlecallback": "^0.3.5", "@types/webpack": "^4.41.33", - "@types/yargs": "^17.0.24", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.17.0", "babel-jest": "^29.5.0", @@ -203,8 +200,7 @@ "stylelint": "^16.0.2", "stylelint-config-standard-scss": "^13.0.0", "typescript": "^5.0.4", - "webpack-dev-server": "^3.11.3", - "yargs": "^17.7.2" + "webpack-dev-server": "^3.11.3" }, "resolutions": { "kind-of": "^6.0.3", diff --git a/yarn.lock b/yarn.lock index 3dc424454..bdd218804 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2394,7 +2394,6 @@ __metadata: "@types/redux-immutable": "npm:^4.0.3" "@types/requestidlecallback": "npm:^0.3.5" "@types/webpack": "npm:^4.41.33" - "@types/yargs": "npm:^17.0.24" "@typescript-eslint/eslint-plugin": "npm:^6.0.0" "@typescript-eslint/parser": "npm:^6.17.0" arrow-key-navigation: "npm:^1.2.0" @@ -2454,7 +2453,6 @@ __metadata: mark-loader: "npm:^0.1.6" marky: "npm:^1.2.5" mini-css-extract-plugin: "npm:^1.6.2" - mkdirp: "npm:^3.0.1" path-complete-extname: "npm:^1.0.0" postcss: "npm:^8.4.24" postcss-loader: "npm:^4.3.0" @@ -2485,7 +2483,6 @@ __metadata: redux-immutable: "npm:^4.0.0" regenerator-runtime: "npm:^0.14.0" requestidlecallback: "npm:^0.3.0" - rimraf: "npm:^5.0.1" sass: "npm:^1.62.1" sass-loader: "npm:^10.2.0" stacktrace-js: "npm:^2.0.2" @@ -2511,7 +2508,6 @@ __metadata: workbox-strategies: "npm:^7.0.0" workbox-webpack-plugin: "npm:^7.0.0" workbox-window: "npm:^7.0.0" - yargs: "npm:^17.7.2" peerDependenciesMeta: react: optional: true @@ -3713,7 +3709,7 @@ __metadata: languageName: node linkType: hard -"@types/yargs@npm:^17.0.24, @types/yargs@npm:^17.0.8": +"@types/yargs@npm:^17.0.8": version: 17.0.32 resolution: "@types/yargs@npm:17.0.32" dependencies: @@ -11662,15 +11658,6 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:^3.0.1": - version: 3.0.1 - resolution: "mkdirp@npm:3.0.1" - bin: - mkdirp: dist/cjs/src/bin.js - checksum: 9f2b975e9246351f5e3a40dcfac99fcd0baa31fbfab615fe059fb11e51f10e4803c63de1f384c54d656e4db31d000e4767e9ef076a22e12a641357602e31d57d - languageName: node - linkType: hard - "mousetrap@npm:^1.5.2": version: 1.6.5 resolution: "mousetrap@npm:1.6.5" @@ -14521,7 +14508,7 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:^5.0.1, rimraf@npm:^5.0.5": +"rimraf@npm:^5.0.5": version: 5.0.5 resolution: "rimraf@npm:5.0.5" dependencies: @@ -17822,7 +17809,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:^17.3.1, yargs@npm:^17.7.2": +"yargs@npm:^17.3.1": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: From d23f445527ecc71dd41b649e578f9139e35b2bb2 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 21 Feb 2024 18:45:06 +0100 Subject: [PATCH 41/43] Automatically switch from open to approved registrations in absence of moderators (#29318) --- app/mailers/admin_mailer.rb | 6 ++ .../auto_close_registrations.text.erb | 3 + .../auto_close_registrations_scheduler.rb | 33 ++++++++++ config/locales/en.yml | 3 + config/sidekiq.yml | 4 ++ ...auto_close_registrations_scheduler_spec.rb | 60 +++++++++++++++++++ 6 files changed, 109 insertions(+) create mode 100644 app/views/admin_mailer/auto_close_registrations.text.erb create mode 100644 app/workers/scheduler/auto_close_registrations_scheduler.rb create mode 100644 spec/workers/scheduler/auto_close_registrations_scheduler_spec.rb diff --git a/app/mailers/admin_mailer.rb b/app/mailers/admin_mailer.rb index 2a6fbb0ab..8990b2a84 100644 --- a/app/mailers/admin_mailer.rb +++ b/app/mailers/admin_mailer.rb @@ -61,6 +61,12 @@ class AdminMailer < ApplicationMailer end end + def auto_close_registrations + locale_for_account(@me) do + mail subject: default_i18n_subject(instance: @instance) + end + end + private def process_params diff --git a/app/views/admin_mailer/auto_close_registrations.text.erb b/app/views/admin_mailer/auto_close_registrations.text.erb new file mode 100644 index 000000000..c0f848692 --- /dev/null +++ b/app/views/admin_mailer/auto_close_registrations.text.erb @@ -0,0 +1,3 @@ +<%= raw t('admin_mailer.auto_close_registrations.body', instance: @instance) %> + +<%= raw t('application_mailer.view')%> <%= admin_settings_registrations_url %> diff --git a/app/workers/scheduler/auto_close_registrations_scheduler.rb b/app/workers/scheduler/auto_close_registrations_scheduler.rb new file mode 100644 index 000000000..17516dd23 --- /dev/null +++ b/app/workers/scheduler/auto_close_registrations_scheduler.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class Scheduler::AutoCloseRegistrationsScheduler + include Sidekiq::Worker + include Redisable + + sidekiq_options retry: 0 + + # Automatically switch away from open registrations if no + # moderator had any activity in that period of time + OPEN_REGISTRATIONS_MODERATOR_THRESHOLD = 1.week + UserTrackingConcern::SIGN_IN_UPDATE_FREQUENCY + + def perform + return if Rails.configuration.x.email_domains_whitelist.present? || ENV['DISABLE_AUTOMATIC_SWITCHING_TO_APPROVED_REGISTRATIONS'] == 'true' + return unless Setting.registrations_mode == 'open' + + switch_to_approval_mode! unless active_moderators? + end + + private + + def active_moderators? + User.those_who_can(:manage_reports).exists?(current_sign_in_at: OPEN_REGISTRATIONS_MODERATOR_THRESHOLD.ago...) + end + + def switch_to_approval_mode! + Setting.registrations_mode = 'approved' + + User.those_who_can(:view_devops).includes(:account).find_each do |user| + AdminMailer.with(recipient: user.account).auto_close_registrations.deliver_later + end + end +end diff --git a/config/locales/en.yml b/config/locales/en.yml index 9d739be07..a7a83391d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -966,6 +966,9 @@ en: title: Webhooks webhook: Webhook admin_mailer: + auto_close_registrations: + body: Due to a lack of recent moderator activity, registrations on %{instance} have been automatically switched to requiring manual review, to prevent %{instance} from being used as a platform for potential bad actors. You can switch it back to open registrations at any time. + subject: Registrations for %{instance} have been automatically switched to requiring approval new_appeal: actions: delete_statuses: to delete their posts diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 3f9cbd9a7..488c2f2ab 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -63,3 +63,7 @@ interval: 30 minutes class: Scheduler::SoftwareUpdateCheckScheduler queue: scheduler + auto_close_registrations_scheduler: + interval: 1 hour + class: Scheduler::AutoCloseRegistrationsScheduler + queue: scheduler diff --git a/spec/workers/scheduler/auto_close_registrations_scheduler_spec.rb b/spec/workers/scheduler/auto_close_registrations_scheduler_spec.rb new file mode 100644 index 000000000..c0c50b128 --- /dev/null +++ b/spec/workers/scheduler/auto_close_registrations_scheduler_spec.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Scheduler::AutoCloseRegistrationsScheduler do + subject { described_class.new } + + describe '#perform' do + let(:moderator_activity_date) { Time.now.utc } + + before do + Fabricate(:user, role: UserRole.find_by(name: 'Owner'), current_sign_in_at: 10.years.ago) + Fabricate(:user, role: UserRole.find_by(name: 'Moderator'), current_sign_in_at: moderator_activity_date) + end + + context 'when registrations are open' do + before do + Setting.registrations_mode = 'open' + end + + context 'when a moderator has logged in recently' do + let(:moderator_activity_date) { Time.now.utc } + + it 'does not change registrations mode' do + expect { subject.perform }.to_not change(Setting, :registrations_mode) + end + end + + context 'when a moderator has not recently signed in' do + let(:moderator_activity_date) { 1.year.ago } + + it 'changes registrations mode from open to approved' do + expect { subject.perform }.to change(Setting, :registrations_mode).from('open').to('approved') + end + end + end + + context 'when registrations are closed' do + before do + Setting.registrations_mode = 'none' + end + + context 'when a moderator has logged in recently' do + let(:moderator_activity_date) { Time.now.utc } + + it 'does not change registrations mode' do + expect { subject.perform }.to_not change(Setting, :registrations_mode) + end + end + + context 'when a moderator has not recently signed in' do + let(:moderator_activity_date) { 1.year.ago } + + it 'does not change registrations mode' do + expect { subject.perform }.to_not change(Setting, :registrations_mode) + end + end + end + end +end From b0822ae9cdad0405ade823b5b19de1e1da0e75be Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 22 Feb 2024 15:52:14 +0100 Subject: [PATCH 42/43] Fix auto-close email being sent to users with devops permissions instead of settings permissions (#29355) --- app/workers/scheduler/auto_close_registrations_scheduler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/scheduler/auto_close_registrations_scheduler.rb b/app/workers/scheduler/auto_close_registrations_scheduler.rb index 17516dd23..687450291 100644 --- a/app/workers/scheduler/auto_close_registrations_scheduler.rb +++ b/app/workers/scheduler/auto_close_registrations_scheduler.rb @@ -26,7 +26,7 @@ class Scheduler::AutoCloseRegistrationsScheduler def switch_to_approval_mode! Setting.registrations_mode = 'approved' - User.those_who_can(:view_devops).includes(:account).find_each do |user| + User.those_who_can(:manage_settings).includes(:account).find_each do |user| AdminMailer.with(recipient: user.account).auto_close_registrations.deliver_later end end From f25414014a68deae1c05d7e22ecebd69215b8755 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 22 Feb 2024 18:31:50 +0100 Subject: [PATCH 43/43] Fix link verifications when page size exceeds 1MB (#29358) --- app/services/verify_link_service.rb | 2 +- spec/services/verify_link_service_spec.rb | 27 ++++++++++++----------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/services/verify_link_service.rb b/app/services/verify_link_service.rb index 707aeb4e0..b317fc31a 100644 --- a/app/services/verify_link_service.rb +++ b/app/services/verify_link_service.rb @@ -19,7 +19,7 @@ class VerifyLinkService < BaseService def perform_request! @body = Request.new(:get, @url).add_headers('Accept' => 'text/html').perform do |res| - res.code == 200 ? res.body_with_limit : nil + res.code == 200 ? res.truncated_body : nil end end diff --git a/spec/services/verify_link_service_spec.rb b/spec/services/verify_link_service_spec.rb index 415788cb5..d06344f9c 100644 --- a/spec/services/verify_link_service_spec.rb +++ b/spec/services/verify_link_service_spec.rb @@ -76,6 +76,20 @@ RSpec.describe VerifyLinkService, type: :service do end context 'when a document is truncated but the link back is valid' do + let(:html) do + " + + + + " + end + + it 'marks the field as verified' do + expect(field.verified?).to be true + end + end + + context 'when a link tag might be truncated' do let(:html) do " @@ -89,19 +103,6 @@ RSpec.describe VerifyLinkService, type: :service do end end - context 'when a link back might be truncated' do - let(:html) do - " - - -