Browse Source

Linter catching a bunch of stuff that needed fixing

dariusk-working/4_4_0
Darius Kazemi 4 months ago
parent
commit
2fe75db85c
  1. 128
      app/javascript/mastodon/actions/lists.js
  2. 4
      app/javascript/mastodon/actions/notification_groups.ts
  3. 4
      app/javascript/mastodon/components/account/index.tsx
  4. 2
      app/javascript/mastodon/components/hashtag.tsx
  5. 4
      app/javascript/mastodon/components/no_alt_text_badge.tsx
  6. 30
      app/javascript/mastodon/features/audio/index.tsx
  7. 7
      app/javascript/mastodon/features/directory/components/account_card.tsx
  8. 6
      app/javascript/mastodon/features/status/components/detailed_status.tsx
  9. 30
      app/javascript/mastodon/features/video/index.tsx
  10. 1
      app/javascript/mastodon/reducers/notification_groups.ts

128
app/javascript/mastodon/actions/lists.js

@ -4,23 +4,6 @@ export const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST';
export const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS';
export const LIST_FETCH_FAIL = 'LIST_FETCH_FAIL';
export const LISTS_FETCH_REQUEST = 'LISTS_FETCH_REQUEST';
export const LISTS_FETCH_SUCCESS = 'LISTS_FETCH_SUCCESS';
export const LISTS_FETCH_FAIL = 'LISTS_FETCH_FAIL';
export const LIST_EDITOR_TITLE_CHANGE = 'LIST_EDITOR_TITLE_CHANGE';
export const LIST_EDITOR_IS_EXCLUSIVE_CHANGE = 'LIST_EDITOR_IS_EXCLUSIVE_CHANGE';
export const LIST_EDITOR_RESET = 'LIST_EDITOR_RESET';
export const LIST_EDITOR_SETUP = 'LIST_EDITOR_SETUP';
export const LIST_CREATE_REQUEST = 'LIST_CREATE_REQUEST';
export const LIST_CREATE_SUCCESS = 'LIST_CREATE_SUCCESS';
export const LIST_CREATE_FAIL = 'LIST_CREATE_FAIL';
export const LIST_UPDATE_REQUEST = 'LIST_UPDATE_REQUEST';
export const LIST_UPDATE_SUCCESS = 'LIST_UPDATE_SUCCESS';
export const LIST_UPDATE_FAIL = 'LIST_UPDATE_FAIL';
export const LIST_DELETE_REQUEST = 'LIST_DELETE_REQUEST';
export const LIST_DELETE_SUCCESS = 'LIST_DELETE_SUCCESS';
export const LIST_DELETE_FAIL = 'LIST_DELETE_FAIL';
@ -55,117 +38,6 @@ export const fetchListFail = (id, error) => ({
error,
});
export const fetchLists = () => (dispatch) => {
dispatch(fetchListsRequest());
api().get('/api/v1/lists')
.then(({ data }) => dispatch(fetchListsSuccess(data)))
.catch(err => dispatch(fetchListsFail(err)));
};
export const fetchListsRequest = () => ({
type: LISTS_FETCH_REQUEST,
});
export const fetchListsSuccess = lists => ({
type: LISTS_FETCH_SUCCESS,
lists,
});
export const fetchListsFail = error => ({
type: LISTS_FETCH_FAIL,
error,
});
export const submitListEditor = shouldReset => (dispatch, getState) => {
const listId = getState().getIn(['listEditor', 'listId']);
const title = getState().getIn(['listEditor', 'title']);
const isExclusive = getState().getIn(['listEditor', 'isExclusive']);
if (listId === null) {
dispatch(createList(title, shouldReset));
} else {
dispatch(updateList(listId, title, shouldReset, isExclusive));
}
};
export const setupListEditor = listId => (dispatch, getState) => {
dispatch({
type: LIST_EDITOR_SETUP,
list: getState().getIn(['lists', listId]),
});
dispatch(fetchListAccounts(listId));
};
export const changeListEditorTitle = value => ({
type: LIST_EDITOR_TITLE_CHANGE,
value,
});
export const changeListEditorIsExclusive = value => ({
type: LIST_EDITOR_IS_EXCLUSIVE_CHANGE,
value,
});
export const createList = (title, shouldReset) => (dispatch) => {
dispatch(createListRequest());
api().post('/api/v1/lists', { title }).then(({ data }) => {
dispatch(createListSuccess(data));
if (shouldReset) {
dispatch(resetListEditor());
}
}).catch(err => dispatch(createListFail(err)));
};
export const createListRequest = () => ({
type: LIST_CREATE_REQUEST,
});
export const createListSuccess = list => ({
type: LIST_CREATE_SUCCESS,
list,
});
export const createListFail = error => ({
type: LIST_CREATE_FAIL,
error,
});
export const updateList = (id, title, shouldReset, isExclusive, replies_policy) => (dispatch) => {
dispatch(updateListRequest(id));
api().put(`/api/v1/lists/${id}`, { title, replies_policy, exclusive: typeof isExclusive === 'undefined' ? undefined : !!isExclusive }).then(({ data }) => {
dispatch(updateListSuccess(data));
if (shouldReset) {
dispatch(resetListEditor());
}
}).catch(err => dispatch(updateListFail(id, err)));
};
export const updateListRequest = id => ({
type: LIST_UPDATE_REQUEST,
id,
});
export const updateListSuccess = list => ({
type: LIST_UPDATE_SUCCESS,
list,
});
export const updateListFail = (id, error) => ({
type: LIST_UPDATE_FAIL,
id,
error,
});
export const resetListEditor = () => ({
type: LIST_EDITOR_RESET,
});
export const deleteList = id => (dispatch) => {
dispatch(deleteListRequest(id));

4
app/javascript/mastodon/actions/notification_groups.ts

@ -78,10 +78,6 @@ function selectNotificationGroupedTypes(state: RootState) {
return types;
}
export function shouldGroupNotificationType(type: string) {
return supportedGroupedNotificationTypes.includes(type);
}
export const fetchNotifications = createDataLoadingThunk(
'notificationGroups/fetch',
async (_params, { getState }) =>

4
app/javascript/mastodon/components/account/index.tsx

@ -3,7 +3,6 @@ import { useCallback, useMemo } from 'react';
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import { Permalink } from 'react-router-dom';
import MoreHorizIcon from '@/material-icons/400-24px/more_horiz.svg?react';
import {
@ -25,6 +24,7 @@ import { FollowersCounter } from 'mastodon/components/counters';
import { DisplayName } from 'mastodon/components/display_name';
import { Dropdown } from 'mastodon/components/dropdown_menu';
import { FollowButton } from 'mastodon/components/follow_button';
import { Permalink } from 'mastodon/components/permalink';
import { RelativeTimestamp } from 'mastodon/components/relative_timestamp';
import { ShortNumber } from 'mastodon/components/short_number';
import { Skeleton } from 'mastodon/components/skeleton';
@ -296,7 +296,7 @@ export const Account: React.FC<AccountProps> = ({
<Permalink
className='account__display-name'
title={account?.acct}
href={account.get('url')}
href={account?.get('url')}
to={`/@${account?.acct}`}
data-hover-card-account={id}
>

2
app/javascript/mastodon/components/hashtag.tsx

@ -4,12 +4,12 @@ import { Component } from 'react';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import { Link } from 'react-router-dom';
import type Immutable from 'immutable';
import { Sparklines, SparklinesCurve } from 'react-sparklines';
import { Link } from 'react-router-dom';
import { ShortNumber } from 'mastodon/components/short_number';
import { Skeleton } from 'mastodon/components/skeleton';
import type { Hashtag as HashtagType } from 'mastodon/models/tags';

4
app/javascript/mastodon/components/no_alt_text_badge.tsx

@ -8,13 +8,13 @@ import type {
UsePopperOptions,
} from 'react-overlays/esm/usePopper';
import { Icon } from 'mastodon/components/icon';
import WarningIcon from '@/material-icons/400-24px/warning.svg?react';
import { Icon } from 'mastodon/components/icon';
const offset = [0, 4] as OffsetValue;
const popperConfig = { strategy: 'fixed' } as UsePopperOptions;
export const NoAltTextBadge: React.FC<{}> = () => {
export const NoAltTextBadge: React.FC = () => {
const anchorRef = useRef<HTMLButtonElement>(null);
const [open, setOpen] = useState(false);

30
app/javascript/mastodon/features/audio/index.tsx

@ -13,11 +13,11 @@ import PlayArrowIcon from '@/material-icons/400-24px/play_arrow-fill.svg?react';
import Replay5Icon from '@/material-icons/400-24px/replay_5-fill.svg?react';
import VolumeOffIcon from '@/material-icons/400-24px/volume_off-fill.svg?react';
import VolumeUpIcon from '@/material-icons/400-24px/volume_up-fill.svg?react';
import { AltTextBadge } from 'mastodon/components/alt_text_badge';
import { Blurhash } from 'mastodon/components/blurhash';
import { Icon } from 'mastodon/components/icon';
import { SpoilerButton } from 'mastodon/components/spoiler_button';
import { AltTextBadge } from 'mastodon/components/alt_text_badge';
import { NoAltTextBadge } from 'mastodon/components/no_alt_text_badge';
import { SpoilerButton } from 'mastodon/components/spoiler_button';
import { formatTime, getPointerPosition } from 'mastodon/features/video';
import { useAudioContext } from 'mastodon/hooks/useAudioContext';
import { useAudioVisualizer } from 'mastodon/hooks/useAudioVisualizer';
@ -33,6 +33,10 @@ const messages = defineMessages({
hide: { id: 'audio.hide', defaultMessage: 'Hide audio' },
skipForward: { id: 'video.skip_forward', defaultMessage: 'Skip forward' },
skipBackward: { id: 'video.skip_backward', defaultMessage: 'Skip backward' },
no_descriptive_text: {
id: 'media.no_descriptive_text',
defaultMessage: 'No descriptive text was provided for this media.',
},
});
const persistVolume = (volume: number, muted: boolean) => {
@ -810,8 +814,26 @@ export const Audio: React.FC<{
</div>
<div className='video-player__buttons right'>
{alt && <button type='button' title={intl.formatMessage(messages.no_descriptive_text)} aria-label={intl.formatMessage(messages.no_descriptive_text)} className='player-button no-action media__no-description-icon' ><AltTextBadge key='alt' description={alt} /></button>}
{!alt && <button type='button' title={intl.formatMessage(messages.no_descriptive_text)} aria-label={intl.formatMessage(messages.no_descriptive_text)} className='player-button no-action media__no-description-icon' ><NoAltTextBadge key='no-alt' /></button>}
{alt && (
<button
type='button'
title={intl.formatMessage(messages.no_descriptive_text)}
aria-label={intl.formatMessage(messages.no_descriptive_text)}
className='player-button no-action media__no-description-icon'
>
<AltTextBadge key='alt' description={alt} />
</button>
)}
{!alt && (
<button
type='button'
title={intl.formatMessage(messages.no_descriptive_text)}
aria-label={intl.formatMessage(messages.no_descriptive_text)}
className='player-button no-action media__no-description-icon'
>
<NoAltTextBadge key='no-alt' />
</button>
)}
{!editable && (
<>
<button

7
app/javascript/mastodon/features/directory/components/account_card.tsx

@ -10,7 +10,6 @@ import {
unblockAccount,
unmuteAccount,
} from 'mastodon/actions/accounts';
import { openModal } from 'mastodon/actions/modal';
import { Avatar } from 'mastodon/components/avatar';
import { Button } from 'mastodon/components/button';
@ -166,7 +165,11 @@ export const AccountCard: React.FC<{ accountId: string }> = ({ accountId }) => {
return (
<div className='account-card'>
<Permalink href={account.get('url')} to={`/@${account.get('acct')}`} className='account-card__permalink'>
<Permalink
href={account.get('url')}
to={`/@${account.get('acct')}`}
className='account-card__permalink'
>
<div className='account-card__header'>
<img
src={

6
app/javascript/mastodon/features/status/components/detailed_status.tsx

@ -23,8 +23,8 @@ import type { StatusLike } from 'mastodon/components/hashtag_bar';
import { getHashtagBarForStatus } from 'mastodon/components/hashtag_bar';
import { Icon } from 'mastodon/components/icon';
import { IconLogo } from 'mastodon/components/logo';
import { Permalink } from 'mastodon/components/permalink';
import MediaGallery from 'mastodon/components/media_gallery';
import { Permalink } from 'mastodon/components/permalink';
import { PictureInPicturePlaceholder } from 'mastodon/components/picture_in_picture_placeholder';
import StatusContent from 'mastodon/components/status_content';
import { QuotedStatus } from 'mastodon/components/status_quoted';
@ -305,8 +305,8 @@ export const DetailedStatus: React.FC<{
const matchedFilters = status.get('matched_filters');
const expanded =
(!matchedFilters || showDespiteFilter) &&
(!status.get('hidden') || status.get('spoiler_text').length === 0) ||
((!matchedFilters || showDespiteFilter) &&
(!status.get('hidden') || status.get('spoiler_text').length === 0)) ||
statusActivityObjectType === 'Article';
return (

30
app/javascript/mastodon/features/video/index.tsx

@ -17,11 +17,11 @@ import Replay5Icon from '@/material-icons/400-24px/replay_5-fill.svg?react';
import VolumeDownIcon from '@/material-icons/400-24px/volume_down-fill.svg?react';
import VolumeOffIcon from '@/material-icons/400-24px/volume_off-fill.svg?react';
import VolumeUpIcon from '@/material-icons/400-24px/volume_up-fill.svg?react';
import { AltTextBadge } from 'mastodon/components/alt_text_badge';
import { Blurhash } from 'mastodon/components/blurhash';
import { Icon } from 'mastodon/components/icon';
import { SpoilerButton } from 'mastodon/components/spoiler_button';
import { AltTextBadge } from 'mastodon/components/alt_text_badge';
import { NoAltTextBadge } from 'mastodon/components/no_alt_text_badge';
import { SpoilerButton } from 'mastodon/components/spoiler_button';
import {
isFullscreen,
requestFullscreen,
@ -52,6 +52,10 @@ const messages = defineMessages({
volumeDown: { id: 'video.volume_down', defaultMessage: 'Volume down' },
skipForward: { id: 'video.skip_forward', defaultMessage: 'Skip forward' },
skipBackward: { id: 'video.skip_backward', defaultMessage: 'Skip backward' },
no_descriptive_text: {
id: 'media.no_descriptive_text',
defaultMessage: 'No descriptive text was provided for this media.',
},
});
const DOUBLE_CLICK_THRESHOLD = 250;
@ -991,8 +995,26 @@ export const Video: React.FC<{
</div>
<div className='video-player__buttons right'>
{alt && <button type='button' title={intl.formatMessage(messages.no_descriptive_text)} aria-label={intl.formatMessage(messages.no_descriptive_text)} className='player-button no-action media__no-description-icon' ><AltTextBadge key='alt' description={alt} /></button>}
{!alt && <button type='button' title={intl.formatMessage(messages.no_descriptive_text)} aria-label={intl.formatMessage(messages.no_descriptive_text)} className='player-button no-action media__no-description-icon' ><NoAltTextBadge key='no-alt' /></button>}
{alt && (
<button
type='button'
title={intl.formatMessage(messages.no_descriptive_text)}
aria-label={intl.formatMessage(messages.no_descriptive_text)}
className='player-button no-action media__no-description-icon'
>
<AltTextBadge key='alt' description={alt} />
</button>
)}
{!alt && (
<button
type='button'
title={intl.formatMessage(messages.no_descriptive_text)}
aria-label={intl.formatMessage(messages.no_descriptive_text)}
className='player-button no-action media__no-description-icon'
>
<NoAltTextBadge key='no-alt' />
</button>
)}
{!fullscreen && onOpenVideo && (
<button
type='button'

1
app/javascript/mastodon/reducers/notification_groups.ts

@ -21,7 +21,6 @@ import {
unmountNotifications,
refreshStaleNotificationGroups,
pollRecentNotifications,
shouldGroupNotificationType,
} from 'mastodon/actions/notification_groups';
import {
disconnectTimeline,

Loading…
Cancel
Save