[build] upgrade eslint to 9.37.0 (#88)

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/88
Co-authored-by: Zoë Bijl <moiety@noreply.codeberg.org>
Co-committed-by: Zoë Bijl <moiety@noreply.codeberg.org>
This commit is contained in:
Zoë Bijl
2025-10-12 13:42:02 +02:00
committed by tobi
parent 75d7a62693
commit 1ff70886a1
975 changed files with 22196 additions and 21964 deletions

View File

@@ -1,99 +1,99 @@
import { defineMessages } from 'react-intl';
import { defineMessages } from "react-intl";
import axios from 'axios';
import { throttle } from 'lodash';
import axios from "axios";
import { throttle } from "lodash";
import api from 'flavours/glitch/api';
import { search as emojiSearch } from 'flavours/glitch/features/emoji/emoji_mart_search_light';
import { maxMediaAttachments } from 'flavours/glitch/initial_state';
import { tagHistory } from 'flavours/glitch/settings';
import { recoverHashtags } from 'flavours/glitch/utils/hashtag';
import resizeImage from 'flavours/glitch/utils/resize_image';
import api from "flavours/glitch/api";
import { search as emojiSearch } from "flavours/glitch/features/emoji/emoji_mart_search_light";
import { maxMediaAttachments } from "flavours/glitch/initial_state";
import { tagHistory } from "flavours/glitch/settings";
import { recoverHashtags } from "flavours/glitch/utils/hashtag";
import resizeImage from "flavours/glitch/utils/resize_image";
import { showAlert, showAlertForError } from './alerts';
import { useEmoji } from './emojis';
import { importFetchedAccounts, importFetchedStatus } from './importer';
import { openModal } from './modal';
import { updateTimeline } from './timelines';
import { showAlert, showAlertForError } from "./alerts";
import { useEmoji } from "./emojis";
import { importFetchedAccounts, importFetchedStatus } from "./importer";
import { openModal } from "./modal";
import { updateTimeline } from "./timelines";
/** @type {AbortController | undefined} */
let fetchComposeSuggestionsAccountsController;
/** @type {AbortController | undefined} */
let fetchComposeSuggestionsTagsController;
export const COMPOSE_CHANGE = 'COMPOSE_CHANGE';
export const COMPOSE_CYCLE_ELEFRIEND = 'COMPOSE_CYCLE_ELEFRIEND';
export const COMPOSE_SUBMIT_REQUEST = 'COMPOSE_SUBMIT_REQUEST';
export const COMPOSE_SUBMIT_SUCCESS = 'COMPOSE_SUBMIT_SUCCESS';
export const COMPOSE_SUBMIT_FAIL = 'COMPOSE_SUBMIT_FAIL';
export const COMPOSE_REPLY = 'COMPOSE_REPLY';
export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL';
export const COMPOSE_DIRECT = 'COMPOSE_DIRECT';
export const COMPOSE_MENTION = 'COMPOSE_MENTION';
export const COMPOSE_RESET = 'COMPOSE_RESET';
export const COMPOSE_CHANGE = "COMPOSE_CHANGE";
export const COMPOSE_CYCLE_ELEFRIEND = "COMPOSE_CYCLE_ELEFRIEND";
export const COMPOSE_SUBMIT_REQUEST = "COMPOSE_SUBMIT_REQUEST";
export const COMPOSE_SUBMIT_SUCCESS = "COMPOSE_SUBMIT_SUCCESS";
export const COMPOSE_SUBMIT_FAIL = "COMPOSE_SUBMIT_FAIL";
export const COMPOSE_REPLY = "COMPOSE_REPLY";
export const COMPOSE_REPLY_CANCEL = "COMPOSE_REPLY_CANCEL";
export const COMPOSE_DIRECT = "COMPOSE_DIRECT";
export const COMPOSE_MENTION = "COMPOSE_MENTION";
export const COMPOSE_RESET = "COMPOSE_RESET";
export const COMPOSE_UPLOAD_REQUEST = 'COMPOSE_UPLOAD_REQUEST';
export const COMPOSE_UPLOAD_SUCCESS = 'COMPOSE_UPLOAD_SUCCESS';
export const COMPOSE_UPLOAD_FAIL = 'COMPOSE_UPLOAD_FAIL';
export const COMPOSE_UPLOAD_PROGRESS = 'COMPOSE_UPLOAD_PROGRESS';
export const COMPOSE_UPLOAD_PROCESSING = 'COMPOSE_UPLOAD_PROCESSING';
export const COMPOSE_UPLOAD_UNDO = 'COMPOSE_UPLOAD_UNDO';
export const COMPOSE_UPLOAD_REQUEST = "COMPOSE_UPLOAD_REQUEST";
export const COMPOSE_UPLOAD_SUCCESS = "COMPOSE_UPLOAD_SUCCESS";
export const COMPOSE_UPLOAD_FAIL = "COMPOSE_UPLOAD_FAIL";
export const COMPOSE_UPLOAD_PROGRESS = "COMPOSE_UPLOAD_PROGRESS";
export const COMPOSE_UPLOAD_PROCESSING = "COMPOSE_UPLOAD_PROCESSING";
export const COMPOSE_UPLOAD_UNDO = "COMPOSE_UPLOAD_UNDO";
export const THUMBNAIL_UPLOAD_REQUEST = 'THUMBNAIL_UPLOAD_REQUEST';
export const THUMBNAIL_UPLOAD_SUCCESS = 'THUMBNAIL_UPLOAD_SUCCESS';
export const THUMBNAIL_UPLOAD_FAIL = 'THUMBNAIL_UPLOAD_FAIL';
export const THUMBNAIL_UPLOAD_PROGRESS = 'THUMBNAIL_UPLOAD_PROGRESS';
export const THUMBNAIL_UPLOAD_REQUEST = "THUMBNAIL_UPLOAD_REQUEST";
export const THUMBNAIL_UPLOAD_SUCCESS = "THUMBNAIL_UPLOAD_SUCCESS";
export const THUMBNAIL_UPLOAD_FAIL = "THUMBNAIL_UPLOAD_FAIL";
export const THUMBNAIL_UPLOAD_PROGRESS = "THUMBNAIL_UPLOAD_PROGRESS";
export const COMPOSE_SUGGESTIONS_CLEAR = 'COMPOSE_SUGGESTIONS_CLEAR';
export const COMPOSE_SUGGESTIONS_READY = 'COMPOSE_SUGGESTIONS_READY';
export const COMPOSE_SUGGESTION_SELECT = 'COMPOSE_SUGGESTION_SELECT';
export const COMPOSE_SUGGESTION_IGNORE = 'COMPOSE_SUGGESTION_IGNORE';
export const COMPOSE_SUGGESTION_TAGS_UPDATE = 'COMPOSE_SUGGESTION_TAGS_UPDATE';
export const COMPOSE_SUGGESTIONS_CLEAR = "COMPOSE_SUGGESTIONS_CLEAR";
export const COMPOSE_SUGGESTIONS_READY = "COMPOSE_SUGGESTIONS_READY";
export const COMPOSE_SUGGESTION_SELECT = "COMPOSE_SUGGESTION_SELECT";
export const COMPOSE_SUGGESTION_IGNORE = "COMPOSE_SUGGESTION_IGNORE";
export const COMPOSE_SUGGESTION_TAGS_UPDATE = "COMPOSE_SUGGESTION_TAGS_UPDATE";
export const COMPOSE_TAG_HISTORY_UPDATE = 'COMPOSE_TAG_HISTORY_UPDATE';
export const COMPOSE_TAG_HISTORY_UPDATE = "COMPOSE_TAG_HISTORY_UPDATE";
export const COMPOSE_MOUNT = 'COMPOSE_MOUNT';
export const COMPOSE_UNMOUNT = 'COMPOSE_UNMOUNT';
export const COMPOSE_MOUNT = "COMPOSE_MOUNT";
export const COMPOSE_UNMOUNT = "COMPOSE_UNMOUNT";
export const COMPOSE_ADVANCED_OPTIONS_CHANGE = 'COMPOSE_ADVANCED_OPTIONS_CHANGE';
export const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE';
export const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE';
export const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE';
export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE';
export const COMPOSE_LISTABILITY_CHANGE = 'COMPOSE_LISTABILITY_CHANGE';
export const COMPOSE_CONTENT_TYPE_CHANGE = 'COMPOSE_CONTENT_TYPE_CHANGE';
export const COMPOSE_LANGUAGE_CHANGE = 'COMPOSE_LANGUAGE_CHANGE';
export const COMPOSE_ADVANCED_OPTIONS_CHANGE = "COMPOSE_ADVANCED_OPTIONS_CHANGE";
export const COMPOSE_SENSITIVITY_CHANGE = "COMPOSE_SENSITIVITY_CHANGE";
export const COMPOSE_SPOILERNESS_CHANGE = "COMPOSE_SPOILERNESS_CHANGE";
export const COMPOSE_SPOILER_TEXT_CHANGE = "COMPOSE_SPOILER_TEXT_CHANGE";
export const COMPOSE_VISIBILITY_CHANGE = "COMPOSE_VISIBILITY_CHANGE";
export const COMPOSE_LISTABILITY_CHANGE = "COMPOSE_LISTABILITY_CHANGE";
export const COMPOSE_CONTENT_TYPE_CHANGE = "COMPOSE_CONTENT_TYPE_CHANGE";
export const COMPOSE_LANGUAGE_CHANGE = "COMPOSE_LANGUAGE_CHANGE";
export const COMPOSE_EMOJI_INSERT = 'COMPOSE_EMOJI_INSERT';
export const COMPOSE_EMOJI_INSERT = "COMPOSE_EMOJI_INSERT";
export const COMPOSE_UPLOAD_CHANGE_REQUEST = 'COMPOSE_UPLOAD_UPDATE_REQUEST';
export const COMPOSE_UPLOAD_CHANGE_SUCCESS = 'COMPOSE_UPLOAD_UPDATE_SUCCESS';
export const COMPOSE_UPLOAD_CHANGE_FAIL = 'COMPOSE_UPLOAD_UPDATE_FAIL';
export const COMPOSE_UPLOAD_CHANGE_REQUEST = "COMPOSE_UPLOAD_UPDATE_REQUEST";
export const COMPOSE_UPLOAD_CHANGE_SUCCESS = "COMPOSE_UPLOAD_UPDATE_SUCCESS";
export const COMPOSE_UPLOAD_CHANGE_FAIL = "COMPOSE_UPLOAD_UPDATE_FAIL";
export const COMPOSE_DOODLE_SET = 'COMPOSE_DOODLE_SET';
export const COMPOSE_DOODLE_SET = "COMPOSE_DOODLE_SET";
export const COMPOSE_POLL_ADD = 'COMPOSE_POLL_ADD';
export const COMPOSE_POLL_REMOVE = 'COMPOSE_POLL_REMOVE';
export const COMPOSE_POLL_OPTION_ADD = 'COMPOSE_POLL_OPTION_ADD';
export const COMPOSE_POLL_OPTION_CHANGE = 'COMPOSE_POLL_OPTION_CHANGE';
export const COMPOSE_POLL_OPTION_REMOVE = 'COMPOSE_POLL_OPTION_REMOVE';
export const COMPOSE_POLL_SETTINGS_CHANGE = 'COMPOSE_POLL_SETTINGS_CHANGE';
export const COMPOSE_POLL_ADD = "COMPOSE_POLL_ADD";
export const COMPOSE_POLL_REMOVE = "COMPOSE_POLL_REMOVE";
export const COMPOSE_POLL_OPTION_ADD = "COMPOSE_POLL_OPTION_ADD";
export const COMPOSE_POLL_OPTION_CHANGE = "COMPOSE_POLL_OPTION_CHANGE";
export const COMPOSE_POLL_OPTION_REMOVE = "COMPOSE_POLL_OPTION_REMOVE";
export const COMPOSE_POLL_SETTINGS_CHANGE = "COMPOSE_POLL_SETTINGS_CHANGE";
export const INIT_MEDIA_EDIT_MODAL = 'INIT_MEDIA_EDIT_MODAL';
export const INIT_MEDIA_EDIT_MODAL = "INIT_MEDIA_EDIT_MODAL";
export const COMPOSE_CHANGE_MEDIA_DESCRIPTION = 'COMPOSE_CHANGE_MEDIA_DESCRIPTION';
export const COMPOSE_CHANGE_MEDIA_FOCUS = 'COMPOSE_CHANGE_MEDIA_FOCUS';
export const COMPOSE_CHANGE_MEDIA_DESCRIPTION = "COMPOSE_CHANGE_MEDIA_DESCRIPTION";
export const COMPOSE_CHANGE_MEDIA_FOCUS = "COMPOSE_CHANGE_MEDIA_FOCUS";
export const COMPOSE_SET_STATUS = 'COMPOSE_SET_STATUS';
export const COMPOSE_SET_STATUS = "COMPOSE_SET_STATUS";
const messages = defineMessages({
uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' },
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
uploadErrorLimit: { id: "upload_error.limit", defaultMessage: "File upload limit exceeded." },
uploadErrorPoll: { id: "upload_error.poll", defaultMessage: "File upload not allowed with polls." },
});
export const ensureComposeIsVisible = (getState, routerHistory) => {
if (!getState().getIn(['compose', 'mounted'])) {
routerHistory.push('/publish');
if (!getState().getIn(["compose", "mounted"])) {
routerHistory.push("/publish");
}
};
@@ -122,7 +122,7 @@ export function cycleElefriendCompose() {
export function replyCompose(status, routerHistory) {
return (dispatch, getState) => {
const prependCWRe = getState().getIn(['local_settings', 'prepend_cw_re']);
const prependCWRe = getState().getIn(["local_settings", "prepend_cw_re"]);
dispatch({
type: COMPOSE_REPLY,
status: status,
@@ -169,11 +169,11 @@ export function directCompose(account, routerHistory) {
export function submitCompose(routerHistory) {
return function (dispatch, getState) {
let status = getState().getIn(['compose', 'text'], '');
const media = getState().getIn(['compose', 'media_attachments']);
const statusId = getState().getIn(['compose', 'id'], null);
const spoilers = getState().getIn(['compose', 'spoiler']) || getState().getIn(['local_settings', 'always_show_spoilers_field']);
let spoilerText = spoilers ? getState().getIn(['compose', 'spoiler_text'], '') : '';
let status = getState().getIn(["compose", "text"], "");
const media = getState().getIn(["compose", "media_attachments"]);
const statusId = getState().getIn(["compose", "id"], null);
const spoilers = getState().getIn(["compose", "spoiler"]) || getState().getIn(["local_settings", "always_show_spoilers_field"]);
let spoilerText = spoilers ? getState().getIn(["compose", "spoiler_text"], "") : "";
if ((!status || !status.length) && media.size === 0) {
return;
@@ -189,42 +189,42 @@ export function submitCompose(routerHistory) {
media_attributes = media.map(item => {
let focus;
if (item.getIn(['meta', 'focus'])) {
focus = `${item.getIn(['meta', 'focus', 'x']).toFixed(2)},${item.getIn(['meta', 'focus', 'y']).toFixed(2)}`;
if (item.getIn(["meta", "focus"])) {
focus = `${item.getIn(["meta", "focus", "x"]).toFixed(2)},${item.getIn(["meta", "focus", "y"]).toFixed(2)}`;
}
return {
id: item.get('id'),
description: item.get('description'),
id: item.get("id"),
description: item.get("description"),
focus,
};
});
}
api(getState).request({
url: statusId === null ? '/api/v1/statuses' : `/api/v1/statuses/${statusId}`,
method: statusId === null ? 'post' : 'put',
url: statusId === null ? "/api/v1/statuses" : `/api/v1/statuses/${statusId}`,
method: statusId === null ? "post" : "put",
data: {
status,
content_type: getState().getIn(['compose', 'content_type']),
in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
media_ids: media.map(item => item.get('id')),
content_type: getState().getIn(["compose", "content_type"]),
in_reply_to_id: getState().getIn(["compose", "in_reply_to"], null),
media_ids: media.map(item => item.get("id")),
media_attributes,
sensitive: getState().getIn(['compose', 'sensitive']) || (spoilerText.length > 0 && media.size !== 0),
sensitive: getState().getIn(["compose", "sensitive"]) || (spoilerText.length > 0 && media.size !== 0),
spoiler_text: spoilerText,
visibility: getState().getIn(['compose', 'privacy']),
poll: getState().getIn(['compose', 'poll'], null),
language: getState().getIn(['compose', 'language']),
local_only: getState().getIn(['compose', 'advanced_options', 'do_not_federate']),
visibility: getState().getIn(["compose", "privacy"]),
poll: getState().getIn(["compose", "poll"], null),
language: getState().getIn(["compose", "language"]),
local_only: getState().getIn(["compose", "advanced_options", "do_not_federate"]),
},
headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
"Idempotency-Key": getState().getIn(["compose", "idempotencyKey"]),
},
}).then(function (response) {
if (routerHistory
&& (routerHistory.location.pathname === '/publish' || routerHistory.location.pathname === '/statuses/new')
&& (routerHistory.location.pathname === "/publish" || routerHistory.location.pathname === "/statuses/new")
&& window.history.state
&& !getState().getIn(['compose', 'advanced_options', 'threaded_mode'])) {
&& !getState().getIn(["compose", "advanced_options", "threaded_mode"])) {
routerHistory.goBack();
}
@@ -239,9 +239,9 @@ export function submitCompose(routerHistory) {
// To make the app more responsive, immediately get the status into the columns
const insertIfOnline = (timelineId) => {
const timeline = getState().getIn(['timelines', timelineId]);
const timeline = getState().getIn(["timelines", timelineId]);
if (timeline && timeline.get('items').size > 0 && timeline.getIn(['items', 0]) !== null && timeline.get('online')) {
if (timeline && timeline.get("items").size > 0 && timeline.getIn(["items", 0]) !== null && timeline.get("online")) {
dispatch(updateTimeline(timelineId, { ...response.data }));
}
};
@@ -251,16 +251,16 @@ export function submitCompose(routerHistory) {
}
if (statusId === null) {
insertIfOnline('home');
insertIfOnline("home");
}
if (statusId === null && response.data.in_reply_to_id === null && response.data.visibility === 'public') {
insertIfOnline('community');
if (statusId === null && response.data.in_reply_to_id === null && response.data.visibility === "public") {
insertIfOnline("community");
if (!response.data.local_only) {
insertIfOnline('public');
insertIfOnline("public");
}
} else if (statusId === null && response.data.visibility === 'direct') {
insertIfOnline('direct');
} else if (statusId === null && response.data.visibility === "direct") {
insertIfOnline("direct");
}
}).catch(function (error) {
dispatch(submitComposeFail(error));
@@ -298,8 +298,8 @@ export function doodleSet(options) {
export function uploadCompose(files) {
return function (dispatch, getState) {
const uploadLimit = maxMediaAttachments;
const media = getState().getIn(['compose', 'media_attachments']);
const pending = getState().getIn(['compose', 'pending_media_attachments']);
const media = getState().getIn(["compose", "media_attachments"]);
const pending = getState().getIn(["compose", "pending_media_attachments"]);
const progress = new Array(files.length).fill(0);
let total = Array.from(files).reduce((a, v) => a + v.size, 0);
@@ -308,7 +308,7 @@ export function uploadCompose(files) {
return;
}
if (getState().getIn(['compose', 'poll'])) {
if (getState().getIn(["compose", "poll"])) {
dispatch(showAlert(undefined, messages.uploadErrorPoll));
return;
}
@@ -316,15 +316,17 @@ export function uploadCompose(files) {
dispatch(uploadComposeRequest());
for (const [i, f] of Array.from(files).entries()) {
if (media.size + i >= uploadLimit) break;
if (media.size + i >= uploadLimit) {
break;
}
resizeImage(f).then(file => {
const data = new FormData();
data.append('file', file);
data.append("file", file);
// Account for disparity in size of original image and resized data
total += file.size - f.size;
return api(getState).post('/api/v2/media', data, {
return api(getState).post("/api/v2/media", data, {
onUploadProgress: function({ loaded }){
progress[i] = loaded;
dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total));
@@ -370,7 +372,7 @@ export const uploadThumbnail = (id, file) => (dispatch, getState) => {
const total = file.size;
const data = new FormData();
data.append('thumbnail', file);
data.append("thumbnail", file);
api(getState).put(`/api/v1/media/${id}`, data, {
onUploadProgress: ({ loaded }) => {
@@ -415,7 +417,7 @@ export function initMediaEditModal(id) {
});
dispatch(openModal({
modalType: 'FOCAL_POINT',
modalType: "FOCAL_POINT",
modalProps: { id },
}));
};
@@ -440,16 +442,16 @@ export function changeUploadCompose(id, params) {
return (dispatch, getState) => {
dispatch(changeUploadComposeRequest());
let media = getState().getIn(['compose', 'media_attachments']).find((item) => item.get('id') === id);
let media = getState().getIn(["compose", "media_attachments"]).find((item) => item.get("id") === id);
// Editing already-attached media is deferred to editing the post itself.
// For simplicity's sake, fake an API reply.
if (media && !media.get('unattached')) {
if (media && !media.get("unattached")) {
const { focus, ...other } = params;
const data = { ...media.toJS(), ...other };
if (focus) {
const [x, y] = focus.split(',');
const [x, y] = focus.split(",");
data.meta = { focus: { x: parseFloat(x), y: parseFloat(y) } };
}
@@ -543,7 +545,7 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) =>
fetchComposeSuggestionsAccountsController = new AbortController();
api(getState).get('/api/v1/accounts/search', {
api(getState).get("/api/v1/accounts/search", {
signal: fetchComposeSuggestionsAccountsController.signal,
params: {
@@ -564,7 +566,7 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) =>
}, 200, { leading: true, trailing: true });
const fetchComposeSuggestionsEmojis = (dispatch, getState, token) => {
const results = emojiSearch(token.replace(':', ''), { maxResults: 5 });
const results = emojiSearch(token.replace(":", ""), { maxResults: 5 });
dispatch(readyComposeSuggestionsEmojis(token, results));
};
@@ -577,11 +579,11 @@ const fetchComposeSuggestionsTags = throttle((dispatch, getState, token) => {
fetchComposeSuggestionsTagsController = new AbortController();
api(getState).get('/api/v2/search', {
api(getState).get("/api/v2/search", {
signal: fetchComposeSuggestionsTagsController.signal,
params: {
type: 'hashtags',
type: "hashtags",
q: token.slice(1),
resolve: false,
limit: 4,
@@ -600,15 +602,15 @@ const fetchComposeSuggestionsTags = throttle((dispatch, getState, token) => {
export function fetchComposeSuggestions(token) {
return (dispatch, getState) => {
switch (token[0]) {
case ':':
fetchComposeSuggestionsEmojis(dispatch, getState, token);
break;
case '#':
fetchComposeSuggestionsTags(dispatch, getState, token);
break;
default:
fetchComposeSuggestionsAccounts(dispatch, getState, token);
break;
case ":":
fetchComposeSuggestionsEmojis(dispatch, getState, token);
break;
case "#":
fetchComposeSuggestionsTags(dispatch, getState, token);
break;
default:
fetchComposeSuggestionsAccounts(dispatch, getState, token);
break;
}
};
}
@@ -638,18 +640,18 @@ export const readyComposeSuggestionsTags = (token, tags) => ({
export function selectComposeSuggestion(position, token, suggestion, path) {
return (dispatch, getState) => {
let completion;
if (suggestion.type === 'emoji') {
if (suggestion.type === "emoji") {
dispatch(useEmoji(suggestion));
completion = suggestion.native || suggestion.colons;
} else if (suggestion.type === 'hashtag') {
} else if (suggestion.type === "hashtag") {
completion = `#${suggestion.name}`;
} else if (suggestion.type === 'account') {
completion = '@' + getState().getIn(['accounts', suggestion.id, 'acct']);
} else if (suggestion.type === "account") {
completion = "@" + getState().getIn(["accounts", suggestion.id, "acct"]);
}
// We don't want to replace hashtags that vary only in case due to accessibility, but we need to fire off an event so that
// the suggestions are dismissed and the cursor moves forward.
if (suggestion.type !== 'hashtag' || token.slice(1).localeCompare(suggestion.name, undefined, { sensitivity: 'accent' }) !== 0) {
if (suggestion.type !== "hashtag" || token.slice(1).localeCompare(suggestion.name, undefined, { sensitivity: "accent" }) !== 0) {
dispatch({
type: COMPOSE_SUGGESTION_SELECT,
position,
@@ -685,7 +687,7 @@ export function updateTagHistory(tags) {
export function hydrateCompose() {
return (dispatch, getState) => {
const me = getState().getIn(['meta', 'me']);
const me = getState().getIn(["meta", "me"]);
const history = tagHistory.get(me);
if (history !== null) {
@@ -697,8 +699,8 @@ export function hydrateCompose() {
function insertIntoTagHistory(recognizedTags, text) {
return (dispatch, getState) => {
const state = getState();
const oldHistory = state.getIn(['compose', 'tagHistory']);
const me = state.getIn(['meta', 'me']);
const oldHistory = state.getIn(["compose", "tagHistory"]);
const me = state.getIn(["meta", "me"]);
const names = recoverHashtags(recognizedTags, text);
const intersectedOldHistory = oldHistory.filter(name => names.findIndex(newName => newName.toLowerCase() === name.toLowerCase()) === -1);