From 5ba4275f73a13eebc7d055feeb58b82e05b65cc8 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 9 May 2022 17:39:38 -0500 Subject: [PATCH 1/8] Stop doing Tabler import hack, use our forked version from git --- package.json | 2 +- webpack/shared.js | 3 --- yarn.lock | 7 +++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 5d19be83b..4e3608b97 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "@sentry/browser": "^6.12.0", "@sentry/react": "^6.12.0", "@sentry/tracing": "^6.12.0", - "@tabler/icons": "^1.53.0", + "@tabler/icons": "https://gitlab.com/soapbox-pub/tabler-icons.git", "@tailwindcss/forms": "^0.4.0", "@tailwindcss/typography": "^0.5.1", "@testing-library/react": "^12.1.4", diff --git a/webpack/shared.js b/webpack/shared.js index 9dee79de1..fb8308ee4 100644 --- a/webpack/shared.js +++ b/webpack/shared.js @@ -145,9 +145,6 @@ module.exports = { 'node_modules', ], alias: { - // Override tabler's package.json to allow importing .svg files directly - // https://stackoverflow.com/a/35990101/8811886 - '@tabler': resolve('node_modules', '@tabler'), 'icons': resolve('app', 'icons'), 'custom': resolve('custom'), }, diff --git a/yarn.lock b/yarn.lock index 9445a64a8..cb9d3fb3f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1883,10 +1883,9 @@ remark "^13.0.0" unist-util-find-all-after "^3.0.2" -"@tabler/icons@^1.53.0": - version "1.53.0" - resolved "https://registry.yarnpkg.com/@tabler/icons/-/icons-1.53.0.tgz#51536e01b343cfaf26b701df306b2c0369769e3c" - integrity sha512-Skk1BqXEOEhiRsXJgZBYtjFa/+4dMSFA5UyzTUW20oyyUSd3iizhEWrYt0jT87iFu771gWoqVV2/OGobBcGjgQ== +"@tabler/icons@https://gitlab.com/soapbox-pub/tabler-icons.git": + version "1.68.0" + resolved "https://gitlab.com/soapbox-pub/tabler-icons.git#20e43498bdc0f38f75f176ef1a6526ca76c9172e" "@tailwindcss/forms@^0.4.0": version "0.4.0" From 660c098166ca2253a56a28f8432b1ae28a47f42f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 9 May 2022 17:57:15 -0500 Subject: [PATCH 2/8] Allow custom module imports --- custom/modules/.gitkeep | 0 webpack/rules/assets.js | 5 ++++- webpack/shared.js | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 custom/modules/.gitkeep diff --git a/custom/modules/.gitkeep b/custom/modules/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/webpack/rules/assets.js b/webpack/rules/assets.js index 1b291ae0c..e0a14c250 100644 --- a/webpack/rules/assets.js +++ b/webpack/rules/assets.js @@ -66,7 +66,10 @@ module.exports = [{ }, { test: /\.svg$/, type: 'asset/resource', - include: resolve('node_modules', '@tabler'), + include: [ + resolve('node_modules', '@tabler'), + resolve('custom', 'modules', '@tabler'), + ], generator: { filename: 'packs/icons/[name]-[contenthash:8][ext]', }, diff --git a/webpack/shared.js b/webpack/shared.js index fb8308ee4..326981b8b 100644 --- a/webpack/shared.js +++ b/webpack/shared.js @@ -141,6 +141,7 @@ module.exports = { resolve: { extensions: settings.extensions, modules: [ + resolve('custom', 'modules'), resolve(settings.source_path), 'node_modules', ], From f751104c0f48641bd139a0edbc0aa016ea61f50a Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 13 Aug 2022 10:16:13 -0500 Subject: [PATCH 3/8] StatusActionBar: hide DM menu item unless privacyScopes are enabled --- app/soapbox/components/status-action-bar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/soapbox/components/status-action-bar.tsx b/app/soapbox/components/status-action-bar.tsx index 0e6786fb6..64ac67406 100644 --- a/app/soapbox/components/status-action-bar.tsx +++ b/app/soapbox/components/status-action-bar.tsx @@ -444,7 +444,7 @@ const StatusActionBar: React.FC = ({ action: handleChatClick, icon: require('@tabler/icons/messages.svg'), }); - } else { + } else if (features.privacyScopes) { menu.push({ text: intl.formatMessage(messages.direct, { name: username }), action: handleDirectClick, From 19b697366746753ba186ce76a2ef66fe80db1520 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 13 Aug 2022 10:27:12 -0500 Subject: [PATCH 4/8] Notifications: StatusContainer --> Status, fix not being able to mute a conversation --- app/soapbox/components/status.tsx | 4 +++- app/soapbox/containers/status_container.tsx | 15 ++++++++++----- .../notifications/components/notification.tsx | 16 ++++++---------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/soapbox/components/status.tsx b/app/soapbox/components/status.tsx index 37cf7a24b..04f42a546 100644 --- a/app/soapbox/components/status.tsx +++ b/app/soapbox/components/status.tsx @@ -47,6 +47,7 @@ export interface IStatus { featured?: boolean, hideActionBar?: boolean, hoverable?: boolean, + withDismiss?: boolean, } const Status: React.FC = (props) => { @@ -63,6 +64,7 @@ const Status: React.FC = (props) => { unread, group, hideActionBar, + withDismiss, } = props; const intl = useIntl(); const history = useHistory(); @@ -374,7 +376,7 @@ const Status: React.FC = (props) => { {!hideActionBar && (
- +
)} diff --git a/app/soapbox/containers/status_container.tsx b/app/soapbox/containers/status_container.tsx index c6196638a..985251c65 100644 --- a/app/soapbox/containers/status_container.tsx +++ b/app/soapbox/containers/status_container.tsx @@ -4,15 +4,13 @@ import Status, { IStatus } from 'soapbox/components/status'; import { useAppSelector } from 'soapbox/hooks'; import { makeGetStatus } from 'soapbox/selectors'; -interface IStatusContainer extends Omit { +interface IStatusContainer extends Omit { id: string, /** @deprecated Unused. */ contextType?: any, /** @deprecated Unused. */ otherAccounts?: any, /** @deprecated Unused. */ - withDismiss?: any, - /** @deprecated Unused. */ getScrollPosition?: any, /** @deprecated Unused. */ updateScrollBottom?: any, @@ -24,11 +22,18 @@ const getStatus = makeGetStatus(); * Legacy Status wrapper accepting a status ID instead of the full entity. * @deprecated Use the Status component directly. */ -const StatusContainer: React.FC = ({ id, onMoveUp, onMoveDown }) => { +const StatusContainer: React.FC = ({ id, onMoveUp, onMoveDown, withDismiss }) => { const status = useAppSelector(state => getStatus(state, { id })); if (status) { - return ; + return ( + + ); } else { return null; } diff --git a/app/soapbox/features/notifications/components/notification.tsx b/app/soapbox/features/notifications/components/notification.tsx index cbf67c4dd..aa428c24c 100644 --- a/app/soapbox/features/notifications/components/notification.tsx +++ b/app/soapbox/features/notifications/components/notification.tsx @@ -10,15 +10,15 @@ import { getSettings } from 'soapbox/actions/settings'; import { hideStatus, revealStatus } from 'soapbox/actions/statuses'; import Icon from 'soapbox/components/icon'; import Permalink from 'soapbox/components/permalink'; +import Status from 'soapbox/components/status'; import { HStack, Text, Emoji } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account_container'; -import StatusContainer from 'soapbox/containers/status_container'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import { makeGetNotification } from 'soapbox/selectors'; import { NotificationType, validType } from 'soapbox/utils/notification'; import type { ScrollPosition } from 'soapbox/components/status'; -import type { Account, Status, Notification as NotificationEntity } from 'soapbox/types/entities'; +import type { Account, Status as StatusEntity, Notification as NotificationEntity } from 'soapbox/types/entities'; const getNotification = makeGetNotification(); @@ -143,7 +143,7 @@ interface INotificaton { notification: NotificationEntity, onMoveUp?: (notificationId: string) => void, onMoveDown?: (notificationId: string) => void, - onReblog?: (status: Status, e?: KeyboardEvent) => void, + onReblog?: (status: StatusEntity, e?: KeyboardEvent) => void, getScrollPosition?: () => ScrollPosition | undefined, updateScrollBottom?: (bottom: number) => void, } @@ -216,7 +216,7 @@ const Notification: React.FC = (props) => { if (e?.shiftKey || !boostModal) { dispatch(reblog(status)); } else { - dispatch(openModal('BOOST', { status, onReblog: (status: Status) => { + dispatch(openModal('BOOST', { status, onReblog: (status: StatusEntity) => { dispatch(reblog(status)); } })); } @@ -303,16 +303,12 @@ const Notification: React.FC = (props) => { case 'update': case 'pleroma:emoji_reaction': return status && typeof status === 'object' ? ( - // @ts-ignore -