diff --git a/packages/pl-fe/src/actions/compose.ts b/packages/pl-fe/src/actions/compose.ts index 12d016258..d5fc0e3d2 100644 --- a/packages/pl-fe/src/actions/compose.ts +++ b/packages/pl-fe/src/actions/compose.ts @@ -428,7 +428,7 @@ const submitCompose = (composeId: string, opts: SubmitComposeOpts = {}) => const poll = params.poll; if (poll?.options_map) { - poll.options.forEach((option: any, index: number) => poll.options_map![index][compose.language!] = option); + poll.options.forEach((option, index: number) => poll.options_map![index][compose.language!] = option); } } @@ -491,7 +491,7 @@ const uploadCompose = (composeId: string, files: FileList, intl: IntlShape) => intl, (data) => dispatch(uploadComposeSuccess(composeId, data, f)), (error) => dispatch(uploadComposeFail(composeId, error)), - ({ loaded }: any) => { + ({ loaded }) => { progress[i] = loaded; dispatch(uploadComposeProgress(composeId, progress.reduce((a, v) => a + v, 0), total)); }, diff --git a/packages/pl-fe/src/actions/export-data.ts b/packages/pl-fe/src/actions/export-data.ts index f360ae167..2c26861cd 100644 --- a/packages/pl-fe/src/actions/export-data.ts +++ b/packages/pl-fe/src/actions/export-data.ts @@ -57,7 +57,7 @@ const listAccounts = async (response: PaginatedResponse) => { Array.prototype.push.apply(followings, response.items); } - accounts = followings.map((account: any) => normalizeAccount(account).fqn); + accounts = followings.map((account) => normalizeAccount(account).fqn); return Array.from(new Set(accounts)); }; diff --git a/packages/pl-fe/src/components/account.tsx b/packages/pl-fe/src/components/account.tsx index 0234012c0..dc7d6cdd0 100644 --- a/packages/pl-fe/src/components/account.tsx +++ b/packages/pl-fe/src/components/account.tsx @@ -81,7 +81,7 @@ interface IAccount { hidden?: boolean; hideActions?: boolean; id?: string; - onActionClick?: (account: any) => void; + onActionClick?: (account: AccountSchema) => void; showAccountHoverCard?: boolean; timestamp?: string; timestampUrl?: string; diff --git a/packages/pl-fe/src/components/announcements/emoji.tsx b/packages/pl-fe/src/components/announcements/emoji.tsx index 39b0d567c..15d204e03 100644 --- a/packages/pl-fe/src/components/announcements/emoji.tsx +++ b/packages/pl-fe/src/components/announcements/emoji.tsx @@ -31,7 +31,7 @@ const Emoji: React.FC = ({ emoji, emojiMap, hovered }) => { src={joinPublicPath(`packs/emoji/${filename}.svg`)} /> ); - } else if (emojiMap.get(emoji as any)) { + } else if (emojiMap.get(emoji)) { const filename = (autoPlayGif || hovered) ? emojiMap.getIn([emoji, 'url']) : emojiMap.getIn([emoji, 'static_url']); const shortCode = `:${emoji}:`; diff --git a/packages/pl-fe/src/components/hover-status-wrapper.tsx b/packages/pl-fe/src/components/hover-status-wrapper.tsx index b7dc7235d..77cfc548f 100644 --- a/packages/pl-fe/src/components/hover-status-wrapper.tsx +++ b/packages/pl-fe/src/components/hover-status-wrapper.tsx @@ -10,7 +10,7 @@ const showStatusHoverCard = debounce((openStatusHoverCard, ref, statusId) => { }, 300); interface IHoverStatusWrapper { - statusId: any; + statusId: string; inline: boolean; className?: string; children: React.ReactNode; diff --git a/packages/pl-fe/src/components/status-action-bar.tsx b/packages/pl-fe/src/components/status-action-bar.tsx index ced526f48..4a4aea1e3 100644 --- a/packages/pl-fe/src/components/status-action-bar.tsx +++ b/packages/pl-fe/src/components/status-action-bar.tsx @@ -664,6 +664,18 @@ const StatusActionBar: React.FC = ({ replyTitle = intl.formatMessage(messages.replies_disabled_group); } + const replyButton = ( + + ); + const reblogMenu = [{ text: intl.formatMessage(status.reblogged ? messages.cancel_reblog_private : messages.reblog), action: handleReblogClick, @@ -714,20 +726,14 @@ const StatusActionBar: React.FC = ({ onClick={e => e.stopPropagation()} alignItems='center' > - - - + {status.group ? ( + + {replyButton} + + ) : replyButton} {(features.quotePosts && me) ? ( = ({ status, hoverable accounts: , // @ts-ignore wtf? hover: (children: React.ReactNode) => { - if (hoverable) { + if (hoverable && status.in_reply_to_id) { return ( { return tokens; }; -const emojify = (str: string, customEmojis = {}) => +const emojify = (str: string, customEmojis: Record = {}) => parseHTML(str) .map(({ text, data }) => { if (!text) return data; diff --git a/packages/pl-fe/src/normalizers/poll.ts b/packages/pl-fe/src/normalizers/poll.ts index 395d9e574..e7f10488f 100644 --- a/packages/pl-fe/src/normalizers/poll.ts +++ b/packages/pl-fe/src/normalizers/poll.ts @@ -1,11 +1,13 @@ import escapeTextContentForBrowser from 'escape-html'; import DOMPurify from 'isomorphic-dompurify'; -import { Status as BaseStatus, StatusEdit as BaseStatusEdit, CustomEmoji } from 'pl-api'; + import emojify from 'pl-fe/features/emoji'; import { makeEmojiMap } from 'pl-fe/utils/normalizers'; -const sanitizeTitle = (text: string, emojiMap: any) => DOMPurify.sanitize(emojify(escapeTextContentForBrowser(text), emojiMap), { ALLOWED_TAGS: ['img'] }); +import type { Status as BaseStatus, StatusEdit as BaseStatusEdit, CustomEmoji } from 'pl-api'; + +const sanitizeTitle = (text: string, emojiMap: Record) => DOMPurify.sanitize(emojify(escapeTextContentForBrowser(text), emojiMap), { ALLOWED_TAGS: ['img'] }); const normalizePoll = (poll: Exclude) => { const emojiMap = makeEmojiMap(poll.emojis); diff --git a/packages/pl-fe/src/normalizers/status.ts b/packages/pl-fe/src/normalizers/status.ts index 0548f27c3..18cc8359a 100644 --- a/packages/pl-fe/src/normalizers/status.ts +++ b/packages/pl-fe/src/normalizers/status.ts @@ -5,7 +5,7 @@ */ import escapeTextContentForBrowser from 'escape-html'; import DOMPurify from 'isomorphic-dompurify'; -import { type Account as BaseAccount, type Status as BaseStatus, type MediaAttachment, mentionSchema, type Translation } from 'pl-api'; +import { type Account as BaseAccount, type Status as BaseStatus, type CustomEmoji, type MediaAttachment, mentionSchema, type Translation } from 'pl-api'; import emojify from 'pl-fe/features/emoji'; import { unescapeHTML } from 'pl-fe/utils/html'; @@ -62,8 +62,8 @@ const buildSearchContent = (status: Pick emojify(text, emojiMap); -const calculateSpoiler = (text: string, emojiMap: any) => DOMPurify.sanitize(emojify(escapeTextContentForBrowser(text), emojiMap), { USE_PROFILES: { html: true } }); +const calculateContent = (text: string, emojiMap: Record) => emojify(text, emojiMap); +const calculateSpoiler = (text: string, emojiMap: Record) => DOMPurify.sanitize(emojify(escapeTextContentForBrowser(text), emojiMap), { USE_PROFILES: { html: true } }); const calculateStatus = (status: BaseStatus, oldStatus?: OldStatus): CalculatedValues => { if (oldStatus && oldStatus.content === status.content && oldStatus.spoiler_text === status.spoiler_text) {