diff --git a/packages/pl-fe/src/actions/compose.ts b/packages/pl-fe/src/actions/compose.ts index 179610bcb..142f98dc1 100644 --- a/packages/pl-fe/src/actions/compose.ts +++ b/packages/pl-fe/src/actions/compose.ts @@ -8,7 +8,6 @@ import { Language } from 'pl-fe/features/preferences'; import { queryClient } from 'pl-fe/queries/client'; import { cancelDraftStatus } from 'pl-fe/queries/statuses/use-draft-statuses'; import { selectAccount, selectOwnAccount } from 'pl-fe/selectors'; -import { tagHistory } from 'pl-fe/settings'; import { useModalsStore } from 'pl-fe/stores/modals'; import { useSettingsStore } from 'pl-fe/stores/settings'; import toast from 'pl-fe/toast'; @@ -57,8 +56,6 @@ const COMPOSE_SUGGESTIONS_READY = 'COMPOSE_SUGGESTIONS_READY' as const; const COMPOSE_SUGGESTION_SELECT = 'COMPOSE_SUGGESTION_SELECT' as const; const COMPOSE_SUGGESTION_TAGS_UPDATE = 'COMPOSE_SUGGESTION_TAGS_UPDATE' as const; -const COMPOSE_TAG_HISTORY_UPDATE = 'COMPOSE_TAG_HISTORY_UPDATE' as const; - const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE' as const; const COMPOSE_TYPE_CHANGE = 'COMPOSE_TYPE_CHANGE' as const; const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE' as const; @@ -310,7 +307,6 @@ const handleComposeSubmit = (dispatch: AppDispatch, getState: () => RootState, c } if (data.scheduled_at === null) { - dispatch(insertIntoTagHistory(composeId, data.tags || [], status)); toast.success(redact ? messages.redactSuccess : edit ? messages.editSuccess : messages.success, { actionLabel: messages.view, actionLink: (data.visibility === 'direct' && getClient(getState()).features.conversations) ? '/conversations' : `/@${data.account.acct}/posts/${data.id}`, @@ -748,30 +744,6 @@ const updateSuggestionTags = (composeId: string, token: string, tags: Array tags, }); -const updateTagHistory = (composeId: string, tags: string[]) => ({ - type: COMPOSE_TAG_HISTORY_UPDATE, - composeId, - tags, -}); - -const insertIntoTagHistory = (composeId: string, recognizedTags: Array, text: string) => - (dispatch: AppDispatch, getState: () => RootState) => { - const state = getState(); - const oldHistory = state.compose[composeId]!.tagHistory; - const me = state.me; - const names = recognizedTags - .filter(tag => text.match(new RegExp(`#${tag.name}`, 'i'))) - .map(tag => tag.name); - const intersectedOldHistory = oldHistory.filter(name => names.findIndex(newName => newName.toLowerCase() === name.toLowerCase()) === -1); - - names.push(...intersectedOldHistory); - - const newHistory = names.slice(0, 1000); - - tagHistory.set(me as string, newHistory); - dispatch(updateTagHistory(composeId, newHistory)); - }; - const changeComposeSpoilerness = (composeId: string) => ({ type: COMPOSE_SPOILERNESS_CHANGE, composeId, @@ -1036,7 +1008,6 @@ type ComposeAction = | ComposeSuggestionsReadyAction | ComposeSuggestionSelectAction | ReturnType - | ReturnType | ReturnType | ReturnType | ReturnType @@ -1094,7 +1065,6 @@ export { COMPOSE_SUGGESTIONS_READY, COMPOSE_SUGGESTION_SELECT, COMPOSE_SUGGESTION_TAGS_UPDATE, - COMPOSE_TAG_HISTORY_UPDATE, COMPOSE_SPOILERNESS_CHANGE, COMPOSE_TYPE_CHANGE, COMPOSE_SPOILER_TEXT_CHANGE, diff --git a/packages/pl-fe/src/reducers/compose.ts b/packages/pl-fe/src/reducers/compose.ts index 5f3f8f0e0..06322f527 100644 --- a/packages/pl-fe/src/reducers/compose.ts +++ b/packages/pl-fe/src/reducers/compose.ts @@ -1,7 +1,6 @@ import { create } from 'mutative'; import { INSTANCE_FETCH_SUCCESS, type InstanceAction } from 'pl-fe/actions/instance'; -import { tagHistory } from 'pl-fe/settings'; import { COMPOSE_CHANGE, @@ -24,7 +23,6 @@ import { COMPOSE_SUGGESTIONS_READY, COMPOSE_SUGGESTION_SELECT, COMPOSE_SUGGESTION_TAGS_UPDATE, - COMPOSE_TAG_HISTORY_UPDATE, COMPOSE_SPOILERNESS_CHANGE, COMPOSE_TYPE_CHANGE, COMPOSE_SPOILER_TEXT_CHANGE, @@ -151,7 +149,6 @@ interface Compose { approvalRequired: boolean; suggestedLanguage: string | null; suggestions: Array | Array; - tagHistory: Array; dismissedClearLinksSuggestions: Array; clearLinkSuggestion: ClearLinkSuggestion | null; preview: Partial | null; @@ -188,7 +185,6 @@ const newCompose = (params: Partial = {}): Compose => ({ spoilerText: '', spoilerTextMap: {}, suggestions: [], - tagHistory: [], text: '', textMap: {}, to: [], @@ -321,7 +317,6 @@ const importAccount = (compose: Compose, account: CredentialAccount) => { if (settings.defaultPrivacy) compose.visibility = settings.defaultPrivacy; if (settings.defaultContentType) compose.contentType = settings.defaultContentType; - compose.tagHistory = tagHistory.get(account.id) || []; }; // const updateSetting = (compose: Compose, path: string[], value: string) => { @@ -528,10 +523,6 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In return updateCompose(state, action.composeId, compose => insertSuggestion(compose, action.position, action.token, action.completion, action.path)); case COMPOSE_SUGGESTION_TAGS_UPDATE: return updateCompose(state, action.composeId, compose => updateSuggestionTags(compose, action.token, action.tags)); - case COMPOSE_TAG_HISTORY_UPDATE: - return updateCompose(state, action.composeId, compose => { - compose.tagHistory = action.tags; - }); case TIMELINE_DELETE: return updateCompose(state, 'compose-modal', compose => { if (action.statusId === compose.inReplyToId) { diff --git a/packages/pl-fe/src/settings.ts b/packages/pl-fe/src/settings.ts index 0ff2b2bc7..64c9040f7 100644 --- a/packages/pl-fe/src/settings.ts +++ b/packages/pl-fe/src/settings.ts @@ -49,10 +49,6 @@ class Settings { /** Remember push notification settings. */ const pushNotificationsSetting = new Settings('plfe_push_notification_data'); -/** Remember hashtag usage. */ -const tagHistory = new Settings('plfe_tag_history'); - export { pushNotificationsSetting, - tagHistory, };