[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:
@@ -1,23 +1,23 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { PureComponent } from 'react';
|
||||
import PropTypes from "prop-types";
|
||||
import { PureComponent } from "react";
|
||||
|
||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||
import { defineMessages, injectIntl, FormattedMessage } from "react-intl";
|
||||
|
||||
import { Helmet } from 'react-helmet';
|
||||
import { Helmet } from "react-helmet";
|
||||
|
||||
import { List as ImmutableList } from 'immutable';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { List as ImmutableList } from "immutable";
|
||||
import ImmutablePropTypes from "react-immutable-proptypes";
|
||||
import { connect } from "react-redux";
|
||||
import { createSelector } from "reselect";
|
||||
|
||||
import { debounce } from 'lodash';
|
||||
import { debounce } from "lodash";
|
||||
|
||||
import { compareId } from 'mastodon/compare_id';
|
||||
import { Icon } from 'mastodon/components/icon';
|
||||
import { NotSignedInIndicator } from 'mastodon/components/not_signed_in_indicator';
|
||||
import { compareId } from "mastodon/compare_id";
|
||||
import { Icon } from "mastodon/components/icon";
|
||||
import { NotSignedInIndicator } from "mastodon/components/not_signed_in_indicator";
|
||||
|
||||
import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
|
||||
import { submitMarkers } from '../../actions/markers';
|
||||
import { addColumn, removeColumn, moveColumn } from "../../actions/columns";
|
||||
import { submitMarkers } from "../../actions/markers";
|
||||
import {
|
||||
expandNotifications,
|
||||
scrollTopNotifications,
|
||||
@@ -25,53 +25,53 @@ import {
|
||||
mountNotifications,
|
||||
unmountNotifications,
|
||||
markNotificationsAsRead,
|
||||
} from '../../actions/notifications';
|
||||
import Column from '../../components/column';
|
||||
import ColumnHeader from '../../components/column_header';
|
||||
import { LoadGap } from '../../components/load_gap';
|
||||
import ScrollableList from '../../components/scrollable_list';
|
||||
} from "../../actions/notifications";
|
||||
import Column from "../../components/column";
|
||||
import ColumnHeader from "../../components/column_header";
|
||||
import { LoadGap } from "../../components/load_gap";
|
||||
import ScrollableList from "../../components/scrollable_list";
|
||||
|
||||
import NotificationsPermissionBanner from './components/notifications_permission_banner';
|
||||
import ColumnSettingsContainer from './containers/column_settings_container';
|
||||
import FilterBarContainer from './containers/filter_bar_container';
|
||||
import NotificationContainer from './containers/notification_container';
|
||||
import NotificationsPermissionBanner from "./components/notifications_permission_banner";
|
||||
import ColumnSettingsContainer from "./containers/column_settings_container";
|
||||
import FilterBarContainer from "./containers/filter_bar_container";
|
||||
import NotificationContainer from "./containers/notification_container";
|
||||
|
||||
const messages = defineMessages({
|
||||
title: { id: 'column.notifications', defaultMessage: 'Notifications' },
|
||||
markAsRead : { id: 'notifications.mark_as_read', defaultMessage: 'Mark every notification as read' },
|
||||
title: { id: "column.notifications", defaultMessage: "Notifications" },
|
||||
markAsRead : { id: "notifications.mark_as_read", defaultMessage: "Mark every notification as read" },
|
||||
});
|
||||
|
||||
const getExcludedTypes = createSelector([
|
||||
state => state.getIn(['settings', 'notifications', 'shows']),
|
||||
state => state.getIn(["settings", "notifications", "shows"]),
|
||||
], (shows) => {
|
||||
return ImmutableList(shows.filter(item => !item).keys());
|
||||
});
|
||||
|
||||
const getNotifications = createSelector([
|
||||
state => state.getIn(['settings', 'notifications', 'quickFilter', 'show']),
|
||||
state => state.getIn(['settings', 'notifications', 'quickFilter', 'active']),
|
||||
state => state.getIn(["settings", "notifications", "quickFilter", "show"]),
|
||||
state => state.getIn(["settings", "notifications", "quickFilter", "active"]),
|
||||
getExcludedTypes,
|
||||
state => state.getIn(['notifications', 'items']),
|
||||
state => state.getIn(["notifications", "items"]),
|
||||
], (showFilterBar, allowedType, excludedTypes, notifications) => {
|
||||
if (!showFilterBar || allowedType === 'all') {
|
||||
if (!showFilterBar || allowedType === "all") {
|
||||
// used if user changed the notification settings after loading the notifications from the server
|
||||
// otherwise a list of notifications will come pre-filtered from the backend
|
||||
// we need to turn it off for FilterBar in order not to block ourselves from seeing a specific category
|
||||
return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type')));
|
||||
return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get("type")));
|
||||
}
|
||||
return notifications.filter(item => item === null || allowedType === item.get('type'));
|
||||
return notifications.filter(item => item === null || allowedType === item.get("type"));
|
||||
});
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
showFilterBar: state.getIn(['settings', 'notifications', 'quickFilter', 'show']),
|
||||
showFilterBar: state.getIn(["settings", "notifications", "quickFilter", "show"]),
|
||||
notifications: getNotifications(state),
|
||||
isLoading: state.getIn(['notifications', 'isLoading'], 0) > 0,
|
||||
isUnread: state.getIn(['notifications', 'unread']) > 0 || state.getIn(['notifications', 'pendingItems']).size > 0,
|
||||
hasMore: state.getIn(['notifications', 'hasMore']),
|
||||
numPending: state.getIn(['notifications', 'pendingItems'], ImmutableList()).size,
|
||||
lastReadId: state.getIn(['settings', 'notifications', 'showUnread']) ? state.getIn(['notifications', 'readMarkerId']) : '0',
|
||||
canMarkAsRead: state.getIn(['settings', 'notifications', 'showUnread']) && state.getIn(['notifications', 'readMarkerId']) !== '0' && getNotifications(state).some(item => item !== null && compareId(item.get('id'), state.getIn(['notifications', 'readMarkerId'])) > 0),
|
||||
needsNotificationPermission: state.getIn(['settings', 'notifications', 'alerts']).includes(true) && state.getIn(['notifications', 'browserSupport']) && state.getIn(['notifications', 'browserPermission']) === 'default' && !state.getIn(['settings', 'notifications', 'dismissPermissionBanner']),
|
||||
isLoading: state.getIn(["notifications", "isLoading"], 0) > 0,
|
||||
isUnread: state.getIn(["notifications", "unread"]) > 0 || state.getIn(["notifications", "pendingItems"]).size > 0,
|
||||
hasMore: state.getIn(["notifications", "hasMore"]),
|
||||
numPending: state.getIn(["notifications", "pendingItems"], ImmutableList()).size,
|
||||
lastReadId: state.getIn(["settings", "notifications", "showUnread"]) ? state.getIn(["notifications", "readMarkerId"]) : "0",
|
||||
canMarkAsRead: state.getIn(["settings", "notifications", "showUnread"]) && state.getIn(["notifications", "readMarkerId"]) !== "0" && getNotifications(state).some(item => item !== null && compareId(item.get("id"), state.getIn(["notifications", "readMarkerId"])) > 0),
|
||||
needsNotificationPermission: state.getIn(["settings", "notifications", "alerts"]).includes(true) && state.getIn(["notifications", "browserSupport"]) && state.getIn(["notifications", "browserPermission"]) === "default" && !state.getIn(["settings", "notifications", "dismissPermissionBanner"]),
|
||||
});
|
||||
|
||||
class Notifications extends PureComponent {
|
||||
@@ -118,7 +118,7 @@ class Notifications extends PureComponent {
|
||||
|
||||
handleLoadOlder = debounce(() => {
|
||||
const last = this.props.notifications.last();
|
||||
this.props.dispatch(expandNotifications({ maxId: last && last.get('id') }));
|
||||
this.props.dispatch(expandNotifications({ maxId: last && last.get("id") }));
|
||||
}, 300, { leading: true });
|
||||
|
||||
handleLoadPending = () => {
|
||||
@@ -139,7 +139,7 @@ class Notifications extends PureComponent {
|
||||
if (columnId) {
|
||||
dispatch(removeColumn(columnId));
|
||||
} else {
|
||||
dispatch(addColumn('NOTIFICATIONS', {}));
|
||||
dispatch(addColumn("NOTIFICATIONS", {}));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -157,12 +157,12 @@ class Notifications extends PureComponent {
|
||||
};
|
||||
|
||||
handleMoveUp = id => {
|
||||
const elementIndex = this.props.notifications.findIndex(item => item !== null && item.get('id') === id) - 1;
|
||||
const elementIndex = this.props.notifications.findIndex(item => item !== null && item.get("id") === id) - 1;
|
||||
this._selectChild(elementIndex, true);
|
||||
};
|
||||
|
||||
handleMoveDown = id => {
|
||||
const elementIndex = this.props.notifications.findIndex(item => item !== null && item.get('id') === id) + 1;
|
||||
const elementIndex = this.props.notifications.findIndex(item => item !== null && item.get("id") === id) + 1;
|
||||
this._selectChild(elementIndex, false);
|
||||
};
|
||||
|
||||
@@ -191,8 +191,7 @@ class Notifications extends PureComponent {
|
||||
const emptyMessage = <FormattedMessage id='empty_column.notifications' defaultMessage="You don't have any notifications yet. When other people interact with you, you will see it here." />;
|
||||
const { signedIn } = this.context.identity;
|
||||
|
||||
let scrollableContent = null;
|
||||
|
||||
let scrollableContent;
|
||||
const filterBarContainer = (signedIn && showFilterBar)
|
||||
? (<FilterBarContainer />)
|
||||
: null;
|
||||
@@ -202,19 +201,19 @@ class Notifications extends PureComponent {
|
||||
} else if (notifications.size > 0 || hasMore) {
|
||||
scrollableContent = notifications.map((item, index) => item === null ? (
|
||||
<LoadGap
|
||||
key={'gap:' + notifications.getIn([index + 1, 'id'])}
|
||||
key={"gap:" + notifications.getIn([index + 1, "id"])}
|
||||
disabled={isLoading}
|
||||
maxId={index > 0 ? notifications.getIn([index - 1, 'id']) : null}
|
||||
maxId={index > 0 ? notifications.getIn([index - 1, "id"]) : null}
|
||||
onClick={this.handleLoadGap}
|
||||
/>
|
||||
) : (
|
||||
<NotificationContainer
|
||||
key={item.get('id')}
|
||||
key={item.get("id")}
|
||||
notification={item}
|
||||
accountId={item.get('account')}
|
||||
accountId={item.get("account")}
|
||||
onMoveUp={this.handleMoveUp}
|
||||
onMoveDown={this.handleMoveDown}
|
||||
unread={lastReadId !== '0' && compareId(item.get('id'), lastReadId) > 0}
|
||||
unread={lastReadId !== "0" && compareId(item.get("id"), lastReadId) > 0}
|
||||
/>
|
||||
));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user