[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
@@ -1,8 +1,8 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { makeGetAccount } from 'flavours/glitch/selectors';
import { makeGetAccount } from "flavours/glitch/selectors";
import AutosuggestAccount from '../components/autosuggest_account';
import AutosuggestAccount from "../components/autosuggest_account";
const makeMapStateToProps = () => {
const getAccount = makeGetAccount();
@@ -1,6 +1,6 @@
import { defineMessages, injectIntl } from 'react-intl';
import { defineMessages, injectIntl } from "react-intl";
import { connect } from 'react-redux';
import { connect } from "react-redux";
import {
changeCompose,
@@ -13,72 +13,72 @@ import {
selectComposeSuggestion,
submitCompose,
uploadCompose,
} from 'flavours/glitch/actions/compose';
import { changeLocalSetting } from 'flavours/glitch/actions/local_settings';
} from "flavours/glitch/actions/compose";
import { changeLocalSetting } from "flavours/glitch/actions/local_settings";
import {
openModal,
} from 'flavours/glitch/actions/modal';
import { privacyPreference } from 'flavours/glitch/utils/privacy_preference';
} from "flavours/glitch/actions/modal";
import { privacyPreference } from "flavours/glitch/utils/privacy_preference";
import ComposeForm from '../components/compose_form';
import ComposeForm from "../components/compose_form";
const messages = defineMessages({
missingDescriptionMessage: {
id: 'confirmations.missing_media_description.message',
defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.',
id: "confirmations.missing_media_description.message",
defaultMessage: "At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.",
},
missingDescriptionConfirm: {
id: 'confirmations.missing_media_description.confirm',
defaultMessage: 'Send anyway',
id: "confirmations.missing_media_description.confirm",
defaultMessage: "Send anyway",
},
missingDescriptionEdit: {
id: 'confirmations.missing_media_description.edit',
defaultMessage: 'Edit media',
id: "confirmations.missing_media_description.edit",
defaultMessage: "Edit media",
},
});
// State mapping.
function mapStateToProps (state) {
const spoilersAlwaysOn = state.getIn(['local_settings', 'always_show_spoilers_field']);
const inReplyTo = state.getIn(['compose', 'in_reply_to']);
const replyPrivacy = inReplyTo ? state.getIn(['statuses', inReplyTo, 'visibility']) : null;
const sideArmBasePrivacy = state.getIn(['local_settings', 'side_arm']);
const spoilersAlwaysOn = state.getIn(["local_settings", "always_show_spoilers_field"]);
const inReplyTo = state.getIn(["compose", "in_reply_to"]);
const replyPrivacy = inReplyTo ? state.getIn(["statuses", inReplyTo, "visibility"]) : null;
const sideArmBasePrivacy = state.getIn(["local_settings", "side_arm"]);
const sideArmRestrictedPrivacy = replyPrivacy ? privacyPreference(replyPrivacy, sideArmBasePrivacy) : null;
let sideArmPrivacy = null;
switch (state.getIn(['local_settings', 'side_arm_reply_mode'])) {
case 'copy':
sideArmPrivacy = replyPrivacy;
break;
case 'restrict':
sideArmPrivacy = sideArmRestrictedPrivacy;
break;
switch (state.getIn(["local_settings", "side_arm_reply_mode"])) {
case "copy":
sideArmPrivacy = replyPrivacy;
break;
case "restrict":
sideArmPrivacy = sideArmRestrictedPrivacy;
break;
}
sideArmPrivacy = sideArmPrivacy || sideArmBasePrivacy;
return {
advancedOptions: state.getIn(['compose', 'advanced_options']),
focusDate: state.getIn(['compose', 'focusDate']),
caretPosition: state.getIn(['compose', 'caretPosition']),
isSubmitting: state.getIn(['compose', 'is_submitting']),
isEditing: state.getIn(['compose', 'id']) !== null,
isChangingUpload: state.getIn(['compose', 'is_changing_upload']),
isUploading: state.getIn(['compose', 'is_uploading']),
layout: state.getIn(['local_settings', 'layout']),
media: state.getIn(['compose', 'media_attachments']),
preselectDate: state.getIn(['compose', 'preselectDate']),
privacy: state.getIn(['compose', 'privacy']),
advancedOptions: state.getIn(["compose", "advanced_options"]),
focusDate: state.getIn(["compose", "focusDate"]),
caretPosition: state.getIn(["compose", "caretPosition"]),
isSubmitting: state.getIn(["compose", "is_submitting"]),
isEditing: state.getIn(["compose", "id"]) !== null,
isChangingUpload: state.getIn(["compose", "is_changing_upload"]),
isUploading: state.getIn(["compose", "is_uploading"]),
layout: state.getIn(["local_settings", "layout"]),
media: state.getIn(["compose", "media_attachments"]),
preselectDate: state.getIn(["compose", "preselectDate"]),
privacy: state.getIn(["compose", "privacy"]),
sideArm: sideArmPrivacy,
sensitive: state.getIn(['compose', 'sensitive']),
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
spoiler: spoilersAlwaysOn || state.getIn(['compose', 'spoiler']),
spoilerText: state.getIn(['compose', 'spoiler_text']),
suggestions: state.getIn(['compose', 'suggestions']),
text: state.getIn(['compose', 'text']),
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
sensitive: state.getIn(["compose", "sensitive"]),
showSearch: state.getIn(["search", "submitted"]) && !state.getIn(["search", "hidden"]),
spoiler: spoilersAlwaysOn || state.getIn(["compose", "spoiler"]),
spoilerText: state.getIn(["compose", "spoiler_text"]),
suggestions: state.getIn(["compose", "suggestions"]),
text: state.getIn(["compose", "text"]),
anyMedia: state.getIn(["compose", "media_attachments"]).size > 0,
spoilersAlwaysOn: spoilersAlwaysOn,
mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']),
preselectOnReply: state.getIn(['local_settings', 'preselect_on_reply']),
isInReply: state.getIn(['compose', 'in_reply_to']) !== null,
lang: state.getIn(['compose', 'language']),
mediaDescriptionConfirmation: state.getIn(["local_settings", "confirm_missing_media_description"]),
preselectOnReply: state.getIn(["local_settings", "preselect_on_reply"]),
isInReply: state.getIn(["compose", "in_reply_to"]) !== null,
lang: state.getIn(["compose", "language"]),
};
}
@@ -127,7 +127,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onMediaDescriptionConfirm(routerHistory, mediaId, overriddenVisibility = null) {
dispatch(openModal({
modalType: 'CONFIRM',
modalType: "CONFIRM",
modalProps: {
message: intl.formatMessage(messages.missingDescriptionMessage),
confirm: intl.formatMessage(messages.missingDescriptionConfirm),
@@ -139,10 +139,10 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
},
secondary: intl.formatMessage(messages.missingDescriptionEdit),
onSecondary: () => dispatch(openModal({
modalType: 'FOCAL_POINT',
modalType: "FOCAL_POINT",
modalProps: { id: mediaId },
})),
onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)),
onDoNotAsk: () => dispatch(changeLocalSetting(["confirm_missing_media_description"], false)),
},
}));
},
@@ -1,13 +1,13 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { openModal, closeModal } from 'flavours/glitch/actions/modal';
import { isUserTouching } from 'flavours/glitch/is_mobile';
import { openModal, closeModal } from "flavours/glitch/actions/modal";
import { isUserTouching } from "flavours/glitch/is_mobile";
import Dropdown from '../components/dropdown';
import Dropdown from "../components/dropdown";
const mapDispatchToProps = dispatch => ({
isUserTouching,
onModalOpen: props => dispatch(openModal({ modalType: 'ACTIONS', modalProps: props })),
onModalOpen: props => dispatch(openModal({ modalType: "ACTIONS", modalProps: props })),
onModalClose: () => dispatch(closeModal({ modalType: undefined, ignoreFocus: false })),
});
@@ -1,36 +1,36 @@
import { Map as ImmutableMap } from 'immutable';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { Map as ImmutableMap } from "immutable";
import { connect } from "react-redux";
import { createSelector } from "reselect";
import { useEmoji } from 'flavours/glitch/actions/emojis';
import { changeSetting } from 'flavours/glitch/actions/settings';
import { useEmoji } from "flavours/glitch/actions/emojis";
import { changeSetting } from "flavours/glitch/actions/settings";
import EmojiPickerDropdown from '../components/emoji_picker_dropdown';
import EmojiPickerDropdown from "../components/emoji_picker_dropdown";
const perLine = 8;
const lines = 2;
const DEFAULTS = [
'+1',
'grinning',
'kissing_heart',
'heart_eyes',
'laughing',
'stuck_out_tongue_winking_eye',
'sweat_smile',
'joy',
'yum',
'disappointed',
'thinking_face',
'weary',
'sob',
'sunglasses',
'heart',
'ok_hand',
"+1",
"grinning",
"kissing_heart",
"heart_eyes",
"laughing",
"stuck_out_tongue_winking_eye",
"sweat_smile",
"joy",
"yum",
"disappointed",
"thinking_face",
"weary",
"sob",
"sunglasses",
"heart",
"ok_hand",
];
const getFrequentlyUsedEmojis = createSelector([
state => state.getIn(['settings', 'frequentlyUsedEmojis'], ImmutableMap()),
state => state.getIn(["settings", "frequentlyUsedEmojis"], ImmutableMap()),
], emojiCounters => {
let emojis = emojiCounters
.keySeq()
@@ -48,10 +48,10 @@ const getFrequentlyUsedEmojis = createSelector([
});
const getCustomEmojis = createSelector([
state => state.get('custom_emojis'),
], emojis => emojis.filter(e => e.get('visible_in_picker')).sort((a, b) => {
const aShort = a.get('shortcode').toLowerCase();
const bShort = b.get('shortcode').toLowerCase();
state => state.get("custom_emojis"),
], emojis => emojis.filter(e => e.get("visible_in_picker")).sort((a, b) => {
const aShort = a.get("shortcode").toLowerCase();
const bShort = b.get("shortcode").toLowerCase();
if (aShort < bShort) {
return -1;
@@ -64,17 +64,17 @@ const getCustomEmojis = createSelector([
const mapStateToProps = state => ({
custom_emojis: getCustomEmojis(state),
skinTone: state.getIn(['settings', 'skinTone']),
skinTone: state.getIn(["settings", "skinTone"]),
frequentlyUsedEmojis: getFrequentlyUsedEmojis(state),
});
const mapDispatchToProps = (dispatch, { onPickEmoji }) => ({
onSkinTone: skinTone => {
dispatch(changeSetting(['skinTone'], skinTone));
dispatch(changeSetting(["skinTone"], skinTone));
},
onPickEmoji: emoji => {
// eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook
// eslint-disable-next-line react-hooks/rules-of-hooks
dispatch(useEmoji(emoji));
if (onPickEmoji) {
@@ -1,22 +1,22 @@
import { defineMessages, injectIntl } from 'react-intl';
import { defineMessages, injectIntl } from "react-intl";
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { openModal } from 'flavours/glitch/actions/modal';
import { logOut } from 'flavours/glitch/utils/log_out';
import { openModal } from "flavours/glitch/actions/modal";
import { logOut } from "flavours/glitch/utils/log_out";
import Header from '../components/header';
import Header from "../components/header";
const messages = defineMessages({
logoutMessage: { id: 'confirmations.logout.message', defaultMessage: 'Are you sure you want to log out?' },
logoutConfirm: { id: 'confirmations.logout.confirm', defaultMessage: 'Log out' },
logoutMessage: { id: "confirmations.logout.message", defaultMessage: "Are you sure you want to log out?" },
logoutConfirm: { id: "confirmations.logout.confirm", defaultMessage: "Log out" },
});
const mapStateToProps = state => {
return {
columns: state.getIn(['settings', 'columns']),
unreadNotifications: state.getIn(['notifications', 'unread']),
showNotificationsBadge: state.getIn(['local_settings', 'notifications', 'tab_badge']),
columns: state.getIn(["settings", "columns"]),
unreadNotifications: state.getIn(["notifications", "unread"]),
showNotificationsBadge: state.getIn(["local_settings", "notifications", "tab_badge"]),
};
};
@@ -24,11 +24,11 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onSettingsClick (e) {
e.preventDefault();
e.stopPropagation();
dispatch(openModal({ modalType: 'SETTINGS', modalProps: {} }));
dispatch(openModal({ modalType: "SETTINGS", modalProps: {} }));
},
onLogout () {
dispatch(openModal({
modalType: 'CONFIRM',
modalType: "CONFIRM",
modalProps: {
message: intl.formatMessage(messages.logoutMessage),
confirm: intl.formatMessage(messages.logoutConfirm),
@@ -1,14 +1,14 @@
import { Map as ImmutableMap } from 'immutable';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { Map as ImmutableMap } from "immutable";
import { connect } from "react-redux";
import { createSelector } from "reselect";
import { changeComposeLanguage } from 'flavours/glitch/actions/compose';
import { useLanguage } from 'flavours/glitch/actions/languages';
import { changeComposeLanguage } from "flavours/glitch/actions/compose";
import { useLanguage } from "flavours/glitch/actions/languages";
import LanguageDropdown from '../components/language_dropdown';
import LanguageDropdown from "../components/language_dropdown";
const getFrequentlyUsedLanguages = createSelector([
state => state.getIn(['settings', 'frequentlyUsedLanguages'], ImmutableMap()),
state => state.getIn(["settings", "frequentlyUsedLanguages"], ImmutableMap()),
], languageCounters => (
languageCounters.keySeq()
.sort((a, b) => languageCounters.get(a) - languageCounters.get(b))
@@ -18,7 +18,7 @@ const getFrequentlyUsedLanguages = createSelector([
const mapStateToProps = state => ({
frequentlyUsedLanguages: getFrequentlyUsedLanguages(state),
value: state.getIn(['compose', 'language']),
value: state.getIn(["compose", "language"]),
});
const mapDispatchToProps = dispatch => ({
@@ -28,7 +28,7 @@ const mapDispatchToProps = dispatch => ({
},
onClose (value) {
// eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook
// eslint-disable-next-line react-hooks/rules-of-hooks
dispatch(useLanguage(value));
},
@@ -1,28 +1,28 @@
import { defineMessages, injectIntl } from 'react-intl';
import { defineMessages, injectIntl } from "react-intl";
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { openModal } from 'flavours/glitch/actions/modal';
import { me } from 'flavours/glitch/initial_state';
import { logOut } from 'flavours/glitch/utils/log_out';
import { openModal } from "flavours/glitch/actions/modal";
import { me } from "flavours/glitch/initial_state";
import { logOut } from "flavours/glitch/utils/log_out";
import NavigationBar from '../components/navigation_bar';
import NavigationBar from "../components/navigation_bar";
const messages = defineMessages({
logoutMessage: { id: 'confirmations.logout.message', defaultMessage: 'Are you sure you want to log out?' },
logoutConfirm: { id: 'confirmations.logout.confirm', defaultMessage: 'Log out' },
logoutMessage: { id: "confirmations.logout.message", defaultMessage: "Are you sure you want to log out?" },
logoutConfirm: { id: "confirmations.logout.confirm", defaultMessage: "Log out" },
});
const mapStateToProps = state => {
return {
account: state.getIn(['accounts', me]),
account: state.getIn(["accounts", me]),
};
};
const mapDispatchToProps = (dispatch, { intl }) => ({
onLogout () {
dispatch(openModal({
modalType: 'CONFIRM',
modalType: "CONFIRM",
modalProps: {
message: intl.formatMessage(messages.logoutMessage),
confirm: intl.formatMessage(messages.logoutConfirm),
@@ -1,27 +1,27 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import {
changeComposeAdvancedOption,
changeComposeContentType,
addPoll,
removePoll,
} from 'flavours/glitch/actions/compose';
import { openModal } from 'flavours/glitch/actions/modal';
} from "flavours/glitch/actions/compose";
import { openModal } from "flavours/glitch/actions/modal";
import Options from '../components/options';
import Options from "../components/options";
function mapStateToProps (state) {
const poll = state.getIn(['compose', 'poll']);
const media = state.getIn(['compose', 'media_attachments']);
const pending_media = state.getIn(['compose', 'pending_media_attachments']);
const poll = state.getIn(["compose", "poll"]);
const media = state.getIn(["compose", "media_attachments"]);
const pending_media = state.getIn(["compose", "pending_media_attachments"]);
return {
acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']).toArray().join(','),
resetFileKey: state.getIn(['compose', 'resetFileKey']),
acceptContentTypes: state.getIn(["media_attachments", "accept_content_types"]).toArray().join(","),
resetFileKey: state.getIn(["compose", "resetFileKey"]),
hasPoll: !!poll,
allowMedia: !poll && (media ? media.size + pending_media < 4 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : pending_media < 4),
allowMedia: !poll && (media ? media.size + pending_media < 4 && !media.some(item => ["video", "audio"].includes(item.get("type"))) : pending_media < 4),
allowPoll: !(media && !!media.size),
showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']),
contentType: state.getIn(['compose', 'content_type']),
showContentTypeChoice: state.getIn(["local_settings", "show_content_type_choice"]),
contentType: state.getIn(["compose", "content_type"]),
};
}
@@ -37,7 +37,7 @@ const mapDispatchToProps = (dispatch) => ({
onTogglePoll() {
dispatch((_, getState) => {
if (getState().getIn(['compose', 'poll'])) {
if (getState().getIn(["compose", "poll"])) {
dispatch(removePoll());
} else {
dispatch(addPoll());
@@ -47,7 +47,7 @@ const mapDispatchToProps = (dispatch) => ({
onDoodleOpen() {
dispatch(openModal({
modalType: 'DOODLE',
modalType: "DOODLE",
modalProps: { noEsc: true, noClose: true },
}));
},
@@ -1,4 +1,4 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import {
addPollOption,
@@ -8,16 +8,16 @@ import {
clearComposeSuggestions,
fetchComposeSuggestions,
selectComposeSuggestion,
} from 'flavours/glitch/actions/compose';
} from "flavours/glitch/actions/compose";
import PollForm from '../components/poll_form';
import PollForm from "../components/poll_form";
const mapStateToProps = state => ({
suggestions: state.getIn(['compose', 'suggestions']),
options: state.getIn(['compose', 'poll', 'options']),
lang: state.getIn(['compose', 'language']),
expiresIn: state.getIn(['compose', 'poll', 'expires_in']),
isMultiple: state.getIn(['compose', 'poll', 'multiple']),
suggestions: state.getIn(["compose", "suggestions"]),
options: state.getIn(["compose", "poll", "options"]),
lang: state.getIn(["compose", "language"]),
expiresIn: state.getIn(["compose", "poll", "expires_in"]),
isMultiple: state.getIn(["compose", "poll", "multiple"]),
});
const mapDispatchToProps = dispatch => ({
@@ -1,13 +1,13 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { changeComposeVisibility } from 'flavours/glitch/actions/compose';
import { openModal, closeModal } from 'flavours/glitch/actions/modal';
import { isUserTouching } from 'flavours/glitch/is_mobile';
import { changeComposeVisibility } from "flavours/glitch/actions/compose";
import { openModal, closeModal } from "flavours/glitch/actions/modal";
import { isUserTouching } from "flavours/glitch/is_mobile";
import PrivacyDropdown from '../components/privacy_dropdown';
import PrivacyDropdown from "../components/privacy_dropdown";
const mapStateToProps = state => ({
value: state.getIn(['compose', 'privacy']),
value: state.getIn(["compose", "privacy"]),
});
const mapDispatchToProps = dispatch => ({
@@ -18,7 +18,7 @@ const mapDispatchToProps = dispatch => ({
isUserTouching,
onModalOpen: props => dispatch(openModal({
modalType: 'ACTIONS',
modalType: "ACTIONS",
modalProps: props,
})),
onModalClose: () => dispatch(closeModal({
@@ -1,21 +1,21 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { cancelReplyCompose } from 'flavours/glitch/actions/compose';
import { cancelReplyCompose } from "flavours/glitch/actions/compose";
import ReplyIndicator from '../components/reply_indicator';
import ReplyIndicator from "../components/reply_indicator";
const makeMapStateToProps = () => {
const mapStateToProps = state => {
let statusId = state.getIn(['compose', 'id'], null);
let statusId = state.getIn(["compose", "id"], null);
let editing = true;
if (statusId === null) {
statusId = state.getIn(['compose', 'in_reply_to']);
statusId = state.getIn(["compose", "in_reply_to"]);
editing = false;
}
return {
status: state.getIn(['statuses', statusId]),
status: state.getIn(["statuses", statusId]),
editing,
};
};
@@ -1,4 +1,4 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import {
changeSearch,
@@ -8,14 +8,14 @@ import {
openURL,
clickSearchResult,
forgetSearchResult,
} from 'flavours/glitch/actions/search';
} from "flavours/glitch/actions/search";
import Search from '../components/search';
import Search from "../components/search";
const mapStateToProps = state => ({
value: state.getIn(['search', 'value']),
submitted: state.getIn(['search', 'submitted']),
recent: state.getIn(['search', 'recent']).reverse(),
value: state.getIn(["search", "value"]),
submitted: state.getIn(["search", "submitted"]),
recent: state.getIn(["search", "recent"]).reverse(),
});
const mapDispatchToProps = dispatch => ({
@@ -1,20 +1,20 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { expandSearch } from 'flavours/glitch/actions/search';
import { fetchSuggestions, dismissSuggestion } from 'flavours/glitch/actions/suggestions';
import { expandSearch } from "flavours/glitch/actions/search";
import { fetchSuggestions, dismissSuggestion } from "flavours/glitch/actions/suggestions";
import SearchResults from '../components/search_results';
import SearchResults from "../components/search_results";
const mapStateToProps = state => ({
results: state.getIn(['search', 'results']),
suggestions: state.getIn(['suggestions', 'items']),
searchTerm: state.getIn(['search', 'searchTerm']),
results: state.getIn(["search", "results"]),
suggestions: state.getIn(["suggestions", "items"]),
searchTerm: state.getIn(["search", "searchTerm"]),
});
const mapDispatchToProps = dispatch => ({
fetchSuggestions: () => dispatch(fetchSuggestions()),
expandSearch: type => dispatch(expandSearch(type)),
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
dismissSuggestion: account => dispatch(dismissSuggestion(account.get("id"))),
});
export default connect(mapStateToProps, mapDispatchToProps)(SearchResults);
@@ -1,32 +1,32 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import PropTypes from "prop-types";
import { PureComponent } from "react";
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
import { injectIntl, defineMessages, FormattedMessage } from "react-intl";
import classNames from 'classnames';
import classNames from "classnames";
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { changeComposeSensitivity } from 'flavours/glitch/actions/compose';
import { changeComposeSensitivity } from "flavours/glitch/actions/compose";
const messages = defineMessages({
marked: {
id: 'compose_form.sensitive.marked',
defaultMessage: '{count, plural, one {Media is marked as sensitive} other {Media is marked as sensitive}}',
id: "compose_form.sensitive.marked",
defaultMessage: "{count, plural, one {Media is marked as sensitive} other {Media is marked as sensitive}}",
},
unmarked: {
id: 'compose_form.sensitive.unmarked',
defaultMessage: '{count, plural, one {Media is not marked as sensitive} other {Media is not marked as sensitive}}',
id: "compose_form.sensitive.unmarked",
defaultMessage: "{count, plural, one {Media is not marked as sensitive} other {Media is not marked as sensitive}}",
},
});
const mapStateToProps = state => {
const spoilersAlwaysOn = state.getIn(['local_settings', 'always_show_spoilers_field']);
const spoilerText = state.getIn(['compose', 'spoiler_text']);
const spoilersAlwaysOn = state.getIn(["local_settings", "always_show_spoilers_field"]);
const spoilerText = state.getIn(["compose", "spoiler_text"]);
return {
active: state.getIn(['compose', 'sensitive']) || (spoilersAlwaysOn && spoilerText && spoilerText.length > 0),
disabled: state.getIn(['compose', 'spoiler']),
mediaCount: state.getIn(['compose', 'media_attachments']).size,
active: state.getIn(["compose", "sensitive"]) || (spoilersAlwaysOn && spoilerText && spoilerText.length > 0),
disabled: state.getIn(["compose", "spoiler"]),
mediaCount: state.getIn(["compose", "media_attachments"]).size,
};
};
@@ -53,7 +53,7 @@ class SensitiveButton extends PureComponent {
return (
<div className='compose-form__sensitive-button'>
<label className={classNames('icon-button', { active })} title={intl.formatMessage(active ? messages.marked : messages.unmarked, { count: mediaCount })}>
<label className={classNames("icon-button", { active })} title={intl.formatMessage(active ? messages.marked : messages.unmarked, { count: mediaCount })}>
<input
name='mark-sensitive'
type='checkbox'
@@ -62,7 +62,7 @@ class SensitiveButton extends PureComponent {
disabled={disabled}
/>
<span className={classNames('checkbox', { active })} />
<span className={classNames("checkbox", { active })} />
<FormattedMessage
id='compose_form.sensitive.hide'
@@ -1,11 +1,11 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { undoUploadCompose, initMediaEditModal, submitCompose } from 'flavours/glitch/actions/compose';
import { undoUploadCompose, initMediaEditModal, submitCompose } from "flavours/glitch/actions/compose";
import Upload from '../components/upload';
import Upload from "../components/upload";
const mapStateToProps = (state, { id }) => ({
media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id),
media: state.getIn(["compose", "media_attachments"]).find(item => item.get("id") === id),
});
const mapDispatchToProps = dispatch => ({
@@ -1,9 +1,9 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import UploadForm from '../components/upload_form';
import UploadForm from "../components/upload_form";
const mapStateToProps = state => ({
mediaIds: state.getIn(['compose', 'media_attachments']).map(item => item.get('id')),
mediaIds: state.getIn(["compose", "media_attachments"]).map(item => item.get("id")),
});
export default connect(mapStateToProps)(UploadForm);
@@ -1,11 +1,11 @@
import { connect } from 'react-redux';
import { connect } from "react-redux";
import UploadProgress from '../components/upload_progress';
import UploadProgress from "../components/upload_progress";
const mapStateToProps = state => ({
active: state.getIn(['compose', 'is_uploading']),
progress: state.getIn(['compose', 'progress']),
isProcessing: state.getIn(['compose', 'is_processing']),
active: state.getIn(["compose", "is_uploading"]),
progress: state.getIn(["compose", "progress"]),
isProcessing: state.getIn(["compose", "is_processing"]),
});
export default connect(mapStateToProps)(UploadProgress);
@@ -1,20 +1,20 @@
import PropTypes from 'prop-types';
import PropTypes from "prop-types";
import { FormattedMessage } from 'react-intl';
import { FormattedMessage } from "react-intl";
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { me } from 'flavours/glitch/initial_state';
import { privacyPolicyLink } from 'flavours/glitch/utils/backend_links';
import { HASHTAG_PATTERN_REGEX } from 'flavours/glitch/utils/hashtags';
import { me } from "flavours/glitch/initial_state";
import { privacyPolicyLink } from "flavours/glitch/utils/backend_links";
import { HASHTAG_PATTERN_REGEX } from "flavours/glitch/utils/hashtags";
import Warning from '../components/warning';
import Warning from "../components/warning";
const mapStateToProps = state => ({
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
hashtagWarning: state.getIn(['compose', 'privacy']) !== 'public' && HASHTAG_PATTERN_REGEX.test(state.getIn(['compose', 'text'])),
directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct',
needsLockWarning: state.getIn(["compose", "privacy"]) === "private" && !state.getIn(["accounts", me, "locked"]),
hashtagWarning: state.getIn(["compose", "privacy"]) !== "public" && HASHTAG_PATTERN_REGEX.test(state.getIn(["compose", "text"])),
directMessageWarning: state.getIn(["compose", "privacy"]) === "direct",
});
const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning }) => {
@@ -29,7 +29,7 @@ const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning
if (directMessageWarning) {
const message = (
<span>
<FormattedMessage id='compose_form.encryption_warning' defaultMessage='Posts on Mastodon are not end-to-end encrypted. Do not share any dangerous information over Mastodon.' /> {!!privacyPolicyLink && <a href={privacyPolicyLink} target='_blank'><FormattedMessage id='compose_form.direct_message_warning_learn_more' defaultMessage='Learn more' /></a>}
<FormattedMessage id='compose_form.encryption_warning' defaultMessage='Posts on Mastodon are not end-to-end encrypted. Do not share any dangerous information over Mastodon.' /> {!!privacyPolicyLink && <a href={privacyPolicyLink} target='_blank' rel="noreferrer"><FormattedMessage id='compose_form.direct_message_warning_learn_more' defaultMessage='Learn more' /></a>}
</span>
);