logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: 2e112e240666b62b8c3d4fa201fb24b841f6c92b
parent: 812fe90ecaef58f1dbe16c3fdfea79e14e7bbc9d
Author: Yamagishi Kazutoshi <ykzts@desire.sh>
Date:   Sun, 21 May 2017 00:31:47 +0900

Improve eslint rules (#3147)

* Add semi to ESLint rules

* Add padded-blocks to ESLint rules

* Add comma-dangle to ESLint rules

* add config/webpack and storyboard

* add streaming/

* yarn test:lint -- --fix

Diffstat:

M.eslintrc.yml7+++++++
Mapp/javascript/mastodon/actions/accounts.js136++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mapp/javascript/mastodon/actions/alerts.js6+++---
Mapp/javascript/mastodon/actions/blocks.js14+++++++-------
Mapp/javascript/mastodon/actions/cards.js6+++---
Mapp/javascript/mastodon/actions/compose.js54+++++++++++++++++++++++++++---------------------------
Mapp/javascript/mastodon/actions/domain_blocks.js20++++++++++----------
Mapp/javascript/mastodon/actions/favourites.js14+++++++-------
Mapp/javascript/mastodon/actions/interactions.js38+++++++++++++++++++-------------------
Mapp/javascript/mastodon/actions/modal.js4++--
Mapp/javascript/mastodon/actions/mutes.js14+++++++-------
Mapp/javascript/mastodon/actions/notifications.js24++++++++++++------------
Mapp/javascript/mastodon/actions/reports.js14+++++++-------
Mapp/javascript/mastodon/actions/search.js18+++++++++---------
Mapp/javascript/mastodon/actions/settings.js4++--
Mapp/javascript/mastodon/actions/statuses.js30+++++++++++++++---------------
Mapp/javascript/mastodon/actions/store.js2+-
Mapp/javascript/mastodon/actions/timelines.js28++++++++++++++--------------
Mapp/javascript/mastodon/api.js4++--
Mapp/javascript/mastodon/components/account.js6+++---
Mapp/javascript/mastodon/components/attachment_list.js2+-
Mapp/javascript/mastodon/components/autosuggest_textarea.js8++++----
Mapp/javascript/mastodon/components/avatar.js8++++----
Mapp/javascript/mastodon/components/avatar_overlay.js7++++---
Mapp/javascript/mastodon/components/button.js6+++---
Mapp/javascript/mastodon/components/collapsable.js2+-
Mapp/javascript/mastodon/components/column_back_button.js2+-
Mapp/javascript/mastodon/components/column_back_button_slim.js3++-
Mapp/javascript/mastodon/components/column_collapsable.js5+++--
Mapp/javascript/mastodon/components/display_name.js2+-
Mapp/javascript/mastodon/components/dropdown_menu.js6+++---
Mapp/javascript/mastodon/components/extended_video_player.js2+-
Mapp/javascript/mastodon/components/icon_button.js8++++----
Mapp/javascript/mastodon/components/load_more.js2+-
Mapp/javascript/mastodon/components/media_gallery.js8++++----
Mapp/javascript/mastodon/components/permalink.js4++--
Mapp/javascript/mastodon/components/relative_timestamp.js2+-
Mapp/javascript/mastodon/components/status.js4++--
Mapp/javascript/mastodon/components/status_action_bar.js4++--
Mapp/javascript/mastodon/components/status_content.js8++++----
Mapp/javascript/mastodon/components/status_list.js4++--
Mapp/javascript/mastodon/components/video_player.js8++++----
Mapp/javascript/mastodon/containers/account_container.js4++--
Mapp/javascript/mastodon/containers/mastodon.js8++++----
Mapp/javascript/mastodon/containers/status_container.js18+++++++++---------
Mapp/javascript/mastodon/features/account/components/action_bar.js2+-
Mapp/javascript/mastodon/features/account/components/header.js12++++++------
Mapp/javascript/mastodon/features/account_gallery/components/media_item.js3++-
Mapp/javascript/mastodon/features/account_gallery/index.js2+-
Mapp/javascript/mastodon/features/account_timeline/components/header.js2+-
Mapp/javascript/mastodon/features/account_timeline/containers/header_container.js12++++++------
Mapp/javascript/mastodon/features/account_timeline/index.js6+++---
Mapp/javascript/mastodon/features/blocks/index.js7++++---
Mapp/javascript/mastodon/features/community_timeline/index.js10+++++-----
Mapp/javascript/mastodon/features/compose/components/autosuggest_account.js2+-
Mapp/javascript/mastodon/features/compose/components/character_counter.js2+-
Mapp/javascript/mastodon/features/compose/components/compose_form.js2+-
Mapp/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js12++++++------
Mapp/javascript/mastodon/features/compose/components/navigation_bar.js2+-
Mapp/javascript/mastodon/features/compose/components/privacy_dropdown.js12++++++------
Mapp/javascript/mastodon/features/compose/components/reply_indicator.js6+++---
Mapp/javascript/mastodon/features/compose/components/search.js4++--
Mapp/javascript/mastodon/features/compose/components/search_results.js2+-
Mapp/javascript/mastodon/features/compose/components/text_icon_button.js2+-
Mapp/javascript/mastodon/features/compose/components/upload_button.js10+++++-----
Mapp/javascript/mastodon/features/compose/components/upload_form.js4++--
Mapp/javascript/mastodon/features/compose/components/upload_progress.js2+-
Mapp/javascript/mastodon/features/compose/components/warning.js2+-
Mapp/javascript/mastodon/features/compose/containers/autosuggest_account_container.js2+-
Mapp/javascript/mastodon/features/compose/containers/autosuggest_status_container.js2+-
Mapp/javascript/mastodon/features/compose/containers/compose_form_container.js4++--
Mapp/javascript/mastodon/features/compose/containers/navigation_container.js2+-
Mapp/javascript/mastodon/features/compose/containers/privacy_dropdown_container.js4++--
Mapp/javascript/mastodon/features/compose/containers/reply_indicator_container.js2+-
Mapp/javascript/mastodon/features/compose/containers/search_container.js6+++---
Mapp/javascript/mastodon/features/compose/containers/search_results_container.js2+-
Mapp/javascript/mastodon/features/compose/containers/sensitive_button_container.js8++++----
Mapp/javascript/mastodon/features/compose/containers/spoiler_button_container.js6+++---
Mapp/javascript/mastodon/features/compose/containers/upload_button_container.js4++--
Mapp/javascript/mastodon/features/compose/containers/upload_form_container.js2+-
Mapp/javascript/mastodon/features/compose/containers/upload_progress_container.js2+-
Mapp/javascript/mastodon/features/compose/containers/warning_container.js2+-
Mapp/javascript/mastodon/features/compose/index.js6+++---
Mapp/javascript/mastodon/features/favourited_statuses/index.js6+++---
Mapp/javascript/mastodon/features/favourites/index.js4++--
Mapp/javascript/mastodon/features/follow_requests/components/account_authorize.js4++--
Mapp/javascript/mastodon/features/follow_requests/containers/account_authorize_container.js4++--
Mapp/javascript/mastodon/features/follow_requests/index.js6+++---
Mapp/javascript/mastodon/features/followers/index.js6+++---
Mapp/javascript/mastodon/features/following/index.js6+++---
Mapp/javascript/mastodon/features/getting_started/index.js9+++++----
Mapp/javascript/mastodon/features/hashtag_timeline/index.js8++++----
Mapp/javascript/mastodon/features/home_timeline/components/column_settings.js4++--
Mapp/javascript/mastodon/features/home_timeline/components/setting_text.js4++--
Mapp/javascript/mastodon/features/home_timeline/containers/column_settings_container.js4++--
Mapp/javascript/mastodon/features/home_timeline/index.js8++++----
Mapp/javascript/mastodon/features/mutes/index.js6+++---
Mapp/javascript/mastodon/features/notifications/components/clear_column_button.js5+++--
Mapp/javascript/mastodon/features/notifications/components/column_settings.js6+++---
Mapp/javascript/mastodon/features/notifications/components/notification.js2+-
Mapp/javascript/mastodon/features/notifications/components/setting_toggle.js2+-
Mapp/javascript/mastodon/features/notifications/containers/column_settings_container.js4++--
Mapp/javascript/mastodon/features/notifications/containers/notification_container.js2+-
Mapp/javascript/mastodon/features/notifications/index.js12++++++------
Mapp/javascript/mastodon/features/public_timeline/index.js10+++++-----
Mapp/javascript/mastodon/features/reblogs/index.js4++--
Mapp/javascript/mastodon/features/report/components/status_check_box.js2+-
Mapp/javascript/mastodon/features/report/containers/status_check_box_container.js4++--
Mapp/javascript/mastodon/features/report/index.js8++++----
Mapp/javascript/mastodon/features/status/components/action_bar.js4++--
Mapp/javascript/mastodon/features/status/components/card.js7++++---
Mapp/javascript/mastodon/features/status/components/detailed_status.js2+-
Mapp/javascript/mastodon/features/status/containers/card_container.js2+-
Mapp/javascript/mastodon/features/status/index.js18+++++++++---------
Mapp/javascript/mastodon/features/ui/components/boost_modal.js6+++---
Mapp/javascript/mastodon/features/ui/components/column.js6+++---
Mapp/javascript/mastodon/features/ui/components/column_header.js4++--
Mapp/javascript/mastodon/features/ui/components/column_link.js2+-
Mapp/javascript/mastodon/features/ui/components/columns_area.js2+-
Mapp/javascript/mastodon/features/ui/components/confirmation_modal.js2+-
Mapp/javascript/mastodon/features/ui/components/media_modal.js6+++---
Mapp/javascript/mastodon/features/ui/components/modal_root.js6+++---
Mapp/javascript/mastodon/features/ui/components/onboarding_modal.js20++++++++++----------
Mapp/javascript/mastodon/features/ui/components/upload_area.js4++--
Mapp/javascript/mastodon/features/ui/components/video_modal.js4++--
Mapp/javascript/mastodon/features/ui/containers/loading_bar_container.js2+-
Mapp/javascript/mastodon/features/ui/containers/modal_container.js2+-
Mapp/javascript/mastodon/features/ui/containers/notifications_container.js6+++---
Mapp/javascript/mastodon/features/ui/containers/status_list_container.js6+++---
Mapp/javascript/mastodon/features/ui/index.js4++--
Mapp/javascript/mastodon/link_header.js26+++++++++++++-------------
Mapp/javascript/mastodon/locales/locale-data/oc.js62+++++++++++++++++++++++++++++++-------------------------------
Mapp/javascript/mastodon/main.js2+-
Mapp/javascript/mastodon/middleware/sounds.js4++--
Mapp/javascript/mastodon/reducers/accounts.js18+++++++++---------
Mapp/javascript/mastodon/reducers/accounts_counters.js18+++++++++---------
Mapp/javascript/mastodon/reducers/alerts.js4++--
Mapp/javascript/mastodon/reducers/compose.js4++--
Mapp/javascript/mastodon/reducers/index.js2+-
Mapp/javascript/mastodon/reducers/meta.js2+-
Mapp/javascript/mastodon/reducers/modal.js2+-
Mapp/javascript/mastodon/reducers/notifications.js6+++---
Mapp/javascript/mastodon/reducers/relationships.js4++--
Mapp/javascript/mastodon/reducers/reports.js6+++---
Mapp/javascript/mastodon/reducers/search.js20++++++++++----------
Mapp/javascript/mastodon/reducers/settings.js16++++++++--------
Mapp/javascript/mastodon/reducers/status_lists.js6+++---
Mapp/javascript/mastodon/reducers/statuses.js12++++++------
Mapp/javascript/mastodon/reducers/timelines.js18+++++++++---------
Mapp/javascript/mastodon/reducers/user_lists.js12++++++------
Mapp/javascript/mastodon/selectors/index.js6+++---
Mapp/javascript/packs/application.js2+-
Mapp/javascript/packs/public.js4++--
Mconfig/webpack/configuration.js28++++++++++++++--------------
Mconfig/webpack/development.js12++++++------
Mconfig/webpack/development.server.js14+++++++-------
Mconfig/webpack/loaders/assets.js10+++++-----
Mconfig/webpack/loaders/babel.js6+++---
Mconfig/webpack/loaders/coffee.js4++--
Mconfig/webpack/loaders/erb.js6+++---
Mconfig/webpack/loaders/sass.js12++++++------
Mconfig/webpack/production.js20++++++++++----------
Mconfig/webpack/shared.js46+++++++++++++++++++++++-----------------------
Mconfig/webpack/test.js6+++---
Mconfig/webpack/translationRunner.js14+++++++-------
Mpackage.json2+-
Mstorybook/config.js2+-
Mstorybook/stories/autosuggest_textarea.story.js10+++++-----
Mstorybook/webpack.config.js14+++++++-------
Mstreaming/index.js356++++++++++++++++++++++++++++++++++++++++----------------------------------------
170 files changed, 920 insertions(+), 905 deletions(-)

diff --git a/.eslintrc.yml b/.eslintrc.yml @@ -47,6 +47,13 @@ rules: no-mixed-spaces-and-tabs: warn no-nested-ternary: warn no-trailing-spaces: warn + semi: error + padded-blocks: + - error + - classes: always + comma-dangle: + - error + - always-multiline react/jsx-wrap-multilines: error react/jsx-no-bind: error diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/mastodon/actions/accounts.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api' +import api, { getLinks } from '../api'; import Immutable from 'immutable'; export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST'; @@ -154,8 +154,8 @@ export function expandAccountTimeline(id) { api(getState).get(`/api/v1/accounts/${id}/statuses`, { params: { limit: 10, - max_id: lastId - } + max_id: lastId, + }, }).then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); dispatch(expandAccountTimelineSuccess(id, response.data, next)); @@ -175,8 +175,8 @@ export function expandAccountMediaTimeline(id) { params: { limit: 12, only_media: 'true', - max_id: lastId - } + max_id: lastId, + }, }).then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); dispatch(expandAccountMediaTimelineSuccess(id, response.data, next)); @@ -189,14 +189,14 @@ export function expandAccountMediaTimeline(id) { export function fetchAccountRequest(id) { return { type: ACCOUNT_FETCH_REQUEST, - id + id, }; }; export function fetchAccountSuccess(account) { return { type: ACCOUNT_FETCH_SUCCESS, - account + account, }; }; @@ -205,7 +205,7 @@ export function fetchAccountFail(id, error) { type: ACCOUNT_FETCH_FAIL, id, error, - skipAlert: true + skipAlert: true, }; }; @@ -230,48 +230,48 @@ export function unfollowAccount(id) { }).catch(error => { dispatch(unfollowAccountFail(error)); }); - } + }; }; export function followAccountRequest(id) { return { type: ACCOUNT_FOLLOW_REQUEST, - id + id, }; }; export function followAccountSuccess(relationship) { return { type: ACCOUNT_FOLLOW_SUCCESS, - relationship + relationship, }; }; export function followAccountFail(error) { return { type: ACCOUNT_FOLLOW_FAIL, - error + error, }; }; export function unfollowAccountRequest(id) { return { type: ACCOUNT_UNFOLLOW_REQUEST, - id + id, }; }; export function unfollowAccountSuccess(relationship) { return { type: ACCOUNT_UNFOLLOW_SUCCESS, - relationship + relationship, }; }; export function unfollowAccountFail(error) { return { type: ACCOUNT_UNFOLLOW_FAIL, - error + error, }; }; @@ -279,7 +279,7 @@ export function fetchAccountTimelineRequest(id, skipLoading) { return { type: ACCOUNT_TIMELINE_FETCH_REQUEST, id, - skipLoading + skipLoading, }; }; @@ -289,7 +289,7 @@ export function fetchAccountTimelineSuccess(id, statuses, replace, skipLoading) id, statuses, replace, - skipLoading + skipLoading, }; }; @@ -299,7 +299,7 @@ export function fetchAccountTimelineFail(id, error, skipLoading) { id, error, skipLoading, - skipAlert: error.response.status === 404 + skipAlert: error.response.status === 404, }; }; @@ -307,7 +307,7 @@ export function fetchAccountMediaTimelineRequest(id, skipLoading) { return { type: ACCOUNT_MEDIA_TIMELINE_FETCH_REQUEST, id, - skipLoading + skipLoading, }; }; @@ -317,7 +317,7 @@ export function fetchAccountMediaTimelineSuccess(id, statuses, replace, skipLoad id, statuses, replace, - skipLoading + skipLoading, }; }; @@ -327,14 +327,14 @@ export function fetchAccountMediaTimelineFail(id, error, skipLoading) { id, error, skipLoading, - skipAlert: error.response.status === 404 + skipAlert: error.response.status === 404, }; }; export function expandAccountTimelineRequest(id) { return { type: ACCOUNT_TIMELINE_EXPAND_REQUEST, - id + id, }; }; @@ -343,7 +343,7 @@ export function expandAccountTimelineSuccess(id, statuses, next) { type: ACCOUNT_TIMELINE_EXPAND_SUCCESS, id, statuses, - next + next, }; }; @@ -351,14 +351,14 @@ export function expandAccountTimelineFail(id, error) { return { type: ACCOUNT_TIMELINE_EXPAND_FAIL, id, - error + error, }; }; export function expandAccountMediaTimelineRequest(id) { return { type: ACCOUNT_MEDIA_TIMELINE_EXPAND_REQUEST, - id + id, }; }; @@ -367,7 +367,7 @@ export function expandAccountMediaTimelineSuccess(id, statuses, next) { type: ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS, id, statuses, - next + next, }; }; @@ -375,7 +375,7 @@ export function expandAccountMediaTimelineFail(id, error) { return { type: ACCOUNT_MEDIA_TIMELINE_EXPAND_FAIL, id, - error + error, }; }; @@ -407,7 +407,7 @@ export function unblockAccount(id) { export function blockAccountRequest(id) { return { type: ACCOUNT_BLOCK_REQUEST, - id + id, }; }; @@ -415,35 +415,35 @@ export function blockAccountSuccess(relationship, statuses) { return { type: ACCOUNT_BLOCK_SUCCESS, relationship, - statuses + statuses, }; }; export function blockAccountFail(error) { return { type: ACCOUNT_BLOCK_FAIL, - error + error, }; }; export function unblockAccountRequest(id) { return { type: ACCOUNT_UNBLOCK_REQUEST, - id + id, }; }; export function unblockAccountSuccess(relationship) { return { type: ACCOUNT_UNBLOCK_SUCCESS, - relationship + relationship, }; }; export function unblockAccountFail(error) { return { type: ACCOUNT_UNBLOCK_FAIL, - error + error, }; }; @@ -476,7 +476,7 @@ export function unmuteAccount(id) { export function muteAccountRequest(id) { return { type: ACCOUNT_MUTE_REQUEST, - id + id, }; }; @@ -484,35 +484,35 @@ export function muteAccountSuccess(relationship, statuses) { return { type: ACCOUNT_MUTE_SUCCESS, relationship, - statuses + statuses, }; }; export function muteAccountFail(error) { return { type: ACCOUNT_MUTE_FAIL, - error + error, }; }; export function unmuteAccountRequest(id) { return { type: ACCOUNT_UNMUTE_REQUEST, - id + id, }; }; export function unmuteAccountSuccess(relationship) { return { type: ACCOUNT_UNMUTE_SUCCESS, - relationship + relationship, }; }; export function unmuteAccountFail(error) { return { type: ACCOUNT_UNMUTE_FAIL, - error + error, }; }; @@ -535,7 +535,7 @@ export function fetchFollowers(id) { export function fetchFollowersRequest(id) { return { type: FOLLOWERS_FETCH_REQUEST, - id + id, }; }; @@ -544,7 +544,7 @@ export function fetchFollowersSuccess(id, accounts, next) { type: FOLLOWERS_FETCH_SUCCESS, id, accounts, - next + next, }; }; @@ -552,7 +552,7 @@ export function fetchFollowersFail(id, error) { return { type: FOLLOWERS_FETCH_FAIL, id, - error + error, }; }; @@ -580,7 +580,7 @@ export function expandFollowers(id) { export function expandFollowersRequest(id) { return { type: FOLLOWERS_EXPAND_REQUEST, - id + id, }; }; @@ -589,7 +589,7 @@ export function expandFollowersSuccess(id, accounts, next) { type: FOLLOWERS_EXPAND_SUCCESS, id, accounts, - next + next, }; }; @@ -597,7 +597,7 @@ export function expandFollowersFail(id, error) { return { type: FOLLOWERS_EXPAND_FAIL, id, - error + error, }; }; @@ -619,7 +619,7 @@ export function fetchFollowing(id) { export function fetchFollowingRequest(id) { return { type: FOLLOWING_FETCH_REQUEST, - id + id, }; }; @@ -628,7 +628,7 @@ export function fetchFollowingSuccess(id, accounts, next) { type: FOLLOWING_FETCH_SUCCESS, id, accounts, - next + next, }; }; @@ -636,7 +636,7 @@ export function fetchFollowingFail(id, error) { return { type: FOLLOWING_FETCH_FAIL, id, - error + error, }; }; @@ -664,7 +664,7 @@ export function expandFollowing(id) { export function expandFollowingRequest(id) { return { type: FOLLOWING_EXPAND_REQUEST, - id + id, }; }; @@ -673,7 +673,7 @@ export function expandFollowingSuccess(id, accounts, next) { type: FOLLOWING_EXPAND_SUCCESS, id, accounts, - next + next, }; }; @@ -681,7 +681,7 @@ export function expandFollowingFail(id, error) { return { type: FOLLOWING_EXPAND_FAIL, id, - error + error, }; }; @@ -708,7 +708,7 @@ export function fetchRelationshipsRequest(ids) { return { type: RELATIONSHIPS_FETCH_REQUEST, ids, - skipLoading: true + skipLoading: true, }; }; @@ -716,7 +716,7 @@ export function fetchRelationshipsSuccess(relationships) { return { type: RELATIONSHIPS_FETCH_SUCCESS, relationships, - skipLoading: true + skipLoading: true, }; }; @@ -724,7 +724,7 @@ export function fetchRelationshipsFail(error) { return { type: RELATIONSHIPS_FETCH_FAIL, error, - skipLoading: true + skipLoading: true, }; }; @@ -734,14 +734,14 @@ export function fetchFollowRequests() { api(getState).get('/api/v1/follow_requests').then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null)) + dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null)); }).catch(error => dispatch(fetchFollowRequestsFail(error))); }; }; export function fetchFollowRequestsRequest() { return { - type: FOLLOW_REQUESTS_FETCH_REQUEST + type: FOLLOW_REQUESTS_FETCH_REQUEST, }; }; @@ -749,14 +749,14 @@ export function fetchFollowRequestsSuccess(accounts, next) { return { type: FOLLOW_REQUESTS_FETCH_SUCCESS, accounts, - next + next, }; }; export function fetchFollowRequestsFail(error) { return { type: FOLLOW_REQUESTS_FETCH_FAIL, - error + error, }; }; @@ -772,14 +772,14 @@ export function expandFollowRequests() { api(getState).get(url).then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null)) + dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null)); }).catch(error => dispatch(expandFollowRequestsFail(error))); }; }; export function expandFollowRequestsRequest() { return { - type: FOLLOW_REQUESTS_EXPAND_REQUEST + type: FOLLOW_REQUESTS_EXPAND_REQUEST, }; }; @@ -787,14 +787,14 @@ export function expandFollowRequestsSuccess(accounts, next) { return { type: FOLLOW_REQUESTS_EXPAND_SUCCESS, accounts, - next + next, }; }; export function expandFollowRequestsFail(error) { return { type: FOLLOW_REQUESTS_EXPAND_FAIL, - error + error, }; }; @@ -812,14 +812,14 @@ export function authorizeFollowRequest(id) { export function authorizeFollowRequestRequest(id) { return { type: FOLLOW_REQUEST_AUTHORIZE_REQUEST, - id + id, }; }; export function authorizeFollowRequestSuccess(id) { return { type: FOLLOW_REQUEST_AUTHORIZE_SUCCESS, - id + id, }; }; @@ -827,7 +827,7 @@ export function authorizeFollowRequestFail(id, error) { return { type: FOLLOW_REQUEST_AUTHORIZE_FAIL, id, - error + error, }; }; @@ -846,14 +846,14 @@ export function rejectFollowRequest(id) { export function rejectFollowRequestRequest(id) { return { type: FOLLOW_REQUEST_REJECT_REQUEST, - id + id, }; }; export function rejectFollowRequestSuccess(id) { return { type: FOLLOW_REQUEST_REJECT_SUCCESS, - id + id, }; }; @@ -861,6 +861,6 @@ export function rejectFollowRequestFail(id, error) { return { type: FOLLOW_REQUEST_REJECT_FAIL, id, - error + error, }; }; diff --git a/app/javascript/mastodon/actions/alerts.js b/app/javascript/mastodon/actions/alerts.js @@ -5,13 +5,13 @@ export const ALERT_CLEAR = 'ALERT_CLEAR'; export function dismissAlert(alert) { return { type: ALERT_DISMISS, - alert + alert, }; }; export function clearAlert() { return { - type: ALERT_CLEAR + type: ALERT_CLEAR, }; }; @@ -19,6 +19,6 @@ export function showAlert(title, message) { return { type: ALERT_SHOW, title, - message + message, }; }; diff --git a/app/javascript/mastodon/actions/blocks.js b/app/javascript/mastodon/actions/blocks.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api' +import api, { getLinks } from '../api'; import { fetchRelationships } from './accounts'; export const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST'; @@ -23,7 +23,7 @@ export function fetchBlocks() { export function fetchBlocksRequest() { return { - type: BLOCKS_FETCH_REQUEST + type: BLOCKS_FETCH_REQUEST, }; }; @@ -31,14 +31,14 @@ export function fetchBlocksSuccess(accounts, next) { return { type: BLOCKS_FETCH_SUCCESS, accounts, - next + next, }; }; export function fetchBlocksFail(error) { return { type: BLOCKS_FETCH_FAIL, - error + error, }; }; @@ -62,7 +62,7 @@ export function expandBlocks() { export function expandBlocksRequest() { return { - type: BLOCKS_EXPAND_REQUEST + type: BLOCKS_EXPAND_REQUEST, }; }; @@ -70,13 +70,13 @@ export function expandBlocksSuccess(accounts, next) { return { type: BLOCKS_EXPAND_SUCCESS, accounts, - next + next, }; }; export function expandBlocksFail(error) { return { type: BLOCKS_EXPAND_FAIL, - error + error, }; }; diff --git a/app/javascript/mastodon/actions/cards.js b/app/javascript/mastodon/actions/cards.js @@ -28,7 +28,7 @@ export function fetchStatusCardRequest(id) { return { type: STATUS_CARD_FETCH_REQUEST, id, - skipLoading: true + skipLoading: true, }; }; @@ -37,7 +37,7 @@ export function fetchStatusCardSuccess(id, card) { type: STATUS_CARD_FETCH_SUCCESS, id, card, - skipLoading: true + skipLoading: true, }; }; @@ -47,6 +47,6 @@ export function fetchStatusCardFail(id, error) { id, error, skipLoading: true, - skipAlert: true + skipAlert: true, }; }; diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js @@ -35,7 +35,7 @@ export const COMPOSE_EMOJI_INSERT = 'COMPOSE_EMOJI_INSERT'; export function changeCompose(text) { return { type: COMPOSE_CHANGE, - text: text + text: text, }; }; @@ -43,7 +43,7 @@ export function replyCompose(status, router) { return (dispatch, getState) => { dispatch({ type: COMPOSE_REPLY, - status: status + status: status, }); if (!getState().getIn(['compose', 'mounted'])) { @@ -54,7 +54,7 @@ export function replyCompose(status, router) { export function cancelReplyCompose() { return { - type: COMPOSE_REPLY_CANCEL + type: COMPOSE_REPLY_CANCEL, }; }; @@ -62,7 +62,7 @@ export function mentionCompose(account, router) { return (dispatch, getState) => { dispatch({ type: COMPOSE_MENTION, - account: account + account: account, }); if (!getState().getIn(['compose', 'mounted'])) { @@ -84,11 +84,11 @@ export function submitCompose() { media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')), sensitive: getState().getIn(['compose', 'sensitive']), spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''), - visibility: getState().getIn(['compose', 'privacy']) + visibility: getState().getIn(['compose', 'privacy']), }, { headers: { - 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']) - } + 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), + }, }).then(function (response) { dispatch(submitComposeSuccess({ ...response.data })); @@ -112,21 +112,21 @@ export function submitCompose() { export function submitComposeRequest() { return { - type: COMPOSE_SUBMIT_REQUEST + type: COMPOSE_SUBMIT_REQUEST, }; }; export function submitComposeSuccess(status) { return { type: COMPOSE_SUBMIT_SUCCESS, - status: status + status: status, }; }; export function submitComposeFail(error) { return { type: COMPOSE_SUBMIT_FAIL, - error: error + error: error, }; }; @@ -144,7 +144,7 @@ export function uploadCompose(files) { api(getState).post('/api/v1/media', data, { onUploadProgress: function (e) { dispatch(uploadComposeProgress(e.loaded, e.total)); - } + }, }).then(function (response) { dispatch(uploadComposeSuccess(response.data)); }).catch(function (error) { @@ -156,7 +156,7 @@ export function uploadCompose(files) { export function uploadComposeRequest() { return { type: COMPOSE_UPLOAD_REQUEST, - skipLoading: true + skipLoading: true, }; }; @@ -164,7 +164,7 @@ export function uploadComposeProgress(loaded, total) { return { type: COMPOSE_UPLOAD_PROGRESS, loaded: loaded, - total: total + total: total, }; }; @@ -172,7 +172,7 @@ export function uploadComposeSuccess(media) { return { type: COMPOSE_UPLOAD_SUCCESS, media: media, - skipLoading: true + skipLoading: true, }; }; @@ -180,20 +180,20 @@ export function uploadComposeFail(error) { return { type: COMPOSE_UPLOAD_FAIL, error: error, - skipLoading: true + skipLoading: true, }; }; export function undoUploadCompose(media_id) { return { type: COMPOSE_UPLOAD_UNDO, - media_id: media_id + media_id: media_id, }; }; export function clearComposeSuggestions() { return { - type: COMPOSE_SUGGESTIONS_CLEAR + type: COMPOSE_SUGGESTIONS_CLEAR, }; }; @@ -203,8 +203,8 @@ export function fetchComposeSuggestions(token) { params: { q: token, resolve: false, - limit: 4 - } + limit: 4, + }, }).then(response => { dispatch(readyComposeSuggestions(token, response.data)); }); @@ -215,7 +215,7 @@ export function readyComposeSuggestions(token, accounts) { return { type: COMPOSE_SUGGESTIONS_READY, token, - accounts + accounts, }; }; @@ -227,20 +227,20 @@ export function selectComposeSuggestion(position, token, accountId) { type: COMPOSE_SUGGESTION_SELECT, position, token, - completion + completion, }); }; }; export function mountCompose() { return { - type: COMPOSE_MOUNT + type: COMPOSE_MOUNT, }; }; export function unmountCompose() { return { - type: COMPOSE_UNMOUNT + type: COMPOSE_UNMOUNT, }; }; @@ -252,21 +252,21 @@ export function changeComposeSensitivity() { export function changeComposeSpoilerness() { return { - type: COMPOSE_SPOILERNESS_CHANGE + type: COMPOSE_SPOILERNESS_CHANGE, }; }; export function changeComposeSpoilerText(text) { return { type: COMPOSE_SPOILER_TEXT_CHANGE, - text + text, }; }; export function changeComposeVisibility(value) { return { type: COMPOSE_VISIBILITY_CHANGE, - value + value, }; }; @@ -274,6 +274,6 @@ export function insertEmojiCompose(position, emoji) { return { type: COMPOSE_EMOJI_INSERT, position, - emoji + emoji, }; }; diff --git a/app/javascript/mastodon/actions/domain_blocks.js b/app/javascript/mastodon/actions/domain_blocks.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api' +import api, { getLinks } from '../api'; export const DOMAIN_BLOCK_REQUEST = 'DOMAIN_BLOCK_REQUEST'; export const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS'; @@ -27,7 +27,7 @@ export function blockDomain(domain, accountId) { export function blockDomainRequest(domain) { return { type: DOMAIN_BLOCK_REQUEST, - domain + domain, }; }; @@ -35,7 +35,7 @@ export function blockDomainSuccess(domain, accountId) { return { type: DOMAIN_BLOCK_SUCCESS, domain, - accountId + accountId, }; }; @@ -43,7 +43,7 @@ export function blockDomainFail(domain, error) { return { type: DOMAIN_BLOCK_FAIL, domain, - error + error, }; }; @@ -62,7 +62,7 @@ export function unblockDomain(domain, accountId) { export function unblockDomainRequest(domain) { return { type: DOMAIN_UNBLOCK_REQUEST, - domain + domain, }; }; @@ -70,7 +70,7 @@ export function unblockDomainSuccess(domain, accountId) { return { type: DOMAIN_UNBLOCK_SUCCESS, domain, - accountId + accountId, }; }; @@ -78,7 +78,7 @@ export function unblockDomainFail(domain, error) { return { type: DOMAIN_UNBLOCK_FAIL, domain, - error + error, }; }; @@ -97,7 +97,7 @@ export function fetchDomainBlocks() { export function fetchDomainBlocksRequest() { return { - type: DOMAIN_BLOCKS_FETCH_REQUEST + type: DOMAIN_BLOCKS_FETCH_REQUEST, }; }; @@ -105,13 +105,13 @@ export function fetchDomainBlocksSuccess(domains, next) { return { type: DOMAIN_BLOCKS_FETCH_SUCCESS, domains, - next + next, }; }; export function fetchDomainBlocksFail(error) { return { type: DOMAIN_BLOCKS_FETCH_FAIL, - error + error, }; }; diff --git a/app/javascript/mastodon/actions/favourites.js b/app/javascript/mastodon/actions/favourites.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api' +import api, { getLinks } from '../api'; export const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST'; export const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS'; @@ -23,7 +23,7 @@ export function fetchFavouritedStatuses() { export function fetchFavouritedStatusesRequest() { return { - type: FAVOURITED_STATUSES_FETCH_REQUEST + type: FAVOURITED_STATUSES_FETCH_REQUEST, }; }; @@ -31,14 +31,14 @@ export function fetchFavouritedStatusesSuccess(statuses, next) { return { type: FAVOURITED_STATUSES_FETCH_SUCCESS, statuses, - next + next, }; }; export function fetchFavouritedStatusesFail(error) { return { type: FAVOURITED_STATUSES_FETCH_FAIL, - error + error, }; }; @@ -63,7 +63,7 @@ export function expandFavouritedStatuses() { export function expandFavouritedStatusesRequest() { return { - type: FAVOURITED_STATUSES_EXPAND_REQUEST + type: FAVOURITED_STATUSES_EXPAND_REQUEST, }; }; @@ -71,13 +71,13 @@ export function expandFavouritedStatusesSuccess(statuses, next) { return { type: FAVOURITED_STATUSES_EXPAND_SUCCESS, statuses, - next + next, }; }; export function expandFavouritedStatusesFail(error) { return { type: FAVOURITED_STATUSES_EXPAND_FAIL, - error + error, }; }; diff --git a/app/javascript/mastodon/actions/interactions.js b/app/javascript/mastodon/actions/interactions.js @@ -1,4 +1,4 @@ -import api from '../api' +import api from '../api'; export const REBLOG_REQUEST = 'REBLOG_REQUEST'; export const REBLOG_SUCCESS = 'REBLOG_SUCCESS'; @@ -53,7 +53,7 @@ export function unreblog(status) { export function reblogRequest(status) { return { type: REBLOG_REQUEST, - status: status + status: status, }; }; @@ -61,7 +61,7 @@ export function reblogSuccess(status, response) { return { type: REBLOG_SUCCESS, status: status, - response: response + response: response, }; }; @@ -69,14 +69,14 @@ export function reblogFail(status, error) { return { type: REBLOG_FAIL, status: status, - error: error + error: error, }; }; export function unreblogRequest(status) { return { type: UNREBLOG_REQUEST, - status: status + status: status, }; }; @@ -84,7 +84,7 @@ export function unreblogSuccess(status, response) { return { type: UNREBLOG_SUCCESS, status: status, - response: response + response: response, }; }; @@ -92,7 +92,7 @@ export function unreblogFail(status, error) { return { type: UNREBLOG_FAIL, status: status, - error: error + error: error, }; }; @@ -123,7 +123,7 @@ export function unfavourite(status) { export function favouriteRequest(status) { return { type: FAVOURITE_REQUEST, - status: status + status: status, }; }; @@ -131,7 +131,7 @@ export function favouriteSuccess(status, response) { return { type: FAVOURITE_SUCCESS, status: status, - response: response + response: response, }; }; @@ -139,14 +139,14 @@ export function favouriteFail(status, error) { return { type: FAVOURITE_FAIL, status: status, - error: error + error: error, }; }; export function unfavouriteRequest(status) { return { type: UNFAVOURITE_REQUEST, - status: status + status: status, }; }; @@ -154,7 +154,7 @@ export function unfavouriteSuccess(status, response) { return { type: UNFAVOURITE_SUCCESS, status: status, - response: response + response: response, }; }; @@ -162,7 +162,7 @@ export function unfavouriteFail(status, error) { return { type: UNFAVOURITE_FAIL, status: status, - error: error + error: error, }; }; @@ -181,7 +181,7 @@ export function fetchReblogs(id) { export function fetchReblogsRequest(id) { return { type: REBLOGS_FETCH_REQUEST, - id + id, }; }; @@ -189,14 +189,14 @@ export function fetchReblogsSuccess(id, accounts) { return { type: REBLOGS_FETCH_SUCCESS, id, - accounts + accounts, }; }; export function fetchReblogsFail(id, error) { return { type: REBLOGS_FETCH_FAIL, - error + error, }; }; @@ -215,7 +215,7 @@ export function fetchFavourites(id) { export function fetchFavouritesRequest(id) { return { type: FAVOURITES_FETCH_REQUEST, - id + id, }; }; @@ -223,13 +223,13 @@ export function fetchFavouritesSuccess(id, accounts) { return { type: FAVOURITES_FETCH_SUCCESS, id, - accounts + accounts, }; }; export function fetchFavouritesFail(id, error) { return { type: FAVOURITES_FETCH_FAIL, - error + error, }; }; diff --git a/app/javascript/mastodon/actions/modal.js b/app/javascript/mastodon/actions/modal.js @@ -5,12 +5,12 @@ export function openModal(type, props) { return { type: MODAL_OPEN, modalType: type, - modalProps: props + modalProps: props, }; }; export function closeModal() { return { - type: MODAL_CLOSE + type: MODAL_CLOSE, }; }; diff --git a/app/javascript/mastodon/actions/mutes.js b/app/javascript/mastodon/actions/mutes.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api' +import api, { getLinks } from '../api'; import { fetchRelationships } from './accounts'; export const MUTES_FETCH_REQUEST = 'MUTES_FETCH_REQUEST'; @@ -23,7 +23,7 @@ export function fetchMutes() { export function fetchMutesRequest() { return { - type: MUTES_FETCH_REQUEST + type: MUTES_FETCH_REQUEST, }; }; @@ -31,14 +31,14 @@ export function fetchMutesSuccess(accounts, next) { return { type: MUTES_FETCH_SUCCESS, accounts, - next + next, }; }; export function fetchMutesFail(error) { return { type: MUTES_FETCH_FAIL, - error + error, }; }; @@ -62,7 +62,7 @@ export function expandMutes() { export function expandMutesRequest() { return { - type: MUTES_EXPAND_REQUEST + type: MUTES_EXPAND_REQUEST, }; }; @@ -70,13 +70,13 @@ export function expandMutesSuccess(accounts, next) { return { type: MUTES_EXPAND_SUCCESS, accounts, - next + next, }; }; export function expandMutesFail(error) { return { type: MUTES_EXPAND_FAIL, - error + error, }; }; diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api' +import api, { getLinks } from '../api'; import Immutable from 'immutable'; import IntlMessageFormat from 'intl-messageformat'; import { fetchRelationships } from './accounts'; @@ -33,7 +33,7 @@ const unescapeHTML = (html) => { const wrapper = document.createElement('div'); wrapper.innerHTML = html; return wrapper.textContent; -} +}; export function updateNotifications(notification, intlMessages, intlLocale) { return (dispatch, getState) => { @@ -45,7 +45,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) { notification, account: notification.account, status: notification.status, - meta: playSound ? { sound: 'boop' } : undefined + meta: playSound ? { sound: 'boop' } : undefined, }); fetchRelatedRelationships(dispatch, [notification]); @@ -99,7 +99,7 @@ export function refreshNotifications() { export function refreshNotificationsRequest(skipLoading) { return { type: NOTIFICATIONS_REFRESH_REQUEST, - skipLoading + skipLoading, }; }; @@ -110,7 +110,7 @@ export function refreshNotificationsSuccess(notifications, skipLoading, next) { accounts: notifications.map(item => item.account), statuses: notifications.map(item => item.status).filter(status => !!status), skipLoading, - next + next, }; }; @@ -118,7 +118,7 @@ export function refreshNotificationsFail(error, skipLoading) { return { type: NOTIFICATIONS_REFRESH_FAIL, error, - skipLoading + skipLoading, }; }; @@ -135,7 +135,7 @@ export function expandNotifications() { const params = { max_id: lastId, - limit: 20 + limit: 20, }; params.exclude_types = excludeTypesFromSettings(getState()); @@ -153,7 +153,7 @@ export function expandNotifications() { export function expandNotificationsRequest() { return { - type: NOTIFICATIONS_EXPAND_REQUEST + type: NOTIFICATIONS_EXPAND_REQUEST, }; }; @@ -163,21 +163,21 @@ export function expandNotificationsSuccess(notifications, next) { notifications, accounts: notifications.map(item => item.account), statuses: notifications.map(item => item.status).filter(status => !!status), - next + next, }; }; export function expandNotificationsFail(error) { return { type: NOTIFICATIONS_EXPAND_FAIL, - error + error, }; }; export function clearNotifications() { return (dispatch, getState) => { dispatch({ - type: NOTIFICATIONS_CLEAR + type: NOTIFICATIONS_CLEAR, }); api(getState).post('/api/v1/notifications/clear'); @@ -187,6 +187,6 @@ export function clearNotifications() { export function scrollTopNotifications(top) { return { type: NOTIFICATIONS_SCROLL_TOP, - top + top, }; }; diff --git a/app/javascript/mastodon/actions/reports.js b/app/javascript/mastodon/actions/reports.js @@ -14,13 +14,13 @@ export function initReport(account, status) { return { type: REPORT_INIT, account, - status + status, }; }; export function cancelReport() { return { - type: REPORT_CANCEL + type: REPORT_CANCEL, }; }; @@ -39,34 +39,34 @@ export function submitReport() { api(getState).post('/api/v1/reports', { account_id: getState().getIn(['reports', 'new', 'account_id']), status_ids: getState().getIn(['reports', 'new', 'status_ids']), - comment: getState().getIn(['reports', 'new', 'comment']) + comment: getState().getIn(['reports', 'new', 'comment']), }).then(response => dispatch(submitReportSuccess(response.data))).catch(error => dispatch(submitReportFail(error))); }; }; export function submitReportRequest() { return { - type: REPORT_SUBMIT_REQUEST + type: REPORT_SUBMIT_REQUEST, }; }; export function submitReportSuccess(report) { return { type: REPORT_SUBMIT_SUCCESS, - report + report, }; }; export function submitReportFail(error) { return { type: REPORT_SUBMIT_FAIL, - error + error, }; }; export function changeReportComment(comment) { return { type: REPORT_COMMENT_CHANGE, - comment + comment, }; }; diff --git a/app/javascript/mastodon/actions/search.js b/app/javascript/mastodon/actions/search.js @@ -1,4 +1,4 @@ -import api from '../api' +import api from '../api'; export const SEARCH_CHANGE = 'SEARCH_CHANGE'; export const SEARCH_CLEAR = 'SEARCH_CLEAR'; @@ -11,13 +11,13 @@ export const SEARCH_FETCH_FAIL = 'SEARCH_FETCH_FAIL'; export function changeSearch(value) { return { type: SEARCH_CHANGE, - value + value, }; }; export function clearSearch() { return { - type: SEARCH_CLEAR + type: SEARCH_CLEAR, }; }; @@ -34,8 +34,8 @@ export function submitSearch() { api(getState).get('/api/v1/search', { params: { q: value, - resolve: true - } + resolve: true, + }, }).then(response => { dispatch(fetchSearchSuccess(response.data)); }).catch(error => { @@ -46,7 +46,7 @@ export function submitSearch() { export function fetchSearchRequest() { return { - type: SEARCH_FETCH_REQUEST + type: SEARCH_FETCH_REQUEST, }; }; @@ -55,19 +55,19 @@ export function fetchSearchSuccess(results) { type: SEARCH_FETCH_SUCCESS, results, accounts: results.accounts, - statuses: results.statuses + statuses: results.statuses, }; }; export function fetchSearchFail(error) { return { type: SEARCH_FETCH_FAIL, - error + error, }; }; export function showSearch() { return { - type: SEARCH_SHOW + type: SEARCH_SHOW, }; }; diff --git a/app/javascript/mastodon/actions/settings.js b/app/javascript/mastodon/actions/settings.js @@ -6,14 +6,14 @@ export function changeSetting(key, value) { return { type: SETTING_CHANGE, key, - value + value, }; }; export function saveSettings() { return (_, getState) => { axios.put('/api/web/settings', { - data: getState().get('settings').toJS() + data: getState().get('settings').toJS(), }); }; }; diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js @@ -27,7 +27,7 @@ export function fetchStatusRequest(id, skipLoading) { return { type: STATUS_FETCH_REQUEST, id, - skipLoading + skipLoading, }; }; @@ -56,7 +56,7 @@ export function fetchStatusSuccess(status, skipLoading) { return { type: STATUS_FETCH_SUCCESS, status, - skipLoading + skipLoading, }; }; @@ -66,7 +66,7 @@ export function fetchStatusFail(id, error, skipLoading) { id, error, skipLoading, - skipAlert: true + skipAlert: true, }; }; @@ -86,14 +86,14 @@ export function deleteStatus(id) { export function deleteStatusRequest(id) { return { type: STATUS_DELETE_REQUEST, - id: id + id: id, }; }; export function deleteStatusSuccess(id) { return { type: STATUS_DELETE_SUCCESS, - id: id + id: id, }; }; @@ -101,7 +101,7 @@ export function deleteStatusFail(id, error) { return { type: STATUS_DELETE_FAIL, id: id, - error: error + error: error, }; }; @@ -125,7 +125,7 @@ export function fetchContext(id) { export function fetchContextRequest(id) { return { type: CONTEXT_FETCH_REQUEST, - id + id, }; }; @@ -135,7 +135,7 @@ export function fetchContextSuccess(id, ancestors, descendants) { id, ancestors, descendants, - statuses: ancestors.concat(descendants) + statuses: ancestors.concat(descendants), }; }; @@ -144,7 +144,7 @@ export function fetchContextFail(id, error) { type: CONTEXT_FETCH_FAIL, id, error, - skipAlert: true + skipAlert: true, }; }; @@ -163,14 +163,14 @@ export function muteStatus(id) { export function muteStatusRequest(id) { return { type: STATUS_MUTE_REQUEST, - id + id, }; }; export function muteStatusSuccess(id) { return { type: STATUS_MUTE_SUCCESS, - id + id, }; }; @@ -178,7 +178,7 @@ export function muteStatusFail(id, error) { return { type: STATUS_MUTE_FAIL, id, - error + error, }; }; @@ -197,14 +197,14 @@ export function unmuteStatus(id) { export function unmuteStatusRequest(id) { return { type: STATUS_UNMUTE_REQUEST, - id + id, }; }; export function unmuteStatusSuccess(id) { return { type: STATUS_UNMUTE_SUCCESS, - id + id, }; }; @@ -212,6 +212,6 @@ export function unmuteStatusFail(id, error) { return { type: STATUS_UNMUTE_FAIL, id, - error + error, }; }; diff --git a/app/javascript/mastodon/actions/store.js b/app/javascript/mastodon/actions/store.js @@ -12,6 +12,6 @@ export function hydrateStore(rawState) { return { type: STORE_HYDRATE, - state + state, }; }; diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api' +import api, { getLinks } from '../api'; import Immutable from 'immutable'; export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; @@ -23,7 +23,7 @@ export function refreshTimelineSuccess(timeline, statuses, skipLoading, next) { timeline, statuses, skipLoading, - next + next, }; }; @@ -35,7 +35,7 @@ export function updateTimeline(timeline, status) { type: TIMELINE_UPDATE, timeline, status, - references + references, }); }; }; @@ -51,7 +51,7 @@ export function deleteFromTimelines(id) { id, accountId, references, - reblogOf + reblogOf, }); }; }; @@ -61,7 +61,7 @@ export function refreshTimelineRequest(timeline, id, skipLoading) { type: TIMELINE_REFRESH_REQUEST, timeline, id, - skipLoading + skipLoading, }; }; @@ -106,7 +106,7 @@ export function refreshTimelineFail(timeline, error, skipLoading) { type: TIMELINE_REFRESH_FAIL, timeline, error, - skipLoading + skipLoading, }; }; @@ -130,8 +130,8 @@ export function expandTimeline(timeline) { params: { ...params, max_id: lastId, - limit: 10 - } + limit: 10, + }, }).then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); dispatch(expandTimelineSuccess(timeline, response.data, next ? next.uri : null)); @@ -144,7 +144,7 @@ export function expandTimeline(timeline) { export function expandTimelineRequest(timeline) { return { type: TIMELINE_EXPAND_REQUEST, - timeline + timeline, }; }; @@ -153,7 +153,7 @@ export function expandTimelineSuccess(timeline, statuses, next) { type: TIMELINE_EXPAND_SUCCESS, timeline, statuses, - next + next, }; }; @@ -161,7 +161,7 @@ export function expandTimelineFail(timeline, error) { return { type: TIMELINE_EXPAND_FAIL, timeline, - error + error, }; }; @@ -169,20 +169,20 @@ export function scrollTopTimeline(timeline, top) { return { type: TIMELINE_SCROLL_TOP, timeline, - top + top, }; }; export function connectTimeline(timeline) { return { type: TIMELINE_CONNECT, - timeline + timeline, }; }; export function disconnectTimeline(timeline) { return { type: TIMELINE_DISCONNECT, - timeline + timeline, }; }; diff --git a/app/javascript/mastodon/api.js b/app/javascript/mastodon/api.js @@ -13,7 +13,7 @@ export const getLinks = response => { export default getState => axios.create({ headers: { - 'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}` + 'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`, }, transformResponse: [function (data) { @@ -22,5 +22,5 @@ export default getState => axios.create({ } catch(Exception) { return data; } - }] + }], }); diff --git a/app/javascript/mastodon/components/account.js b/app/javascript/mastodon/components/account.js @@ -13,7 +13,7 @@ const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' }, unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' }, - unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' } + unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' }, }); class Account extends ImmutablePureComponent { @@ -24,7 +24,7 @@ class Account extends ImmutablePureComponent { onFollow: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired, onMute: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; constructor (props, context) { @@ -62,7 +62,7 @@ class Account extends ImmutablePureComponent { const muting = account.getIn(['relationship', 'muting']); if (requested) { - buttons = <IconButton disabled={true} icon='hourglass' title={intl.formatMessage(messages.requested)} /> + buttons = <IconButton disabled={true} icon='hourglass' title={intl.formatMessage(messages.requested)} />; } else if (blocking) { buttons = <IconButton active={true} icon='unlock-alt' title={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.handleBlock} />; } else if (muting) { diff --git a/app/javascript/mastodon/components/attachment_list.js b/app/javascript/mastodon/components/attachment_list.js @@ -6,7 +6,7 @@ const filename = url => url.split('/').pop().split('#')[0].split('?')[0]; class AttachmentList extends React.PureComponent { static propTypes = { - media: ImmutablePropTypes.list.isRequired + media: ImmutablePropTypes.list.isRequired, }; render () { diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js @@ -44,11 +44,11 @@ class AutosuggestTextarea extends ImmutablePureComponent { onKeyUp: PropTypes.func, onKeyDown: PropTypes.func, onPaste: PropTypes.func.isRequired, - autoFocus: PropTypes.bool + autoFocus: PropTypes.bool, }; static defaultProps = { - autoFocus: true + autoFocus: true, }; constructor (props, context) { @@ -57,7 +57,7 @@ class AutosuggestTextarea extends ImmutablePureComponent { suggestionsHidden: false, selectedSuggestion: 0, lastToken: null, - tokenStart: 0 + tokenStart: 0, }; this.onChange = this.onChange.bind(this); this.onKeyDown = this.onKeyDown.bind(this); @@ -164,7 +164,7 @@ class AutosuggestTextarea extends ImmutablePureComponent { onPaste (e) { if (e.clipboardData && e.clipboardData.files.length === 1) { - this.props.onPaste(e.clipboardData.files) + this.props.onPaste(e.clipboardData.files); e.preventDefault(); } } diff --git a/app/javascript/mastodon/components/avatar.js b/app/javascript/mastodon/components/avatar.js @@ -9,17 +9,17 @@ class Avatar extends React.PureComponent { size: PropTypes.number.isRequired, style: PropTypes.object, animate: PropTypes.bool, - inline: PropTypes.bool + inline: PropTypes.bool, }; static defaultProps = { animate: false, size: 20, - inline: false + inline: false, }; state = { - hovering: true + hovering: true, }; handleMouseEnter = () => { @@ -46,7 +46,7 @@ class Avatar extends React.PureComponent { ...this.props.style, width: `${size}px`, height: `${size}px`, - backgroundSize: `${size}px ${size}px` + backgroundSize: `${size}px ${size}px`, }; if (hovering || animate) { diff --git a/app/javascript/mastodon/components/avatar_overlay.js b/app/javascript/mastodon/components/avatar_overlay.js @@ -2,20 +2,21 @@ import React from 'react'; import PropTypes from 'prop-types'; class AvatarOverlay extends React.PureComponent { + static propTypes = { staticSrc: PropTypes.string.isRequired, - overlaySrc: PropTypes.string.isRequired + overlaySrc: PropTypes.string.isRequired, }; render() { const {staticSrc, overlaySrc} = this.props; const baseStyle = { - backgroundImage: `url(${staticSrc})` + backgroundImage: `url(${staticSrc})`, }; const overlayStyle = { - backgroundImage: `url(${overlaySrc})` + backgroundImage: `url(${overlaySrc})`, }; return ( diff --git a/app/javascript/mastodon/components/button.js b/app/javascript/mastodon/components/button.js @@ -11,11 +11,11 @@ class Button extends React.PureComponent { secondary: PropTypes.bool, size: PropTypes.number, style: PropTypes.object, - children: PropTypes.node + children: PropTypes.node, }; static defaultProps = { - size: 36 + size: 36, }; handleClick = (e) => { @@ -29,7 +29,7 @@ class Button extends React.PureComponent { padding: `0 ${this.props.size / 2.25}px`, height: `${this.props.size}px`, lineHeight: `${this.props.size}px`, - ...this.props.style + ...this.props.style, }; return ( diff --git a/app/javascript/mastodon/components/collapsable.js b/app/javascript/mastodon/components/collapsable.js @@ -16,7 +16,7 @@ const Collapsable = ({ fullHeight, isVisible, children }) => ( Collapsable.propTypes = { fullHeight: PropTypes.number.isRequired, isVisible: PropTypes.bool.isRequired, - children: PropTypes.node.isRequired + children: PropTypes.node.isRequired, }; export default Collapsable; diff --git a/app/javascript/mastodon/components/column_back_button.js b/app/javascript/mastodon/components/column_back_button.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; class ColumnBackButton extends React.PureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; handleClick = () => { diff --git a/app/javascript/mastodon/components/column_back_button_slim.js b/app/javascript/mastodon/components/column_back_button_slim.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; class ColumnBackButtonSlim extends React.PureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; handleClick = () => { @@ -22,6 +22,7 @@ class ColumnBackButtonSlim extends React.PureComponent { </div> ); } + } export default ColumnBackButtonSlim; diff --git a/app/javascript/mastodon/components/column_collapsable.js b/app/javascript/mastodon/components/column_collapsable.js @@ -8,11 +8,11 @@ class ColumnCollapsable extends React.PureComponent { title: PropTypes.string, fullHeight: PropTypes.number.isRequired, children: PropTypes.node, - onCollapse: PropTypes.func + onCollapse: PropTypes.func, }; state = { - collapsed: true + collapsed: true, }; handleToggleCollapsed = () => { @@ -41,6 +41,7 @@ class ColumnCollapsable extends React.PureComponent { </div> ); } + } export default ColumnCollapsable; diff --git a/app/javascript/mastodon/components/display_name.js b/app/javascript/mastodon/components/display_name.js @@ -6,7 +6,7 @@ import emojify from '../emoji'; class DisplayName extends React.PureComponent { static propTypes = { - account: ImmutablePropTypes.map.isRequired + account: ImmutablePropTypes.map.isRequired, }; render () { diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; class DropdownMenu extends React.PureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { @@ -13,11 +13,11 @@ class DropdownMenu extends React.PureComponent { items: PropTypes.array.isRequired, size: PropTypes.number.isRequired, direction: PropTypes.string, - ariaLabel: PropTypes.string + ariaLabel: PropTypes.string, }; static defaultProps = { - ariaLabel: "Menu" + ariaLabel: "Menu", }; state = { diff --git a/app/javascript/mastodon/components/extended_video_player.js b/app/javascript/mastodon/components/extended_video_player.js @@ -7,7 +7,7 @@ class ExtendedVideoPlayer extends React.PureComponent { src: PropTypes.string.isRequired, time: PropTypes.number, controls: PropTypes.bool.isRequired, - muted: PropTypes.bool.isRequired + muted: PropTypes.bool.isRequired, }; handleLoadedData = () => { diff --git a/app/javascript/mastodon/components/icon_button.js b/app/javascript/mastodon/components/icon_button.js @@ -17,7 +17,7 @@ class IconButton extends React.PureComponent { disabled: PropTypes.bool, inverted: PropTypes.bool, animate: PropTypes.bool, - overlay: PropTypes.bool + overlay: PropTypes.bool, }; static defaultProps = { @@ -25,7 +25,7 @@ class IconButton extends React.PureComponent { active: false, disabled: false, animate: false, - overlay: false + overlay: false, }; handleClick = (e) => { @@ -43,7 +43,7 @@ class IconButton extends React.PureComponent { height: `${this.props.size * 1.28571429}px`, lineHeight: `${this.props.size}px`, ...this.props.style, - ...(this.props.active ? this.props.activeStyle : {}) + ...(this.props.active ? this.props.activeStyle : {}), }; const classes = ['icon-button']; @@ -65,7 +65,7 @@ class IconButton extends React.PureComponent { } if (this.props.className) { - classes.push(this.props.className) + classes.push(this.props.className); } return ( diff --git a/app/javascript/mastodon/components/load_more.js b/app/javascript/mastodon/components/load_more.js @@ -9,7 +9,7 @@ const LoadMore = ({ onClick }) => ( ); LoadMore.propTypes = { - onClick: PropTypes.func + onClick: PropTypes.func, }; export default LoadMore; diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/mastodon/components/media_gallery.js @@ -6,7 +6,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { isIOS } from '../is_mobile'; const messages = defineMessages({ - toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: 'Toggle visibility' } + toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: 'Toggle visibility' }, }); class Item extends React.PureComponent { @@ -16,7 +16,7 @@ class Item extends React.PureComponent { index: PropTypes.number.isRequired, size: PropTypes.number.isRequired, onClick: PropTypes.func.isRequired, - autoPlayGif: PropTypes.bool.isRequired + autoPlayGif: PropTypes.bool.isRequired, }; handleClick = (e) => { @@ -131,11 +131,11 @@ class MediaGallery extends React.PureComponent { height: PropTypes.number.isRequired, onOpenMedia: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, - autoPlayGif: PropTypes.bool.isRequired + autoPlayGif: PropTypes.bool.isRequired, }; state = { - visible: !this.props.sensitive + visible: !this.props.sensitive, }; handleOpen = (e) => { diff --git a/app/javascript/mastodon/components/permalink.js b/app/javascript/mastodon/components/permalink.js @@ -4,14 +4,14 @@ import PropTypes from 'prop-types'; class Permalink extends React.PureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { className: PropTypes.string, href: PropTypes.string.isRequired, to: PropTypes.string.isRequired, - children: PropTypes.node + children: PropTypes.node, }; handleClick = (e) => { diff --git a/app/javascript/mastodon/components/relative_timestamp.js b/app/javascript/mastodon/components/relative_timestamp.js @@ -14,7 +14,7 @@ const RelativeTimestamp = ({ intl, timestamp }) => { RelativeTimestamp.propTypes = { intl: PropTypes.object.isRequired, - timestamp: PropTypes.string.isRequired + timestamp: PropTypes.string.isRequired, }; export default injectIntl(RelativeTimestamp); diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js @@ -18,7 +18,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; class Status extends ImmutablePureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { @@ -35,7 +35,7 @@ class Status extends ImmutablePureComponent { me: PropTypes.number, boostModal: PropTypes.bool, autoPlayGif: PropTypes.bool, - muted: PropTypes.bool + muted: PropTypes.bool, }; handleClick = () => { diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/mastodon/components/status_action_bar.js @@ -24,7 +24,7 @@ const messages = defineMessages({ class StatusActionBar extends React.PureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { @@ -40,7 +40,7 @@ class StatusActionBar extends React.PureComponent { onMuteConversation: PropTypes.func, me: PropTypes.number.isRequired, withDismiss: PropTypes.bool, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; handleReplyClick = () => { diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js @@ -10,16 +10,16 @@ import Permalink from './permalink'; class StatusContent extends React.PureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { status: ImmutablePropTypes.map.isRequired, - onClick: PropTypes.func + onClick: PropTypes.func, }; state = { - hidden: true + hidden: true, }; componentDidMount () { @@ -107,7 +107,7 @@ class StatusContent extends React.PureComponent { <Permalink to={`/accounts/${item.get('id')}`} href={item.get('url')} key={item.get('id')} className='mention'> @<span>{item.get('username')}</span> </Permalink> - )).reduce((aggregate, item) => [...aggregate, item, ' '], []) + )).reduce((aggregate, item) => [...aggregate, item, ' '], []); const toggleText = hidden ? <FormattedMessage id='status.show_more' defaultMessage='Show more' /> : <FormattedMessage id='status.show_less' defaultMessage='Show less' />; diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/mastodon/components/status_list.js @@ -20,11 +20,11 @@ class StatusList extends ImmutablePureComponent { isUnread: PropTypes.bool, hasMore: PropTypes.bool, prepend: PropTypes.node, - emptyMessage: PropTypes.node + emptyMessage: PropTypes.node, }; static defaultProps = { - trackScroll: true + trackScroll: true, }; handleScroll = (e) => { diff --git a/app/javascript/mastodon/components/video_player.js b/app/javascript/mastodon/components/video_player.js @@ -20,12 +20,12 @@ class VideoPlayer extends React.PureComponent { sensitive: PropTypes.bool, intl: PropTypes.object.isRequired, autoplay: PropTypes.bool, - onOpenVideo: PropTypes.func.isRequired + onOpenVideo: PropTypes.func.isRequired, }; static defaultProps = { width: 239, - height: 110 + height: 110, }; state = { @@ -33,7 +33,7 @@ class VideoPlayer extends React.PureComponent { preview: true, muted: true, hasAudio: true, - videoError: false + videoError: false, }; handleClick = () => { @@ -59,7 +59,7 @@ class VideoPlayer extends React.PureComponent { handleVisibility = () => { this.setState({ visible: !this.state.visible, - preview: true + preview: true, }); } diff --git a/app/javascript/mastodon/containers/account_container.js b/app/javascript/mastodon/containers/account_container.js @@ -15,7 +15,7 @@ const makeMapStateToProps = () => { const mapStateToProps = (state, props) => ({ account: getAccount(state, props.id), - me: state.getIn(['meta', 'me']) + me: state.getIn(['meta', 'me']), }); return mapStateToProps; @@ -44,7 +44,7 @@ const mapDispatchToProps = (dispatch) => ({ } else { dispatch(muteAccount(account.get('id'))); } - } + }, }); export default connect(makeMapStateToProps, mapDispatchToProps)(Account); diff --git a/app/javascript/mastodon/containers/mastodon.js b/app/javascript/mastodon/containers/mastodon.js @@ -8,7 +8,7 @@ import { deleteFromTimelines, refreshTimeline, connectTimeline, - disconnectTimeline + disconnectTimeline, } from '../actions/timelines'; import { showOnboardingOnce } from '../actions/onboarding'; import { updateNotifications, refreshNotifications } from '../actions/notifications'; @@ -75,7 +75,7 @@ const initialState = JSON.parse(document.getElementById("initial-state").textCon store.dispatch(hydrateStore(initialState)); const browserHistory = useRouterHistory(createBrowserHistory)({ - basename: '/web' + basename: '/web', }); addLocaleData([ @@ -155,7 +155,7 @@ class Mastodon extends React.PureComponent { store.dispatch(connectTimeline('home')); store.dispatch(refreshTimeline('home')); store.dispatch(refreshNotifications()); - } + }, }); @@ -223,7 +223,7 @@ class Mastodon extends React.PureComponent { } Mastodon.propTypes = { - locale: PropTypes.string.isRequired + locale: PropTypes.string.isRequired, }; export default Mastodon; diff --git a/app/javascript/mastodon/containers/status_container.js b/app/javascript/mastodon/containers/status_container.js @@ -4,23 +4,23 @@ import Status from '../components/status'; import { makeGetStatus } from '../selectors'; import { replyCompose, - mentionCompose + mentionCompose, } from '../actions/compose'; import { reblog, favourite, unreblog, - unfavourite + unfavourite, } from '../actions/interactions'; import { blockAccount, - muteAccount + muteAccount, } from '../actions/accounts'; import { muteStatus, unmuteStatus, deleteStatus } from '../actions/statuses'; import { initReport } from '../actions/reports'; import { openModal } from '../actions/modal'; -import { createSelector } from 'reselect' -import { isMobile } from '../is_mobile' +import { createSelector } from 'reselect'; +import { isMobile } from '../is_mobile'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; const messages = defineMessages({ @@ -37,7 +37,7 @@ const makeMapStateToProps = () => { status: getStatus(state, props.id), me: state.getIn(['meta', 'me']), boostModal: state.getIn(['meta', 'boost_modal']), - autoPlayGif: state.getIn(['meta', 'auto_play_gif']) + autoPlayGif: state.getIn(['meta', 'auto_play_gif']), }); return mapStateToProps; @@ -77,7 +77,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(openModal('CONFIRM', { message: intl.formatMessage(messages.deleteMessage), confirm: intl.formatMessage(messages.deleteConfirm), - onConfirm: () => dispatch(deleteStatus(status.get('id'))) + onConfirm: () => dispatch(deleteStatus(status.get('id'))), })); }, @@ -97,7 +97,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(openModal('CONFIRM', { message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />, confirm: intl.formatMessage(messages.blockConfirm), - onConfirm: () => dispatch(blockAccount(account.get('id'))) + onConfirm: () => dispatch(blockAccount(account.get('id'))), })); }, @@ -109,7 +109,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(openModal('CONFIRM', { message: <FormattedMessage id='confirmations.mute.message' defaultMessage='Are you sure you want to mute {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />, confirm: intl.formatMessage(messages.muteConfirm), - onConfirm: () => dispatch(muteAccount(account.get('id'))) + onConfirm: () => dispatch(muteAccount(account.get('id'))), })); }, diff --git a/app/javascript/mastodon/features/account/components/action_bar.js b/app/javascript/mastodon/features/account/components/action_bar.js @@ -33,7 +33,7 @@ class ActionBar extends React.PureComponent { onMute: PropTypes.func.isRequired, onBlockDomain: PropTypes.func.isRequired, onUnblockDomain: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js @@ -13,12 +13,12 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, follow: { id: 'account.follow', defaultMessage: 'Follow' }, - requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' } + requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' }, }); const makeMapStateToProps = () => { const mapStateToProps = (state, props) => ({ - autoPlayGif: state.getIn(['meta', 'auto_play_gif']) + autoPlayGif: state.getIn(['meta', 'auto_play_gif']), }); return mapStateToProps; @@ -28,11 +28,11 @@ class Avatar extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, - autoPlayGif: PropTypes.bool.isRequired + autoPlayGif: PropTypes.bool.isRequired, }; state = { - isHovered: false + isHovered: false, }; handleMouseOver = () => { @@ -77,7 +77,7 @@ class Header extends ImmutablePureComponent { me: PropTypes.number.isRequired, onFollow: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, - autoPlayGif: PropTypes.bool.isRequired + autoPlayGif: PropTypes.bool.isRequired, }; render () { @@ -97,7 +97,7 @@ class Header extends ImmutablePureComponent { } if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { - info = <span className='account--follows-info'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span> + info = <span className='account--follows-info'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>; } if (me !== account.get('id')) { diff --git a/app/javascript/mastodon/features/account_gallery/components/media_item.js b/app/javascript/mastodon/features/account_gallery/components/media_item.js @@ -6,7 +6,7 @@ import Permalink from '../../../components/permalink'; class MediaItem extends ImmutablePureComponent { static propTypes = { - media: ImmutablePropTypes.map.isRequired + media: ImmutablePropTypes.map.isRequired, }; render () { @@ -34,6 +34,7 @@ class MediaItem extends ImmutablePureComponent { </div> ); } + } export default MediaItem; diff --git a/app/javascript/mastodon/features/account_gallery/index.js b/app/javascript/mastodon/features/account_gallery/index.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import { fetchAccount, fetchAccountMediaTimeline, - expandAccountMediaTimeline + expandAccountMediaTimeline, } from '../../actions/accounts'; import LoadingIndicator from '../../components/loading_indicator'; import Column from '../ui/components/column'; diff --git a/app/javascript/mastodon/features/account_timeline/components/header.js b/app/javascript/mastodon/features/account_timeline/components/header.js @@ -21,7 +21,7 @@ class Header extends ImmutablePureComponent { }; static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; handleFollow = () => { diff --git a/app/javascript/mastodon/features/account_timeline/containers/header_container.js b/app/javascript/mastodon/features/account_timeline/containers/header_container.js @@ -8,7 +8,7 @@ import { blockAccount, unblockAccount, muteAccount, - unmuteAccount + unmuteAccount, } from '../../../actions/accounts'; import { mentionCompose } from '../../../actions/compose'; import { initReport } from '../../../actions/reports'; @@ -27,7 +27,7 @@ const makeMapStateToProps = () => { const mapStateToProps = (state, { accountId }) => ({ account: getAccount(state, Number(accountId)), - me: state.getIn(['meta', 'me']) + me: state.getIn(['meta', 'me']), }); return mapStateToProps; @@ -49,7 +49,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(openModal('CONFIRM', { message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />, confirm: intl.formatMessage(messages.blockConfirm), - onConfirm: () => dispatch(blockAccount(account.get('id'))) + onConfirm: () => dispatch(blockAccount(account.get('id'))), })); } }, @@ -69,7 +69,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(openModal('CONFIRM', { message: <FormattedMessage id='confirmations.mute.message' defaultMessage='Are you sure you want to mute {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />, confirm: intl.formatMessage(messages.muteConfirm), - onConfirm: () => dispatch(muteAccount(account.get('id'))) + onConfirm: () => dispatch(muteAccount(account.get('id'))), })); } }, @@ -78,13 +78,13 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(openModal('CONFIRM', { message: <FormattedMessage id='confirmations.domain_block.message' defaultMessage='Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.' values={{ domain: <strong>{domain}</strong> }} />, confirm: intl.formatMessage(messages.blockDomainConfirm), - onConfirm: () => dispatch(blockDomain(domain, accountId)) + onConfirm: () => dispatch(blockDomain(domain, accountId)), })); }, onUnblockDomain (domain, accountId) { dispatch(unblockDomain(domain, accountId)); - } + }, }); export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Header)); diff --git a/app/javascript/mastodon/features/account_timeline/index.js b/app/javascript/mastodon/features/account_timeline/index.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import { fetchAccount, fetchAccountTimeline, - expandAccountTimeline + expandAccountTimeline, } from '../../actions/accounts'; import StatusList from '../../components/status_list'; import LoadingIndicator from '../../components/loading_indicator'; @@ -19,7 +19,7 @@ const mapStateToProps = (state, props) => ({ statusIds: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'items'], Immutable.List()), isLoading: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'isLoading']), hasMore: !!state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'next']), - me: state.getIn(['meta', 'me']) + me: state.getIn(['meta', 'me']), }); class AccountTimeline extends ImmutablePureComponent { @@ -30,7 +30,7 @@ class AccountTimeline extends ImmutablePureComponent { statusIds: ImmutablePropTypes.list, isLoading: PropTypes.bool, hasMore: PropTypes.bool, - me: PropTypes.number.isRequired + me: PropTypes.number.isRequired, }; componentWillMount () { diff --git a/app/javascript/mastodon/features/blocks/index.js b/app/javascript/mastodon/features/blocks/index.js @@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ - heading: { id: 'column.blocks', defaultMessage: 'Blocked users' } + heading: { id: 'column.blocks', defaultMessage: 'Blocked users' }, }); const mapStateToProps = state => ({ - accountIds: state.getIn(['user_lists', 'blocks', 'items']) + accountIds: state.getIn(['user_lists', 'blocks', 'items']), }); class Blocks extends ImmutablePureComponent { @@ -25,7 +25,7 @@ class Blocks extends ImmutablePureComponent { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; componentWillMount () { @@ -64,6 +64,7 @@ class Blocks extends ImmutablePureComponent { </Column> ); } + } export default connect(mapStateToProps)(injectIntl(Blocks)); diff --git a/app/javascript/mastodon/features/community_timeline/index.js b/app/javascript/mastodon/features/community_timeline/index.js @@ -8,20 +8,20 @@ import { updateTimeline, deleteFromTimelines, connectTimeline, - disconnectTimeline + disconnectTimeline, } from '../../actions/timelines'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnBackButtonSlim from '../../components/column_back_button_slim'; import createStream from '../../stream'; const messages = defineMessages({ - title: { id: 'column.community', defaultMessage: 'Local timeline' } + title: { id: 'column.community', defaultMessage: 'Local timeline' }, }); const mapStateToProps = state => ({ hasUnread: state.getIn(['timelines', 'community', 'unread']) > 0, streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']), - accessToken: state.getIn(['meta', 'access_token']) + accessToken: state.getIn(['meta', 'access_token']), }); let subscription; @@ -33,7 +33,7 @@ class CommunityTimeline extends React.PureComponent { intl: PropTypes.object.isRequired, streamingAPIBaseURL: PropTypes.string.isRequired, accessToken: PropTypes.string.isRequired, - hasUnread: PropTypes.bool + hasUnread: PropTypes.bool, }; componentDidMount () { @@ -68,7 +68,7 @@ class CommunityTimeline extends React.PureComponent { dispatch(deleteFromTimelines(data.payload)); break; } - } + }, }); } diff --git a/app/javascript/mastodon/features/compose/components/autosuggest_account.js b/app/javascript/mastodon/features/compose/components/autosuggest_account.js @@ -7,7 +7,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; class AutosuggestAccount extends ImmutablePureComponent { static propTypes = { - account: ImmutablePropTypes.map.isRequired + account: ImmutablePropTypes.map.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/compose/components/character_counter.js b/app/javascript/mastodon/features/compose/components/character_counter.js @@ -6,7 +6,7 @@ class CharacterCounter extends React.PureComponent { static propTypes = { text: PropTypes.string.isRequired, - max: PropTypes.number.isRequired + max: PropTypes.number.isRequired, }; checkRemainingText (diff) { diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -53,7 +53,7 @@ class ComposeForm extends ImmutablePureComponent { }; static defaultProps = { - showSearch: false + showSearch: false, }; handleChange = (e) => { diff --git a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js @@ -13,13 +13,13 @@ const messages = defineMessages({ travel: { id: 'emoji_button.travel', defaultMessage: 'Travel & Places' }, objects: { id: 'emoji_button.objects', defaultMessage: 'Objects' }, symbols: { id: 'emoji_button.symbols', defaultMessage: 'Symbols' }, - flags: { id: 'emoji_button.flags', defaultMessage: 'Flags' } + flags: { id: 'emoji_button.flags', defaultMessage: 'Flags' }, }); const settings = { imageType: 'png', sprites: false, - imagePathPNG: '/emoji/' + imagePathPNG: '/emoji/', }; let EmojiPicker; // load asynchronously @@ -28,12 +28,12 @@ class EmojiPickerDropdown extends React.PureComponent { static propTypes = { intl: PropTypes.object.isRequired, - onPickEmoji: PropTypes.func.isRequired + onPickEmoji: PropTypes.func.isRequired, }; state = { active: false, - loading: false + loading: false, }; setRef = (c) => { @@ -98,8 +98,8 @@ class EmojiPickerDropdown extends React.PureComponent { flags: { title: intl.formatMessage(messages.flags), emoji: 'flag_gb', - } - } + }, + }; const { active, loading } = this.state; diff --git a/app/javascript/mastodon/features/compose/components/navigation_bar.js b/app/javascript/mastodon/features/compose/components/navigation_bar.js @@ -11,7 +11,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; class NavigationBar extends ImmutablePureComponent { static propTypes = { - account: ImmutablePropTypes.map.isRequired + account: ImmutablePropTypes.map.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js @@ -12,24 +12,24 @@ const messages = defineMessages({ private_long: { id: 'privacy.private.long', defaultMessage: 'Post to followers only' }, direct_short: { id: 'privacy.direct.short', defaultMessage: 'Direct' }, direct_long: { id: 'privacy.direct.long', defaultMessage: 'Post to mentioned users only' }, - change_privacy: { id: 'privacy.change', defaultMessage: 'Adjust status privacy' } + change_privacy: { id: 'privacy.change', defaultMessage: 'Adjust status privacy' }, }); const iconStyle = { height: null, - lineHeight: '27px' -} + lineHeight: '27px', +}; class PrivacyDropdown extends React.PureComponent { static propTypes = { value: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; state = { - open: false + open: false, }; handleToggle = () => { @@ -71,7 +71,7 @@ class PrivacyDropdown extends React.PureComponent { { icon: 'globe', value: 'public', shortText: intl.formatMessage(messages.public_short), longText: intl.formatMessage(messages.public_long) }, { icon: 'unlock-alt', value: 'unlisted', shortText: intl.formatMessage(messages.unlisted_short), longText: intl.formatMessage(messages.unlisted_long) }, { icon: 'lock', value: 'private', shortText: intl.formatMessage(messages.private_short), longText: intl.formatMessage(messages.private_long) }, - { icon: 'envelope', value: 'direct', shortText: intl.formatMessage(messages.direct_short), longText: intl.formatMessage(messages.direct_long) } + { icon: 'envelope', value: 'direct', shortText: intl.formatMessage(messages.direct_short), longText: intl.formatMessage(messages.direct_long) }, ]; const valueOption = options.find(item => item.value === value); diff --git a/app/javascript/mastodon/features/compose/components/reply_indicator.js b/app/javascript/mastodon/features/compose/components/reply_indicator.js @@ -9,19 +9,19 @@ import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ - cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' } + cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' }, }); class ReplyIndicator extends ImmutablePureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { status: ImmutablePropTypes.map, onCancel: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; handleClick = () => { diff --git a/app/javascript/mastodon/features/compose/components/search.js b/app/javascript/mastodon/features/compose/components/search.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; const messages = defineMessages({ - placeholder: { id: 'search.placeholder', defaultMessage: 'Search' } + placeholder: { id: 'search.placeholder', defaultMessage: 'Search' }, }); class Search extends React.PureComponent { @@ -15,7 +15,7 @@ class Search extends React.PureComponent { onSubmit: PropTypes.func.isRequired, onClear: PropTypes.func.isRequired, onShow: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; handleChange = (e) => { diff --git a/app/javascript/mastodon/features/compose/components/search_results.js b/app/javascript/mastodon/features/compose/components/search_results.js @@ -9,7 +9,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; class SearchResults extends ImmutablePureComponent { static propTypes = { - results: ImmutablePropTypes.map.isRequired + results: ImmutablePropTypes.map.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/compose/components/text_icon_button.js b/app/javascript/mastodon/features/compose/components/text_icon_button.js @@ -8,7 +8,7 @@ class TextIconButton extends React.PureComponent { title: PropTypes.string, active: PropTypes.bool, onClick: PropTypes.func.isRequired, - ariaControls: PropTypes.string + ariaControls: PropTypes.string, }; handleClick = (e) => { diff --git a/app/javascript/mastodon/features/compose/components/upload_button.js b/app/javascript/mastodon/features/compose/components/upload_button.js @@ -5,7 +5,7 @@ import { defineMessages, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; const messages = defineMessages({ - upload: { id: 'upload_button.label', defaultMessage: 'Add media' } + upload: { id: 'upload_button.label', defaultMessage: 'Add media' }, }); const makeMapStateToProps = () => { @@ -14,12 +14,12 @@ const makeMapStateToProps = () => { }); return mapStateToProps; -} +}; const iconStyle = { height: null, - lineHeight: '27px' -} + lineHeight: '27px', +}; class UploadButton extends React.PureComponent { @@ -29,7 +29,7 @@ class UploadButton extends React.PureComponent { style: PropTypes.object, resetFileKey: PropTypes.number, acceptContentTypes: PropTypes.arrayOf(PropTypes.string).isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; handleChange = (e) => { diff --git a/app/javascript/mastodon/features/compose/components/upload_form.js b/app/javascript/mastodon/features/compose/components/upload_form.js @@ -8,7 +8,7 @@ import Motion from 'react-motion/lib/Motion'; import spring from 'react-motion/lib/spring'; const messages = defineMessages({ - undo: { id: 'upload_form.undo', defaultMessage: 'Undo' } + undo: { id: 'upload_form.undo', defaultMessage: 'Undo' }, }); class UploadForm extends React.PureComponent { @@ -16,7 +16,7 @@ class UploadForm extends React.PureComponent { static propTypes = { media: ImmutablePropTypes.list.isRequired, onRemoveFile: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; onRemoveFile = (e) => { diff --git a/app/javascript/mastodon/features/compose/components/upload_progress.js b/app/javascript/mastodon/features/compose/components/upload_progress.js @@ -8,7 +8,7 @@ class UploadProgress extends React.PureComponent { static propTypes = { active: PropTypes.bool, - progress: PropTypes.number + progress: PropTypes.number, }; render () { diff --git a/app/javascript/mastodon/features/compose/components/warning.js b/app/javascript/mastodon/features/compose/components/warning.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; class Warning extends React.PureComponent { static propTypes = { - message: PropTypes.node.isRequired + message: PropTypes.node.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/compose/containers/autosuggest_account_container.js b/app/javascript/mastodon/features/compose/containers/autosuggest_account_container.js @@ -6,7 +6,7 @@ const makeMapStateToProps = () => { const getAccount = makeGetAccount(); const mapStateToProps = (state, { id }) => ({ - account: getAccount(state, id) + account: getAccount(state, id), }); return mapStateToProps; diff --git a/app/javascript/mastodon/features/compose/containers/autosuggest_status_container.js b/app/javascript/mastodon/features/compose/containers/autosuggest_status_container.js @@ -6,7 +6,7 @@ const makeMapStateToProps = () => { const getStatus = makeGetStatus(); const mapStateToProps = (state, { id }) => ({ - status: getStatus(state, id) + status: getStatus(state, id), }); return mapStateToProps; diff --git a/app/javascript/mastodon/features/compose/containers/compose_form_container.js b/app/javascript/mastodon/features/compose/containers/compose_form_container.js @@ -8,7 +8,7 @@ import { fetchComposeSuggestions, selectComposeSuggestion, changeComposeSpoilerText, - insertEmojiCompose + insertEmojiCompose, } from '../../../actions/compose'; const mapStateToProps = state => ({ @@ -23,7 +23,7 @@ const mapStateToProps = state => ({ is_submitting: state.getIn(['compose', 'is_submitting']), is_uploading: state.getIn(['compose', 'is_uploading']), me: state.getIn(['compose', 'me']), - showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']) + showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']), }); const mapDispatchToProps = (dispatch) => ({ diff --git a/app/javascript/mastodon/features/compose/containers/navigation_container.js b/app/javascript/mastodon/features/compose/containers/navigation_container.js @@ -3,7 +3,7 @@ import NavigationBar from '../components/navigation_bar'; const mapStateToProps = (state, props) => { return { - account: state.getIn(['accounts', state.getIn(['meta', 'me'])]) + account: state.getIn(['accounts', state.getIn(['meta', 'me'])]), }; }; diff --git a/app/javascript/mastodon/features/compose/containers/privacy_dropdown_container.js b/app/javascript/mastodon/features/compose/containers/privacy_dropdown_container.js @@ -3,14 +3,14 @@ import PrivacyDropdown from '../components/privacy_dropdown'; import { changeComposeVisibility } from '../../../actions/compose'; const mapStateToProps = state => ({ - value: state.getIn(['compose', 'privacy']) + value: state.getIn(['compose', 'privacy']), }); const mapDispatchToProps = dispatch => ({ onChange (value) { dispatch(changeComposeVisibility(value)); - } + }, }); diff --git a/app/javascript/mastodon/features/compose/containers/reply_indicator_container.js b/app/javascript/mastodon/features/compose/containers/reply_indicator_container.js @@ -17,7 +17,7 @@ const mapDispatchToProps = dispatch => ({ onCancel () { dispatch(cancelReplyCompose()); - } + }, }); diff --git a/app/javascript/mastodon/features/compose/containers/search_container.js b/app/javascript/mastodon/features/compose/containers/search_container.js @@ -3,13 +3,13 @@ import { changeSearch, clearSearch, submitSearch, - showSearch + showSearch, } from '../../../actions/search'; import Search from '../components/search'; const mapStateToProps = state => ({ value: state.getIn(['search', 'value']), - submitted: state.getIn(['search', 'submitted']) + submitted: state.getIn(['search', 'submitted']), }); const mapDispatchToProps = dispatch => ({ @@ -28,7 +28,7 @@ const mapDispatchToProps = dispatch => ({ onShow () { dispatch(showSearch()); - } + }, }); diff --git a/app/javascript/mastodon/features/compose/containers/search_results_container.js b/app/javascript/mastodon/features/compose/containers/search_results_container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux'; import SearchResults from '../components/search_results'; const mapStateToProps = state => ({ - results: state.getIn(['search', 'results']) + results: state.getIn(['search', 'results']), }); export default connect(mapStateToProps)(SearchResults); diff --git a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js @@ -8,19 +8,19 @@ import spring from 'react-motion/lib/spring'; import { injectIntl, defineMessages } from 'react-intl'; const messages = defineMessages({ - title: { id: 'compose_form.sensitive', defaultMessage: 'Mark media as sensitive' } + title: { id: 'compose_form.sensitive', defaultMessage: 'Mark media as sensitive' }, }); const mapStateToProps = state => ({ visible: state.getIn(['compose', 'media_attachments']).size > 0, - active: state.getIn(['compose', 'sensitive']) + active: state.getIn(['compose', 'sensitive']), }); const mapDispatchToProps = dispatch => ({ onClick () { dispatch(changeComposeSensitivity()); - } + }, }); @@ -30,7 +30,7 @@ class SensitiveButton extends React.PureComponent { visible: PropTypes.bool, active: PropTypes.bool, onClick: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/compose/containers/spoiler_button_container.js b/app/javascript/mastodon/features/compose/containers/spoiler_button_container.js @@ -4,21 +4,21 @@ import { changeComposeSpoilerness } from '../../../actions/compose'; import { injectIntl, defineMessages } from 'react-intl'; const messages = defineMessages({ - title: { id: 'compose_form.spoiler', defaultMessage: 'Hide text behind warning' } + title: { id: 'compose_form.spoiler', defaultMessage: 'Hide text behind warning' }, }); const mapStateToProps = (state, { intl }) => ({ label: 'CW', title: intl.formatMessage(messages.title), active: state.getIn(['compose', 'spoiler']), - ariaControls: 'cw-spoiler-input' + ariaControls: 'cw-spoiler-input', }); const mapDispatchToProps = dispatch => ({ onClick () { dispatch(changeComposeSpoilerness()); - } + }, }); diff --git a/app/javascript/mastodon/features/compose/containers/upload_button_container.js b/app/javascript/mastodon/features/compose/containers/upload_button_container.js @@ -4,14 +4,14 @@ import { uploadCompose } from '../../../actions/compose'; const mapStateToProps = state => ({ disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')), - resetFileKey: state.getIn(['compose', 'resetFileKey']) + resetFileKey: state.getIn(['compose', 'resetFileKey']), }); const mapDispatchToProps = dispatch => ({ onSelectFile (files) { dispatch(uploadCompose(files)); - } + }, }); diff --git a/app/javascript/mastodon/features/compose/containers/upload_form_container.js b/app/javascript/mastodon/features/compose/containers/upload_form_container.js @@ -10,7 +10,7 @@ const mapDispatchToProps = dispatch => ({ onRemoveFile (media_id) { dispatch(undoUploadCompose(media_id)); - } + }, }); diff --git a/app/javascript/mastodon/features/compose/containers/upload_progress_container.js b/app/javascript/mastodon/features/compose/containers/upload_progress_container.js @@ -3,7 +3,7 @@ import UploadProgress from '../components/upload_progress'; const mapStateToProps = (state, props) => ({ active: state.getIn(['compose', 'is_uploading']), - progress: state.getIn(['compose', 'progress']) + progress: state.getIn(['compose', 'progress']), }); export default connect(mapStateToProps)(UploadProgress); diff --git a/app/javascript/mastodon/features/compose/containers/warning_container.js b/app/javascript/mastodon/features/compose/containers/warning_container.js @@ -20,7 +20,7 @@ const mapStateToProps = state => { return { needsLeakWarning: (state.getIn(['compose', 'privacy']) === 'private' || state.getIn(['compose', 'privacy']) === 'direct') && mentionedUsernames !== null, mentionedDomains: mentionedUsernamesWithDomains, - needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', state.getIn(['meta', 'me']), 'locked']) + needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', state.getIn(['meta', 'me']), 'locked']), }; }; diff --git a/app/javascript/mastodon/features/compose/index.js b/app/javascript/mastodon/features/compose/index.js @@ -17,11 +17,11 @@ const messages = defineMessages({ public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' }, community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' }, preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, - logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' } + logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, }); const mapStateToProps = state => ({ - showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']) + showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']), }); class Compose extends React.PureComponent { @@ -30,7 +30,7 @@ class Compose extends React.PureComponent { dispatch: PropTypes.func.isRequired, withHeader: PropTypes.bool, showSearch: PropTypes.bool, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; componentDidMount () { diff --git a/app/javascript/mastodon/features/favourited_statuses/index.js b/app/javascript/mastodon/features/favourited_statuses/index.js @@ -11,13 +11,13 @@ import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ - heading: { id: 'column.favourites', defaultMessage: 'Favourites' } + heading: { id: 'column.favourites', defaultMessage: 'Favourites' }, }); const mapStateToProps = state => ({ statusIds: state.getIn(['status_lists', 'favourites', 'items']), loaded: state.getIn(['status_lists', 'favourites', 'loaded']), - me: state.getIn(['meta', 'me']) + me: state.getIn(['meta', 'me']), }); class Favourites extends ImmutablePureComponent { @@ -27,7 +27,7 @@ class Favourites extends ImmutablePureComponent { statusIds: ImmutablePropTypes.list.isRequired, loaded: PropTypes.bool, intl: PropTypes.object.isRequired, - me: PropTypes.number.isRequired + me: PropTypes.number.isRequired, }; componentWillMount () { diff --git a/app/javascript/mastodon/features/favourites/index.js b/app/javascript/mastodon/features/favourites/index.js @@ -11,7 +11,7 @@ import ColumnBackButton from '../../components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ - accountIds: state.getIn(['user_lists', 'favourited_by', Number(props.params.statusId)]) + accountIds: state.getIn(['user_lists', 'favourited_by', Number(props.params.statusId)]), }); class Favourites extends ImmutablePureComponent { @@ -19,7 +19,7 @@ class Favourites extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, - accountIds: ImmutablePropTypes.list + accountIds: ImmutablePropTypes.list, }; componentWillMount () { diff --git a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js b/app/javascript/mastodon/features/follow_requests/components/account_authorize.js @@ -11,7 +11,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' }, - reject: { id: 'follow_request.reject', defaultMessage: 'Reject' } + reject: { id: 'follow_request.reject', defaultMessage: 'Reject' }, }); class AccountAuthorize extends ImmutablePureComponent { @@ -20,7 +20,7 @@ class AccountAuthorize extends ImmutablePureComponent { account: ImmutablePropTypes.map.isRequired, onAuthorize: PropTypes.func.isRequired, onReject: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/follow_requests/containers/account_authorize_container.js b/app/javascript/mastodon/features/follow_requests/containers/account_authorize_container.js @@ -7,7 +7,7 @@ const makeMapStateToProps = () => { const getAccount = makeGetAccount(); const mapStateToProps = (state, props) => ({ - account: getAccount(state, props.id) + account: getAccount(state, props.id), }); return mapStateToProps; @@ -20,7 +20,7 @@ const mapDispatchToProps = (dispatch, { id }) => ({ onReject (account) { dispatch(rejectFollowRequest(id)); - } + }, }); export default connect(makeMapStateToProps, mapDispatchToProps)(AccountAuthorize); diff --git a/app/javascript/mastodon/features/follow_requests/index.js b/app/javascript/mastodon/features/follow_requests/index.js @@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ - heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' } + heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' }, }); const mapStateToProps = state => ({ - accountIds: state.getIn(['user_lists', 'follow_requests', 'items']) + accountIds: state.getIn(['user_lists', 'follow_requests', 'items']), }); class FollowRequests extends ImmutablePureComponent { @@ -25,7 +25,7 @@ class FollowRequests extends ImmutablePureComponent { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; componentWillMount () { diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js @@ -6,7 +6,7 @@ import LoadingIndicator from '../../components/loading_indicator'; import { fetchAccount, fetchFollowers, - expandFollowers + expandFollowers, } from '../../actions/accounts'; import { ScrollContainer } from 'react-router-scroll'; import AccountContainer from '../../containers/account_container'; @@ -17,7 +17,7 @@ import ColumnBackButton from '../../components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ - accountIds: state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'items']) + accountIds: state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'items']), }); class Followers extends ImmutablePureComponent { @@ -25,7 +25,7 @@ class Followers extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, - accountIds: ImmutablePropTypes.list + accountIds: ImmutablePropTypes.list, }; componentWillMount () { diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js @@ -6,7 +6,7 @@ import LoadingIndicator from '../../components/loading_indicator'; import { fetchAccount, fetchFollowing, - expandFollowing + expandFollowing, } from '../../actions/accounts'; import { ScrollContainer } from 'react-router-scroll'; import AccountContainer from '../../containers/account_container'; @@ -17,7 +17,7 @@ import ColumnBackButton from '../../components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ - accountIds: state.getIn(['user_lists', 'following', Number(props.params.accountId), 'items']) + accountIds: state.getIn(['user_lists', 'following', Number(props.params.accountId), 'items']), }); class Following extends ImmutablePureComponent { @@ -25,7 +25,7 @@ class Following extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, - accountIds: ImmutablePropTypes.list + accountIds: ImmutablePropTypes.list, }; componentWillMount () { diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/mastodon/features/getting_started/index.js @@ -21,18 +21,18 @@ const messages = defineMessages({ favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, - info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' } + info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' }, }); const mapStateToProps = state => ({ - me: state.getIn(['accounts', state.getIn(['meta', 'me'])]) + me: state.getIn(['accounts', state.getIn(['meta', 'me'])]), }); class GettingStarted extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, - me: ImmutablePropTypes.map.isRequired + me: ImmutablePropTypes.map.isRequired, }; render () { @@ -69,7 +69,7 @@ class GettingStarted extends ImmutablePureComponent { values={{ faq: <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/FAQ.md" rel="noopener" target="_blank"><FormattedMessage id='getting_started.faq' defaultMessage='FAQ' /></a>, userguide: <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/User-guide.md" rel="noopener" target="_blank"><FormattedMessage id='getting_started.userguide' defaultMessage='User Guide' /></a>, - apps: <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md" rel="noopener" target="_blank"><FormattedMessage id='getting_started.appsshort' defaultMessage='Apps' /></a> + apps: <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md" rel="noopener" target="_blank"><FormattedMessage id='getting_started.appsshort' defaultMessage='Apps' /></a>, }} /> </p> @@ -85,6 +85,7 @@ class GettingStarted extends ImmutablePureComponent { </Column> ); } + } export default connect(mapStateToProps)(injectIntl(GettingStarted)); diff --git a/app/javascript/mastodon/features/hashtag_timeline/index.js b/app/javascript/mastodon/features/hashtag_timeline/index.js @@ -6,7 +6,7 @@ import Column from '../ui/components/column'; import { refreshTimeline, updateTimeline, - deleteFromTimelines + deleteFromTimelines, } from '../../actions/timelines'; import ColumnBackButtonSlim from '../../components/column_back_button_slim'; import { FormattedMessage } from 'react-intl'; @@ -15,7 +15,7 @@ import createStream from '../../stream'; const mapStateToProps = state => ({ hasUnread: state.getIn(['timelines', 'tag', 'unread']) > 0, streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']), - accessToken: state.getIn(['meta', 'access_token']) + accessToken: state.getIn(['meta', 'access_token']), }); class HashtagTimeline extends React.PureComponent { @@ -25,7 +25,7 @@ class HashtagTimeline extends React.PureComponent { dispatch: PropTypes.func.isRequired, streamingAPIBaseURL: PropTypes.string.isRequired, accessToken: PropTypes.string.isRequired, - hasUnread: PropTypes.bool + hasUnread: PropTypes.bool, }; _subscribe (dispatch, id) { @@ -42,7 +42,7 @@ class HashtagTimeline extends React.PureComponent { dispatch(deleteFromTimelines(data.payload)); break; } - } + }, }); } diff --git a/app/javascript/mastodon/features/home_timeline/components/column_settings.js b/app/javascript/mastodon/features/home_timeline/components/column_settings.js @@ -8,7 +8,7 @@ import SettingText from './setting_text'; const messages = defineMessages({ filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' }, - settings: { id: 'home.settings', defaultMessage: 'Column settings' } + settings: { id: 'home.settings', defaultMessage: 'Column settings' }, }); class ColumnSettings extends React.PureComponent { @@ -17,7 +17,7 @@ class ColumnSettings extends React.PureComponent { settings: ImmutablePropTypes.map.isRequired, onChange: PropTypes.func.isRequired, onSave: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/home_timeline/components/setting_text.js b/app/javascript/mastodon/features/home_timeline/components/setting_text.js @@ -8,11 +8,11 @@ class SettingText extends React.PureComponent { settings: ImmutablePropTypes.map.isRequired, settingKey: PropTypes.array.isRequired, label: PropTypes.string.isRequired, - onChange: PropTypes.func.isRequired + onChange: PropTypes.func.isRequired, }; handleChange = (e) => { - this.props.onChange(this.props.settingKey, e.target.value) + this.props.onChange(this.props.settingKey, e.target.value); } render () { diff --git a/app/javascript/mastodon/features/home_timeline/containers/column_settings_container.js b/app/javascript/mastodon/features/home_timeline/containers/column_settings_container.js @@ -3,7 +3,7 @@ import ColumnSettings from '../components/column_settings'; import { changeSetting, saveSettings } from '../../../actions/settings'; const mapStateToProps = state => ({ - settings: state.getIn(['settings', 'home']) + settings: state.getIn(['settings', 'home']), }); const mapDispatchToProps = dispatch => ({ @@ -14,7 +14,7 @@ const mapDispatchToProps = dispatch => ({ onSave () { dispatch(saveSettings()); - } + }, }); diff --git a/app/javascript/mastodon/features/home_timeline/index.js b/app/javascript/mastodon/features/home_timeline/index.js @@ -8,12 +8,12 @@ import ColumnSettingsContainer from './containers/column_settings_container'; import Link from 'react-router/lib/Link'; const messages = defineMessages({ - title: { id: 'column.home', defaultMessage: 'Home' } + title: { id: 'column.home', defaultMessage: 'Home' }, }); const mapStateToProps = state => ({ hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0, - hasFollows: state.getIn(['accounts_counters', state.getIn(['meta', 'me']), 'following_count']) > 0 + hasFollows: state.getIn(['accounts_counters', state.getIn(['meta', 'me']), 'following_count']) > 0, }); class HomeTimeline extends React.PureComponent { @@ -21,7 +21,7 @@ class HomeTimeline extends React.PureComponent { static propTypes = { intl: PropTypes.object.isRequired, hasUnread: PropTypes.bool, - hasFollows: PropTypes.bool + hasFollows: PropTypes.bool, }; render () { @@ -30,7 +30,7 @@ class HomeTimeline extends React.PureComponent { let emptyMessage; if (hasFollows) { - emptyMessage = <FormattedMessage id='empty_column.home.inactivity' defaultMessage="Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon." /> + emptyMessage = <FormattedMessage id='empty_column.home.inactivity' defaultMessage="Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon." />; } else { emptyMessage = <FormattedMessage id='empty_column.home' defaultMessage="You aren't following anyone yet. Visit {public} or use search to get started and meet other users." values={{ public: <Link to='/timelines/public'><FormattedMessage id='empty_column.home.public_timeline' defaultMessage='the public timeline' /></Link> }} />; } diff --git a/app/javascript/mastodon/features/mutes/index.js b/app/javascript/mastodon/features/mutes/index.js @@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ - heading: { id: 'column.mutes', defaultMessage: 'Muted users' } + heading: { id: 'column.mutes', defaultMessage: 'Muted users' }, }); const mapStateToProps = state => ({ - accountIds: state.getIn(['user_lists', 'mutes', 'items']) + accountIds: state.getIn(['user_lists', 'mutes', 'items']), }); class Mutes extends ImmutablePureComponent { @@ -64,7 +64,7 @@ Mutes.propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; export default connect(mapStateToProps)(injectIntl(Mutes)); diff --git a/app/javascript/mastodon/features/notifications/components/clear_column_button.js b/app/javascript/mastodon/features/notifications/components/clear_column_button.js @@ -3,14 +3,14 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ - clear: { id: 'notifications.clear', defaultMessage: 'Clear notifications' } + clear: { id: 'notifications.clear', defaultMessage: 'Clear notifications' }, }); class ClearColumnButton extends React.Component { static propTypes = { onClick: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; render () { @@ -22,6 +22,7 @@ class ClearColumnButton extends React.Component { </div> ); } + } export default injectIntl(ClearColumnButton); diff --git a/app/javascript/mastodon/features/notifications/components/column_settings.js b/app/javascript/mastodon/features/notifications/components/column_settings.js @@ -6,7 +6,7 @@ import ColumnCollapsable from '../../../components/column_collapsable'; import SettingToggle from './setting_toggle'; const messages = defineMessages({ - settings: { id: 'notifications.settings', defaultMessage: 'Column settings' } + settings: { id: 'notifications.settings', defaultMessage: 'Column settings' }, }); class ColumnSettings extends React.PureComponent { @@ -16,8 +16,8 @@ class ColumnSettings extends React.PureComponent { onChange: PropTypes.func.isRequired, onSave: PropTypes.func.isRequired, intl: PropTypes.shape({ - formatMessage: PropTypes.func.isRequired - }).isRequired + formatMessage: PropTypes.func.isRequired, + }).isRequired, }; render () { diff --git a/app/javascript/mastodon/features/notifications/components/notification.js b/app/javascript/mastodon/features/notifications/components/notification.js @@ -12,7 +12,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; class Notification extends ImmutablePureComponent { static propTypes = { - notification: ImmutablePropTypes.map.isRequired + notification: ImmutablePropTypes.map.isRequired, }; renderFollow (account, link) { diff --git a/app/javascript/mastodon/features/notifications/components/setting_toggle.js b/app/javascript/mastodon/features/notifications/components/setting_toggle.js @@ -10,7 +10,7 @@ class SettingToggle extends React.PureComponent { settingKey: PropTypes.array.isRequired, label: PropTypes.node.isRequired, onChange: PropTypes.func.isRequired, - htmlFor: PropTypes.string + htmlFor: PropTypes.string, } onChange = (e) => { diff --git a/app/javascript/mastodon/features/notifications/containers/column_settings_container.js b/app/javascript/mastodon/features/notifications/containers/column_settings_container.js @@ -3,7 +3,7 @@ import ColumnSettings from '../components/column_settings'; import { changeSetting, saveSettings } from '../../../actions/settings'; const mapStateToProps = state => ({ - settings: state.getIn(['settings', 'notifications']) + settings: state.getIn(['settings', 'notifications']), }); const mapDispatchToProps = dispatch => ({ @@ -14,7 +14,7 @@ const mapDispatchToProps = dispatch => ({ onSave () { dispatch(saveSettings()); - } + }, }); diff --git a/app/javascript/mastodon/features/notifications/containers/notification_container.js b/app/javascript/mastodon/features/notifications/containers/notification_container.js @@ -6,7 +6,7 @@ const makeMapStateToProps = () => { const getNotification = makeGetNotification(); const mapStateToProps = (state, props) => ({ - notification: getNotification(state, props.notification, props.accountId) + notification: getNotification(state, props.notification, props.accountId), }); return mapStateToProps; diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js @@ -17,18 +17,18 @@ import { openModal } from '../../actions/modal'; const messages = defineMessages({ title: { id: 'column.notifications', defaultMessage: 'Notifications' }, clearMessage: { id: 'notifications.clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all your notifications?' }, - clearConfirm: { id: 'notifications.clear', defaultMessage: 'Clear notifications' } + clearConfirm: { id: 'notifications.clear', defaultMessage: 'Clear notifications' }, }); const getNotifications = createSelector([ state => Immutable.List(state.getIn(['settings', 'notifications', 'shows']).filter(item => !item).keys()), - state => state.getIn(['notifications', 'items']) + state => state.getIn(['notifications', 'items']), ], (excludedTypes, notifications) => notifications.filterNot(item => excludedTypes.includes(item.get('type')))); const mapStateToProps = state => ({ notifications: getNotifications(state), isLoading: state.getIn(['notifications', 'isLoading'], true), - isUnread: state.getIn(['notifications', 'unread']) > 0 + isUnread: state.getIn(['notifications', 'unread']) > 0, }); class Notifications extends React.PureComponent { @@ -39,11 +39,11 @@ class Notifications extends React.PureComponent { shouldUpdateScroll: PropTypes.func, intl: PropTypes.object.isRequired, isLoading: PropTypes.bool, - isUnread: PropTypes.bool + isUnread: PropTypes.bool, }; static defaultProps = { - trackScroll: true + trackScroll: true, }; handleScroll = (e) => { @@ -77,7 +77,7 @@ class Notifications extends React.PureComponent { dispatch(openModal('CONFIRM', { message: intl.formatMessage(messages.clearMessage), confirm: intl.formatMessage(messages.clearConfirm), - onConfirm: () => dispatch(clearNotifications()) + onConfirm: () => dispatch(clearNotifications()), })); } diff --git a/app/javascript/mastodon/features/public_timeline/index.js b/app/javascript/mastodon/features/public_timeline/index.js @@ -8,20 +8,20 @@ import { updateTimeline, deleteFromTimelines, connectTimeline, - disconnectTimeline + disconnectTimeline, } from '../../actions/timelines'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnBackButtonSlim from '../../components/column_back_button_slim'; import createStream from '../../stream'; const messages = defineMessages({ - title: { id: 'column.public', defaultMessage: 'Federated timeline' } + title: { id: 'column.public', defaultMessage: 'Federated timeline' }, }); const mapStateToProps = state => ({ hasUnread: state.getIn(['timelines', 'public', 'unread']) > 0, streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']), - accessToken: state.getIn(['meta', 'access_token']) + accessToken: state.getIn(['meta', 'access_token']), }); let subscription; @@ -33,7 +33,7 @@ class PublicTimeline extends React.PureComponent { intl: PropTypes.object.isRequired, streamingAPIBaseURL: PropTypes.string.isRequired, accessToken: PropTypes.string.isRequired, - hasUnread: PropTypes.bool + hasUnread: PropTypes.bool, }; componentDidMount () { @@ -68,7 +68,7 @@ class PublicTimeline extends React.PureComponent { dispatch(deleteFromTimelines(data.payload)); break; } - } + }, }); } diff --git a/app/javascript/mastodon/features/reblogs/index.js b/app/javascript/mastodon/features/reblogs/index.js @@ -11,7 +11,7 @@ import ColumnBackButton from '../../components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ - accountIds: state.getIn(['user_lists', 'reblogged_by', Number(props.params.statusId)]) + accountIds: state.getIn(['user_lists', 'reblogged_by', Number(props.params.statusId)]), }); class Reblogs extends ImmutablePureComponent { @@ -19,7 +19,7 @@ class Reblogs extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, - accountIds: ImmutablePropTypes.list + accountIds: ImmutablePropTypes.list, }; componentWillMount () { diff --git a/app/javascript/mastodon/features/report/components/status_check_box.js b/app/javascript/mastodon/features/report/components/status_check_box.js @@ -10,7 +10,7 @@ class StatusCheckBox extends React.PureComponent { status: ImmutablePropTypes.map.isRequired, checked: PropTypes.bool, onToggle: PropTypes.func.isRequired, - disabled: PropTypes.bool + disabled: PropTypes.bool, }; render () { diff --git a/app/javascript/mastodon/features/report/containers/status_check_box_container.js b/app/javascript/mastodon/features/report/containers/status_check_box_container.js @@ -5,14 +5,14 @@ import Immutable from 'immutable'; const mapStateToProps = (state, { id }) => ({ status: state.getIn(['statuses', id]), - checked: state.getIn(['reports', 'new', 'status_ids'], Immutable.Set()).includes(id) + checked: state.getIn(['reports', 'new', 'status_ids'], Immutable.Set()).includes(id), }); const mapDispatchToProps = (dispatch, { id }) => ({ onToggle (e) { dispatch(toggleStatusReport(id, e.target.checked)); - } + }, }); diff --git a/app/javascript/mastodon/features/report/index.js b/app/javascript/mastodon/features/report/index.js @@ -15,7 +15,7 @@ import ColumnBackButtonSlim from '../../components/column_back_button_slim'; const messages = defineMessages({ heading: { id: 'report.heading', defaultMessage: 'New report' }, placeholder: { id: 'report.placeholder', defaultMessage: 'Additional comments' }, - submit: { id: 'report.submit', defaultMessage: 'Submit' } + submit: { id: 'report.submit', defaultMessage: 'Submit' }, }); const makeMapStateToProps = () => { @@ -28,7 +28,7 @@ const makeMapStateToProps = () => { isSubmitting: state.getIn(['reports', 'new', 'isSubmitting']), account: getAccount(state, accountId), comment: state.getIn(['reports', 'new', 'comment']), - statusIds: Immutable.OrderedSet(state.getIn(['timelines', 'accounts_timelines', accountId, 'items'])).union(state.getIn(['reports', 'new', 'status_ids'])) + statusIds: Immutable.OrderedSet(state.getIn(['timelines', 'accounts_timelines', accountId, 'items'])).union(state.getIn(['reports', 'new', 'status_ids'])), }; }; @@ -38,7 +38,7 @@ const makeMapStateToProps = () => { class Report extends React.PureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { @@ -47,7 +47,7 @@ class Report extends React.PureComponent { statusIds: ImmutablePropTypes.orderedSet.isRequired, comment: PropTypes.string.isRequired, dispatch: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; componentWillMount () { diff --git a/app/javascript/mastodon/features/status/components/action_bar.js b/app/javascript/mastodon/features/status/components/action_bar.js @@ -18,7 +18,7 @@ const messages = defineMessages({ class ActionBar extends React.PureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { @@ -30,7 +30,7 @@ class ActionBar extends React.PureComponent { onMention: PropTypes.func.isRequired, onReport: PropTypes.func, me: PropTypes.number.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; handleReplyClick = () => { diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/mastodon/features/status/components/card.js @@ -1,6 +1,6 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import punycode from 'punycode' +import punycode from 'punycode'; const IDNA_PREFIX = 'xn--'; @@ -9,7 +9,7 @@ const decodeIDNA = domain => { .split('.') .map(part => part.indexOf(IDNA_PREFIX) === 0 ? punycode.decode(part.slice(IDNA_PREFIX.length)) : part) .join('.'); -} +}; const getHostname = url => { const parser = document.createElement('a'); @@ -20,7 +20,7 @@ const getHostname = url => { class Card extends React.PureComponent { static propTypes = { - card: ImmutablePropTypes.map + card: ImmutablePropTypes.map, }; renderLink () { @@ -95,6 +95,7 @@ class Card extends React.PureComponent { return null; } } + } export default Card; diff --git a/app/javascript/mastodon/features/status/components/detailed_status.js b/app/javascript/mastodon/features/status/components/detailed_status.js @@ -15,7 +15,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; class DetailedStatus extends ImmutablePureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { diff --git a/app/javascript/mastodon/features/status/containers/card_container.js b/app/javascript/mastodon/features/status/containers/card_container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux'; import Card from '../components/card'; const mapStateToProps = (state, { statusId }) => ({ - card: state.getIn(['cards', statusId], null) + card: state.getIn(['cards', statusId], null), }); export default connect(mapStateToProps)(Card); diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js @@ -13,30 +13,30 @@ import { favourite, unfavourite, reblog, - unreblog + unreblog, } from '../../actions/interactions'; import { replyCompose, - mentionCompose + mentionCompose, } from '../../actions/compose'; import { deleteStatus } from '../../actions/statuses'; import { initReport } from '../../actions/reports'; import { makeGetStatus, getStatusAncestors, - getStatusDescendants + getStatusDescendants, } from '../../selectors'; import { ScrollContainer } from 'react-router-scroll'; import ColumnBackButton from '../../components/column_back_button'; import StatusContainer from '../../containers/status_container'; import { openModal } from '../../actions/modal'; -import { isMobile } from '../../is_mobile' +import { isMobile } from '../../is_mobile'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, - deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' } + deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' }, }); const makeMapStateToProps = () => { @@ -48,7 +48,7 @@ const makeMapStateToProps = () => { descendantsIds: state.getIn(['timelines', 'descendants', Number(props.params.statusId)]), me: state.getIn(['meta', 'me']), boostModal: state.getIn(['meta', 'boost_modal']), - autoPlayGif: state.getIn(['meta', 'auto_play_gif']) + autoPlayGif: state.getIn(['meta', 'auto_play_gif']), }); return mapStateToProps; @@ -57,7 +57,7 @@ const makeMapStateToProps = () => { class Status extends ImmutablePureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { @@ -69,7 +69,7 @@ class Status extends ImmutablePureComponent { me: PropTypes.number, boostModal: PropTypes.bool, autoPlayGif: PropTypes.bool, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; componentWillMount () { @@ -116,7 +116,7 @@ class Status extends ImmutablePureComponent { dispatch(openModal('CONFIRM', { message: intl.formatMessage(messages.deleteMessage), confirm: intl.formatMessage(messages.deleteConfirm), - onConfirm: () => dispatch(deleteStatus(status.get('id'))) + onConfirm: () => dispatch(deleteStatus(status.get('id'))), })); } diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.js b/app/javascript/mastodon/features/ui/components/boost_modal.js @@ -11,20 +11,20 @@ import DisplayName from '../../../components/display_name'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ - reblog: { id: 'status.reblog', defaultMessage: 'Boost' } + reblog: { id: 'status.reblog', defaultMessage: 'Boost' }, }); class BoostModal extends ImmutablePureComponent { static contextTypes = { - router: PropTypes.object + router: PropTypes.object, }; static propTypes = { status: ImmutablePropTypes.map.isRequired, onReblog: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; constructor (props, context) { diff --git a/app/javascript/mastodon/features/ui/components/column.js b/app/javascript/mastodon/features/ui/components/column.js @@ -37,7 +37,7 @@ class Column extends React.PureComponent { icon: PropTypes.string, children: PropTypes.node, active: PropTypes.bool, - hideHeadingOnMobile: PropTypes.bool + hideHeadingOnMobile: PropTypes.bool, }; handleHeaderClick = () => { @@ -61,11 +61,11 @@ class Column extends React.PureComponent { render () { const { heading, icon, children, active, hideHeadingOnMobile } = this.props; - let columnHeaderId = null + let columnHeaderId = null; let header = ''; if (heading) { - columnHeaderId = heading.replace(/ /g, '-') + columnHeaderId = heading.replace(/ /g, '-'); header = <ColumnHeader icon={icon} active={active} type={heading} onClick={this.handleHeaderClick} hideOnMobile={hideHeadingOnMobile} columnHeaderId={columnHeaderId}/>; } return ( diff --git a/app/javascript/mastodon/features/ui/components/column_header.js b/app/javascript/mastodon/features/ui/components/column_header.js @@ -1,5 +1,5 @@ import React from 'react'; -import PropTypes from 'prop-types' +import PropTypes from 'prop-types'; class ColumnHeader extends React.PureComponent { @@ -9,7 +9,7 @@ class ColumnHeader extends React.PureComponent { active: PropTypes.bool, onClick: PropTypes.func, hideOnMobile: PropTypes.bool, - columnHeaderId: PropTypes.string + columnHeaderId: PropTypes.string, }; handleClick = () => { diff --git a/app/javascript/mastodon/features/ui/components/column_link.js b/app/javascript/mastodon/features/ui/components/column_link.js @@ -26,7 +26,7 @@ ColumnLink.propTypes = { to: PropTypes.string, href: PropTypes.string, method: PropTypes.string, - hideOnMobile: PropTypes.bool + hideOnMobile: PropTypes.bool, }; export default ColumnLink; diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; class ColumnsArea extends React.PureComponent { static propTypes = { - children: PropTypes.node + children: PropTypes.node, }; render () { diff --git a/app/javascript/mastodon/features/ui/components/confirmation_modal.js b/app/javascript/mastodon/features/ui/components/confirmation_modal.js @@ -10,7 +10,7 @@ class ConfirmationModal extends React.PureComponent { confirm: PropTypes.string.isRequired, onClose: PropTypes.func.isRequired, onConfirm: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; handleClick = () => { diff --git a/app/javascript/mastodon/features/ui/components/media_modal.js b/app/javascript/mastodon/features/ui/components/media_modal.js @@ -9,7 +9,7 @@ import IconButton from '../../../components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ - close: { id: 'lightbox.close', defaultMessage: 'Close' } + close: { id: 'lightbox.close', defaultMessage: 'Close' }, }); class MediaModal extends ImmutablePureComponent { @@ -18,11 +18,11 @@ class MediaModal extends ImmutablePureComponent { media: ImmutablePropTypes.list.isRequired, index: PropTypes.number.isRequired, onClose: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; state = { - index: null + index: null, }; handleNextClick = () => { diff --git a/app/javascript/mastodon/features/ui/components/modal_root.js b/app/javascript/mastodon/features/ui/components/modal_root.js @@ -13,7 +13,7 @@ const MODAL_COMPONENTS = { 'ONBOARDING': OnboardingModal, 'VIDEO': VideoModal, 'BOOST': BoostModal, - 'CONFIRM': ConfirmationModal + 'CONFIRM': ConfirmationModal, }; class ModalRoot extends React.PureComponent { @@ -21,7 +21,7 @@ class ModalRoot extends React.PureComponent { static propTypes = { type: PropTypes.string, props: PropTypes.object, - onClose: PropTypes.func.isRequired + onClose: PropTypes.func.isRequired, }; handleKeyUp = (e) => { @@ -56,7 +56,7 @@ class ModalRoot extends React.PureComponent { items.push({ key: type, data: { type, props }, - style: { opacity: spring(1), scale: spring(1, { stiffness: 120, damping: 14 }) } + style: { opacity: spring(1), scale: spring(1, { stiffness: 120, damping: 14 }) }, }); } diff --git a/app/javascript/mastodon/features/ui/components/onboarding_modal.js b/app/javascript/mastodon/features/ui/components/onboarding_modal.js @@ -18,7 +18,7 @@ const messages = defineMessages({ home_title: { id: 'column.home', defaultMessage: 'Home' }, notifications_title: { id: 'column.notifications', defaultMessage: 'Notifications' }, local_title: { id: 'column.community', defaultMessage: 'Local timeline' }, - federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' } + federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' }, }); const PageOne = ({ acct, domain }) => ( @@ -37,7 +37,7 @@ const PageOne = ({ acct, domain }) => ( PageOne.propTypes = { acct: PropTypes.string.isRequired, - domain: PropTypes.string.isRequired + domain: PropTypes.string.isRequired, }; const PageTwo = ({ me }) => ( @@ -93,7 +93,7 @@ const PageThree = ({ me, domain }) => ( PageThree.propTypes = { me: ImmutablePropTypes.map.isRequired, - domain: PropTypes.string.isRequired + domain: PropTypes.string.isRequired, }; const PageFour = ({ domain, intl }) => ( @@ -128,7 +128,7 @@ const PageFour = ({ domain, intl }) => ( PageFour.propTypes = { domain: PropTypes.string.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; const PageSix = ({ admin, domain }) => { @@ -157,13 +157,13 @@ const PageSix = ({ admin, domain }) => { PageSix.propTypes = { admin: ImmutablePropTypes.map, - domain: PropTypes.string.isRequired + domain: PropTypes.string.isRequired, }; const mapStateToProps = state => ({ me: state.getIn(['accounts', state.getIn(['meta', 'me'])]), admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]), - domain: state.getIn(['meta', 'domain']) + domain: state.getIn(['meta', 'domain']), }); class OnboardingModal extends React.PureComponent { @@ -173,11 +173,11 @@ class OnboardingModal extends React.PureComponent { intl: PropTypes.object.isRequired, me: ImmutablePropTypes.map.isRequired, domain: PropTypes.string.isRequired, - admin: ImmutablePropTypes.map + admin: ImmutablePropTypes.map, }; state = { - currentIndex: 0 + currentIndex: 0, }; handleSkip = (e) => { @@ -210,7 +210,7 @@ class OnboardingModal extends React.PureComponent { <PageTwo me={me} />, <PageThree me={me} domain={domain} />, <PageFour domain={domain} intl={intl} />, - <PageSix admin={admin} domain={domain} /> + <PageSix admin={admin} domain={domain} />, ]; const { currentIndex } = this.state; @@ -226,7 +226,7 @@ class OnboardingModal extends React.PureComponent { const styles = pages.map((page, i) => ({ key: `page-${i}`, - style: { opacity: spring(i === currentIndex ? 1 : 0) } + style: { opacity: spring(i === currentIndex ? 1 : 0) }, })); return ( diff --git a/app/javascript/mastodon/features/ui/components/upload_area.js b/app/javascript/mastodon/features/ui/components/upload_area.js @@ -8,14 +8,14 @@ class UploadArea extends React.PureComponent { static propTypes = { active: PropTypes.bool, - onClose: PropTypes.func + onClose: PropTypes.func, }; handleKeyUp = (e) => { e.preventDefault(); e.stopPropagation(); - const keyCode = e.keyCode + const keyCode = e.keyCode; if (this.props.active) { switch(keyCode) { case 27: diff --git a/app/javascript/mastodon/features/ui/components/video_modal.js b/app/javascript/mastodon/features/ui/components/video_modal.js @@ -8,7 +8,7 @@ import IconButton from '../../../components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ - close: { id: 'lightbox.close', defaultMessage: 'Close' } + close: { id: 'lightbox.close', defaultMessage: 'Close' }, }); class VideoModal extends ImmutablePureComponent { @@ -17,7 +17,7 @@ class VideoModal extends ImmutablePureComponent { media: ImmutablePropTypes.map.isRequired, time: PropTypes.number, onClose: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired + intl: PropTypes.object.isRequired, }; render () { diff --git a/app/javascript/mastodon/features/ui/containers/loading_bar_container.js b/app/javascript/mastodon/features/ui/containers/loading_bar_container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux'; import LoadingBar from 'react-redux-loading-bar'; const mapStateToProps = (state) => ({ - loading: state.get('loadingBar') + loading: state.get('loadingBar'), }); export default connect(mapStateToProps)(LoadingBar.WrappedComponent); diff --git a/app/javascript/mastodon/features/ui/containers/modal_container.js b/app/javascript/mastodon/features/ui/containers/modal_container.js @@ -4,7 +4,7 @@ import ModalRoot from '../components/modal_root'; const mapStateToProps = state => ({ type: state.get('modal').modalType, - props: state.get('modal').modalProps + props: state.get('modal').modalProps, }); const mapDispatchToProps = dispatch => ({ diff --git a/app/javascript/mastodon/features/ui/containers/notifications_container.js b/app/javascript/mastodon/features/ui/containers/notifications_container.js @@ -2,19 +2,19 @@ import { connect } from 'react-redux'; import { NotificationStack } from 'react-notification'; import { dismissAlert, - clearAlerts + clearAlerts, } from '../../../actions/alerts'; import { getAlerts } from '../../../selectors'; const mapStateToProps = (state, props) => ({ - notifications: getAlerts(state) + notifications: getAlerts(state), }); const mapDispatchToProps = (dispatch) => { return { onDismiss: alert => { dispatch(dismissAlert(alert)); - } + }, }; }; diff --git a/app/javascript/mastodon/features/ui/containers/status_list_container.js b/app/javascript/mastodon/features/ui/containers/status_list_container.js @@ -9,7 +9,7 @@ const makeGetStatusIds = () => createSelector([ (state, { type }) => state.getIn(['settings', type], Immutable.Map()), (state, { type }) => state.getIn(['timelines', type, 'items'], Immutable.List()), (state) => state.get('statuses'), - (state) => state.getIn(['meta', 'me']) + (state) => state.getIn(['meta', 'me']), ], (columnSettings, statusIds, statuses, me) => statusIds.filter(id => { const statusForId = statuses.get(id); let showStatus = true; @@ -45,7 +45,7 @@ const makeMapStateToProps = () => { statusIds: getStatusIds(state, props), isLoading: state.getIn(['timelines', props.type, 'isLoading'], true), isUnread: state.getIn(['timelines', props.type, 'unread']) > 0, - hasMore: !!state.getIn(['timelines', props.type, 'next']) + hasMore: !!state.getIn(['timelines', props.type, 'next']), }); return mapStateToProps; @@ -64,7 +64,7 @@ const mapDispatchToProps = (dispatch, { type, id }) => ({ onScroll: debounce(() => { dispatch(scrollTopTimeline(type, false)); - }, 100) + }, 100), }); diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js @@ -22,12 +22,12 @@ class UI extends React.PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, - children: PropTypes.node + children: PropTypes.node, }; state = { width: window.innerWidth, - draggingOver: false + draggingOver: false, }; handleResize = () => { diff --git a/app/javascript/mastodon/link_header.js b/app/javascript/mastodon/link_header.js @@ -2,32 +2,32 @@ import Link from 'http-link-header'; import querystring from 'querystring'; Link.parseAttrs = (link, parts) => { - let match = null - let attr = '' - let value = '' - let attrs = '' + let match = null; + let attr = ''; + let value = ''; + let attrs = ''; - let uriAttrs = /<(.*)>;\s*(.*)/gi.exec(parts) + let uriAttrs = /<(.*)>;\s*(.*)/gi.exec(parts); if(uriAttrs) { - attrs = uriAttrs[2] - link = Link.parseParams(link, uriAttrs[1]) + attrs = uriAttrs[2]; + link = Link.parseParams(link, uriAttrs[1]); } while(match = Link.attrPattern.exec(attrs)) { // eslint-disable-line no-cond-assign - attr = match[1].toLowerCase() - value = match[4] || match[3] || match[2] + attr = match[1].toLowerCase(); + value = match[4] || match[3] || match[2]; if( /\*$/.test(attr)) { - Link.setAttr(link, attr, Link.parseExtendedValue(value)) + Link.setAttr(link, attr, Link.parseExtendedValue(value)); } else if(/%/.test(value)) { - Link.setAttr(link, attr, querystring.decode(value)) + Link.setAttr(link, attr, querystring.decode(value)); } else { - Link.setAttr(link, attr, value) + Link.setAttr(link, attr, value); } } - return link + return link; }; export default Link; diff --git a/app/javascript/mastodon/locales/locale-data/oc.js b/app/javascript/mastodon/locales/locale-data/oc.js @@ -12,96 +12,96 @@ export default [{ relative: { 0: "ongan", 1: "l'an que ven", - "-1": "l'an passat" + "-1": "l'an passat", }, relativeTime: { future: { one: "dins {0} an", - other: "dins {0} ans" + other: "dins {0} ans", }, past: { one: "fa {0} an", - other: "fa {0} ans" - } - } + other: "fa {0} ans", + }, + }, }, month: { displayName: "mes", relative: { 0: "aqueste mes", 1: "lo mes que ven", - "-1": "lo mes passat" + "-1": "lo mes passat", }, relativeTime: { future: { one: "dins {0} mes", - other: "dins {0} meses" + other: "dins {0} meses", }, past: { one: "fa {0} mes", - other: "fa {0} meses" - } - } + other: "fa {0} meses", + }, + }, }, day: { displayName: "jorn", relative: { 0: "uèi", 1: "deman", - "-1": "ièr" + "-1": "ièr", }, relativeTime: { future: { one: "dins {0} jorn", - other: "dins {0} jorns" + other: "dins {0} jorns", }, past: { one: "fa {0} jorn", - other: "fa {0} jorns" - } - } + other: "fa {0} jorns", + }, + }, }, hour: { displayName: "ora", relativeTime: { future: { one: "dins {0} ora", - other: "dins {0} oras" + other: "dins {0} oras", }, past: { one: "fa {0} ora", - other: "fa {0} oras" - } - } + other: "fa {0} oras", + }, + }, }, minute: { displayName: "minuta", relativeTime: { future: { one: "dins {0} minuta", - other: "dins {0} minutas" + other: "dins {0} minutas", }, past: { one: "fa {0} minuta", - other: "fa {0} minutas" - } - } + other: "fa {0} minutas", + }, + }, }, second: { displayName: "segonda", relative: { - 0: "ara" + 0: "ara", }, relativeTime: { future: { one: "dins {0} segonda", - other: "dins {0} segondas" + other: "dins {0} segondas", }, past: { one: "fa {0} segonda", - other: "fa {0} segondas" - } - } - } - } -}] + other: "fa {0} segondas", + }, + }, + }, + }, +}]; diff --git a/app/javascript/mastodon/main.js b/app/javascript/mastodon/main.js @@ -32,4 +32,4 @@ function main() { }); } -export default main +export default main; diff --git a/app/javascript/mastodon/middleware/sounds.js b/app/javascript/mastodon/middleware/sounds.js @@ -7,7 +7,7 @@ const createAudio = sources => { audio.appendChild(source); }); return audio; -} +}; const play = audio => { if (!audio.paused) { @@ -27,7 +27,7 @@ export default function soundsMiddleware() { }, { src: '/sounds/boop.mp3', - type: 'audio/mpeg' + type: 'audio/mpeg', }, ]), }; diff --git a/app/javascript/mastodon/reducers/accounts.js b/app/javascript/mastodon/reducers/accounts.js @@ -7,15 +7,15 @@ import { ACCOUNT_TIMELINE_FETCH_SUCCESS, ACCOUNT_TIMELINE_EXPAND_SUCCESS, FOLLOW_REQUESTS_FETCH_SUCCESS, - FOLLOW_REQUESTS_EXPAND_SUCCESS + FOLLOW_REQUESTS_EXPAND_SUCCESS, } from '../actions/accounts'; import { BLOCKS_FETCH_SUCCESS, - BLOCKS_EXPAND_SUCCESS + BLOCKS_EXPAND_SUCCESS, } from '../actions/blocks'; import { MUTES_FETCH_SUCCESS, - MUTES_EXPAND_SUCCESS + MUTES_EXPAND_SUCCESS, } from '../actions/mutes'; import { COMPOSE_SUGGESTIONS_READY } from '../actions/compose'; import { @@ -24,26 +24,26 @@ import { FAVOURITE_SUCCESS, UNFAVOURITE_SUCCESS, REBLOGS_FETCH_SUCCESS, - FAVOURITES_FETCH_SUCCESS + FAVOURITES_FETCH_SUCCESS, } from '../actions/interactions'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, - TIMELINE_EXPAND_SUCCESS + TIMELINE_EXPAND_SUCCESS, } from '../actions/timelines'; import { STATUS_FETCH_SUCCESS, - CONTEXT_FETCH_SUCCESS + CONTEXT_FETCH_SUCCESS, } from '../actions/statuses'; import { SEARCH_FETCH_SUCCESS } from '../actions/search'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, - NOTIFICATIONS_EXPAND_SUCCESS + NOTIFICATIONS_EXPAND_SUCCESS, } from '../actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, - FAVOURITED_STATUSES_EXPAND_SUCCESS + FAVOURITED_STATUSES_EXPAND_SUCCESS, } from '../actions/favourites'; import { STORE_HYDRATE } from '../actions/store'; import Immutable from 'immutable'; @@ -55,7 +55,7 @@ const normalizeAccount = (state, account) => { delete account.following_count; delete account.statuses_count; - return state.set(account.id, Immutable.fromJS(account)) + return state.set(account.id, Immutable.fromJS(account)); }; const normalizeAccounts = (state, accounts) => { diff --git a/app/javascript/mastodon/reducers/accounts_counters.js b/app/javascript/mastodon/reducers/accounts_counters.js @@ -9,15 +9,15 @@ import { FOLLOW_REQUESTS_FETCH_SUCCESS, FOLLOW_REQUESTS_EXPAND_SUCCESS, ACCOUNT_FOLLOW_SUCCESS, - ACCOUNT_UNFOLLOW_SUCCESS + ACCOUNT_UNFOLLOW_SUCCESS, } from '../actions/accounts'; import { BLOCKS_FETCH_SUCCESS, - BLOCKS_EXPAND_SUCCESS + BLOCKS_EXPAND_SUCCESS, } from '../actions/blocks'; import { MUTES_FETCH_SUCCESS, - MUTES_EXPAND_SUCCESS + MUTES_EXPAND_SUCCESS, } from '../actions/mutes'; import { COMPOSE_SUGGESTIONS_READY } from '../actions/compose'; import { @@ -26,26 +26,26 @@ import { FAVOURITE_SUCCESS, UNFAVOURITE_SUCCESS, REBLOGS_FETCH_SUCCESS, - FAVOURITES_FETCH_SUCCESS + FAVOURITES_FETCH_SUCCESS, } from '../actions/interactions'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, - TIMELINE_EXPAND_SUCCESS + TIMELINE_EXPAND_SUCCESS, } from '../actions/timelines'; import { STATUS_FETCH_SUCCESS, - CONTEXT_FETCH_SUCCESS + CONTEXT_FETCH_SUCCESS, } from '../actions/statuses'; import { SEARCH_FETCH_SUCCESS } from '../actions/search'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, - NOTIFICATIONS_EXPAND_SUCCESS + NOTIFICATIONS_EXPAND_SUCCESS, } from '../actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, - FAVOURITED_STATUSES_EXPAND_SUCCESS + FAVOURITED_STATUSES_EXPAND_SUCCESS, } from '../actions/favourites'; import { STORE_HYDRATE } from '../actions/store'; import Immutable from 'immutable'; @@ -90,7 +90,7 @@ export default function accountsCounters(state = initialState, action) { return state.merge(action.state.get('accounts').map(item => Immutable.fromJS({ followers_count: item.get('followers_count'), following_count: item.get('following_count'), - statuses_count: item.get('statuses_count') + statuses_count: item.get('statuses_count'), }))); case ACCOUNT_FETCH_SUCCESS: case NOTIFICATIONS_UPDATE: diff --git a/app/javascript/mastodon/reducers/alerts.js b/app/javascript/mastodon/reducers/alerts.js @@ -1,7 +1,7 @@ import { ALERT_SHOW, ALERT_DISMISS, - ALERT_CLEAR + ALERT_CLEAR, } from '../actions/alerts'; import Immutable from 'immutable'; @@ -13,7 +13,7 @@ export default function alerts(state = initialState, action) { return state.push(Immutable.Map({ key: state.size > 0 ? state.last().get('key') + 1 : 0, title: action.title, - message: action.message + message: action.message, })); case ALERT_DISMISS: return state.filterNot(item => item.get('key') === action.alert.key); diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js @@ -21,7 +21,7 @@ import { COMPOSE_SPOILER_TEXT_CHANGE, COMPOSE_VISIBILITY_CHANGE, COMPOSE_LISTABILITY_CHANGE, - COMPOSE_EMOJI_INSERT + COMPOSE_EMOJI_INSERT, } from '../actions/compose'; import { TIMELINE_DELETE } from '../actions/timelines'; import { STORE_HYDRATE } from '../actions/store'; @@ -47,7 +47,7 @@ const initialState = Immutable.Map({ me: null, default_privacy: 'public', resetFileKey: Math.floor((Math.random() * 0x10000)), - idempotencyKey: null + idempotencyKey: null, }); function statusToTextMentions(state, status) { diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.js @@ -36,5 +36,5 @@ export default combineReducers({ notifications, settings, cards, - reports + reports, }); diff --git a/app/javascript/mastodon/reducers/meta.js b/app/javascript/mastodon/reducers/meta.js @@ -4,7 +4,7 @@ import Immutable from 'immutable'; const initialState = Immutable.Map({ streaming_api_base_url: null, access_token: null, - me: null + me: null, }); export default function meta(state = initialState, action) { diff --git a/app/javascript/mastodon/reducers/modal.js b/app/javascript/mastodon/reducers/modal.js @@ -3,7 +3,7 @@ import Immutable from 'immutable'; const initialState = { modalType: null, - modalProps: {} + modalProps: {}, }; export default function modal(state = initialState, action) { diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js @@ -7,7 +7,7 @@ import { NOTIFICATIONS_REFRESH_FAIL, NOTIFICATIONS_EXPAND_FAIL, NOTIFICATIONS_CLEAR, - NOTIFICATIONS_SCROLL_TOP + NOTIFICATIONS_SCROLL_TOP, } from '../actions/notifications'; import { ACCOUNT_BLOCK_SUCCESS } from '../actions/accounts'; import { TIMELINE_DELETE } from '../actions/timelines'; @@ -19,14 +19,14 @@ const initialState = Immutable.Map({ top: true, unread: 0, loaded: false, - isLoading: true + isLoading: true, }); const notificationToMap = notification => Immutable.Map({ id: notification.id, type: notification.type, account: notification.account.id, - status: notification.status ? notification.status.id : null + status: notification.status ? notification.status.id : null, }); const normalizeNotification = (state, notification) => { diff --git a/app/javascript/mastodon/reducers/relationships.js b/app/javascript/mastodon/reducers/relationships.js @@ -5,11 +5,11 @@ import { ACCOUNT_UNBLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS, ACCOUNT_UNMUTE_SUCCESS, - RELATIONSHIPS_FETCH_SUCCESS + RELATIONSHIPS_FETCH_SUCCESS, } from '../actions/accounts'; import { DOMAIN_BLOCK_SUCCESS, - DOMAIN_UNBLOCK_SUCCESS + DOMAIN_UNBLOCK_SUCCESS, } from '../actions/domain_blocks'; import Immutable from 'immutable'; diff --git a/app/javascript/mastodon/reducers/reports.js b/app/javascript/mastodon/reducers/reports.js @@ -5,7 +5,7 @@ import { REPORT_SUBMIT_FAIL, REPORT_CANCEL, REPORT_STATUS_TOGGLE, - REPORT_COMMENT_CHANGE + REPORT_COMMENT_CHANGE, } from '../actions/reports'; import Immutable from 'immutable'; @@ -14,8 +14,8 @@ const initialState = Immutable.Map({ isSubmitting: false, account_id: null, status_ids: Immutable.Set(), - comment: '' - }) + comment: '', + }), }); export default function reports(state = initialState, action) { diff --git a/app/javascript/mastodon/reducers/search.js b/app/javascript/mastodon/reducers/search.js @@ -2,7 +2,7 @@ import { SEARCH_CHANGE, SEARCH_CLEAR, SEARCH_FETCH_SUCCESS, - SEARCH_SHOW + SEARCH_SHOW, } from '../actions/search'; import { COMPOSE_MENTION, COMPOSE_REPLY } from '../actions/compose'; import Immutable from 'immutable'; @@ -11,7 +11,7 @@ const initialState = Immutable.Map({ value: '', submitted: false, hidden: false, - results: Immutable.Map() + results: Immutable.Map(), }); const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => { @@ -23,8 +23,8 @@ const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => { items: accounts.map(item => ({ type: 'account', id: item.id, - value: item.acct - })) + value: item.acct, + })), }); } @@ -32,21 +32,21 @@ const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => { let hashtagItems = hashtags.map(item => ({ type: 'hashtag', id: item, - value: `#${item}` + value: `#${item}`, })); if (value.indexOf('@') === -1 && value.indexOf(' ') === -1 && !value.startsWith('http://') && !value.startsWith('https://') && hashtags.indexOf(value) === -1) { hashtagItems.unshift({ type: 'hashtag', id: value, - value: `#${value}` + value: `#${value}`, }); } if (hashtagItems.length > 0) { newSuggestions.push({ title: 'hashtag', - items: hashtagItems + items: hashtagItems, }); } } @@ -57,8 +57,8 @@ const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => { items: statuses.map(item => ({ type: 'status', id: item.id, - value: item.id - })) + value: item.id, + })), }); } @@ -88,7 +88,7 @@ export default function search(state = initialState, action) { return state.set('results', Immutable.Map({ accounts: Immutable.List(action.results.accounts.map(item => item.id)), statuses: Immutable.List(action.results.statuses.map(item => item.id)), - hashtags: Immutable.List(action.results.hashtags) + hashtags: Immutable.List(action.results.hashtags), })).set('submitted', true); default: return state; diff --git a/app/javascript/mastodon/reducers/settings.js b/app/javascript/mastodon/reducers/settings.js @@ -8,12 +8,12 @@ const initialState = Immutable.Map({ home: Immutable.Map({ shows: Immutable.Map({ reblog: true, - reply: true + reply: true, }), regex: Immutable.Map({ - body: '' - }) + body: '', + }), }), notifications: Immutable.Map({ @@ -21,23 +21,23 @@ const initialState = Immutable.Map({ follow: true, favourite: true, reblog: true, - mention: true + mention: true, }), shows: Immutable.Map({ follow: true, favourite: true, reblog: true, - mention: true + mention: true, }), sounds: Immutable.Map({ follow: true, favourite: true, reblog: true, - mention: true - }) - }) + mention: true, + }), + }), }); export default function settings(state = initialState, action) { diff --git a/app/javascript/mastodon/reducers/status_lists.js b/app/javascript/mastodon/reducers/status_lists.js @@ -1,6 +1,6 @@ import { FAVOURITED_STATUSES_FETCH_SUCCESS, - FAVOURITED_STATUSES_EXPAND_SUCCESS + FAVOURITED_STATUSES_EXPAND_SUCCESS, } from '../actions/favourites'; import Immutable from 'immutable'; @@ -8,8 +8,8 @@ const initialState = Immutable.Map({ favourites: Immutable.Map({ next: null, loaded: false, - items: Immutable.List() - }) + items: Immutable.List(), + }), }); const normalizeList = (state, listType, statuses, next) => { diff --git a/app/javascript/mastodon/reducers/statuses.js b/app/javascript/mastodon/reducers/statuses.js @@ -6,35 +6,35 @@ import { FAVOURITE_REQUEST, FAVOURITE_SUCCESS, FAVOURITE_FAIL, - UNFAVOURITE_SUCCESS + UNFAVOURITE_SUCCESS, } from '../actions/interactions'; import { STATUS_FETCH_SUCCESS, CONTEXT_FETCH_SUCCESS, STATUS_MUTE_SUCCESS, - STATUS_UNMUTE_SUCCESS + STATUS_UNMUTE_SUCCESS, } from '../actions/statuses'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, TIMELINE_DELETE, - TIMELINE_EXPAND_SUCCESS + TIMELINE_EXPAND_SUCCESS, } from '../actions/timelines'; import { ACCOUNT_TIMELINE_FETCH_SUCCESS, ACCOUNT_TIMELINE_EXPAND_SUCCESS, ACCOUNT_MEDIA_TIMELINE_FETCH_SUCCESS, ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS, - ACCOUNT_BLOCK_SUCCESS + ACCOUNT_BLOCK_SUCCESS, } from '../actions/accounts'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, - NOTIFICATIONS_EXPAND_SUCCESS + NOTIFICATIONS_EXPAND_SUCCESS, } from '../actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, - FAVOURITED_STATUSES_EXPAND_SUCCESS + FAVOURITED_STATUSES_EXPAND_SUCCESS, } from '../actions/favourites'; import { SEARCH_FETCH_SUCCESS } from '../actions/search'; import Immutable from 'immutable'; diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/mastodon/reducers/timelines.js @@ -9,13 +9,13 @@ import { TIMELINE_EXPAND_FAIL, TIMELINE_SCROLL_TOP, TIMELINE_CONNECT, - TIMELINE_DISCONNECT + TIMELINE_DISCONNECT, } from '../actions/timelines'; import { REBLOG_SUCCESS, UNREBLOG_SUCCESS, FAVOURITE_SUCCESS, - UNFAVOURITE_SUCCESS + UNFAVOURITE_SUCCESS, } from '../actions/interactions'; import { ACCOUNT_TIMELINE_FETCH_REQUEST, @@ -31,10 +31,10 @@ import { ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS, ACCOUNT_MEDIA_TIMELINE_EXPAND_FAIL, ACCOUNT_BLOCK_SUCCESS, - ACCOUNT_MUTE_SUCCESS + ACCOUNT_MUTE_SUCCESS, } from '../actions/accounts'; import { - CONTEXT_FETCH_SUCCESS + CONTEXT_FETCH_SUCCESS, } from '../actions/statuses'; import Immutable from 'immutable'; @@ -47,7 +47,7 @@ const initialState = Immutable.Map({ loaded: false, top: true, unread: 0, - items: Immutable.List() + items: Immutable.List(), }), public: Immutable.Map({ @@ -58,7 +58,7 @@ const initialState = Immutable.Map({ loaded: false, top: true, unread: 0, - items: Immutable.List() + items: Immutable.List(), }), community: Immutable.Map({ @@ -70,7 +70,7 @@ const initialState = Immutable.Map({ loaded: false, top: true, unread: 0, - items: Immutable.List() + items: Immutable.List(), }), tag: Immutable.Map({ @@ -81,13 +81,13 @@ const initialState = Immutable.Map({ loaded: false, top: true, unread: 0, - items: Immutable.List() + items: Immutable.List(), }), accounts_timelines: Immutable.Map(), accounts_media_timelines: Immutable.Map(), ancestors: Immutable.Map(), - descendants: Immutable.Map() + descendants: Immutable.Map(), }); const normalizeStatus = (state, status) => { diff --git a/app/javascript/mastodon/reducers/user_lists.js b/app/javascript/mastodon/reducers/user_lists.js @@ -6,19 +6,19 @@ import { FOLLOW_REQUESTS_FETCH_SUCCESS, FOLLOW_REQUESTS_EXPAND_SUCCESS, FOLLOW_REQUEST_AUTHORIZE_SUCCESS, - FOLLOW_REQUEST_REJECT_SUCCESS + FOLLOW_REQUEST_REJECT_SUCCESS, } from '../actions/accounts'; import { REBLOGS_FETCH_SUCCESS, - FAVOURITES_FETCH_SUCCESS + FAVOURITES_FETCH_SUCCESS, } from '../actions/interactions'; import { BLOCKS_FETCH_SUCCESS, - BLOCKS_EXPAND_SUCCESS + BLOCKS_EXPAND_SUCCESS, } from '../actions/blocks'; import { MUTES_FETCH_SUCCESS, - MUTES_EXPAND_SUCCESS + MUTES_EXPAND_SUCCESS, } from '../actions/mutes'; import Immutable from 'immutable'; @@ -29,13 +29,13 @@ const initialState = Immutable.Map({ favourited_by: Immutable.Map(), follow_requests: Immutable.Map(), blocks: Immutable.Map(), - mutes: Immutable.Map() + mutes: Immutable.Map(), }); const normalizeList = (state, type, id, accounts, next) => { return state.setIn([type, id], Immutable.Map({ next, - items: Immutable.List(accounts.map(item => item.id)) + items: Immutable.List(accounts.map(item => item.id)), })); }; diff --git a/app/javascript/mastodon/selectors/index.js b/app/javascript/mastodon/selectors/index.js @@ -58,8 +58,8 @@ export const getAlerts = createSelector([getAlertsBase], (base) => { key: item.get('key'), dismissAfter: 5000, barStyle: { - zIndex: 200 - } + zIndex: 200, + }, }); }); @@ -69,7 +69,7 @@ export const getAlerts = createSelector([getAlertsBase], (base) => { export const makeGetNotification = () => { return createSelector([ (_, base) => base, - (state, _, accountId) => state.getIn(['accounts', accountId]) + (state, _, accountId) => state.getIn(['accounts', accountId]), ], (base, account) => { return base.set('account', account); }); diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js @@ -4,7 +4,7 @@ if (!window.Intl || !Object.assign || !Number.isNaN || !window.Symbol || !Array.prototype.includes) { // load polyfills dynamically import('../mastodon/polyfills').then(main).catch(e => { - console.error(e) // eslint-disable-line no-console + console.error(e); // eslint-disable-line no-console }); } else { main(); diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js @@ -96,12 +96,12 @@ document.addEventListener('DOMContentLoaded', () => { }); delegate(document, '.account_display_name', 'input', ({ target }) => { - const [nameCounter, ] = document.getElementsByClassName('name-counter'); + const [nameCounter ] = document.getElementsByClassName('name-counter'); nameCounter.textContent = 30 - length(target.value); }); delegate(document, '.account_note', 'input', ({ target }) => { - const [noteCounter, ] = document.getElementsByClassName('note-counter'); + const [noteCounter ] = document.getElementsByClassName('note-counter'); noteCounter.textContent = 160 - length(target.value); }); }); diff --git a/config/webpack/configuration.js b/config/webpack/configuration.js @@ -1,20 +1,20 @@ // Common configuration for webpacker loaded from config/webpack/paths.yml -const { join, resolve } = require('path') -const { env } = require('process') -const { safeLoad } = require('js-yaml') -const { readFileSync } = require('fs') +const { join, resolve } = require('path'); +const { env } = require('process'); +const { safeLoad } = require('js-yaml'); +const { readFileSync } = require('fs'); -const configPath = resolve('config', 'webpack') -const loadersDir = join(__dirname, 'loaders') -const paths = safeLoad(readFileSync(join(configPath, 'paths.yml'), 'utf8'))[env.NODE_ENV || 'development'] -const devServer = safeLoad(readFileSync(join(configPath, 'development.server.yml'), 'utf8'))[env.NODE_ENV || 'development'] +const configPath = resolve('config', 'webpack'); +const loadersDir = join(__dirname, 'loaders'); +const paths = safeLoad(readFileSync(join(configPath, 'paths.yml'), 'utf8'))[env.NODE_ENV || 'development']; +const devServer = safeLoad(readFileSync(join(configPath, 'development.server.yml'), 'utf8'))[env.NODE_ENV || 'development']; // Compute public path based on environment and CDN_HOST in production -const ifHasCDN = env.CDN_HOST !== undefined && env.NODE_ENV === 'production' -const devServerUrl = `http://${devServer.host}:${devServer.port}/${paths.entry}/` -const publicUrl = ifHasCDN ? `${env.CDN_HOST}/${paths.entry}/` : `/${paths.entry}/` -const publicPath = env.NODE_ENV !== 'production' ? devServerUrl : publicUrl +const ifHasCDN = env.CDN_HOST !== undefined && env.NODE_ENV === 'production'; +const devServerUrl = `http://${devServer.host}:${devServer.port}/${paths.entry}/`; +const publicUrl = ifHasCDN ? `${env.CDN_HOST}/${paths.entry}/` : `/${paths.entry}/`; +const publicPath = env.NODE_ENV !== 'production' ? devServerUrl : publicUrl; module.exports = { devServer, @@ -22,5 +22,5 @@ module.exports = { paths, loadersDir, publicUrl, - publicPath -} + publicPath, +}; diff --git a/config/webpack/development.js b/config/webpack/development.js @@ -1,16 +1,16 @@ // Note: You must restart bin/webpack-dev-server for changes to take effect -const merge = require('webpack-merge') -const sharedConfig = require('./shared.js') +const merge = require('webpack-merge'); +const sharedConfig = require('./shared.js'); module.exports = merge(sharedConfig, { devtool: 'cheap-module-eval-source-map', stats: { - errorDetails: true + errorDetails: true, }, output: { - pathinfo: true - } -}) + pathinfo: true, + }, +}); diff --git a/config/webpack/development.server.js b/config/webpack/development.server.js @@ -1,9 +1,9 @@ // Note: You must restart bin/webpack-dev-server for changes to take effect -const { resolve } = require('path') -const merge = require('webpack-merge') -const devConfig = require('./development.js') -const { devServer, publicPath, paths } = require('./configuration.js') +const { resolve } = require('path'); +const merge = require('webpack-merge'); +const devConfig = require('./development.js'); +const { devServer, publicPath, paths } = require('./configuration.js'); module.exports = merge(devConfig, { devServer: { @@ -14,6 +14,6 @@ module.exports = merge(devConfig, { historyApiFallback: true, contentBase: resolve(paths.output, paths.entry), publicPath, - disableHostCheck: true - } -}) + disableHostCheck: true, + }, +}); diff --git a/config/webpack/loaders/assets.js b/config/webpack/loaders/assets.js @@ -1,4 +1,4 @@ -const { env, publicPath } = require('../configuration.js') +const { env, publicPath } = require('../configuration.js'); module.exports = { test: /\.(jpg|jpeg|png|gif|svg|eot|ttf|woff|woff2)$/i, @@ -6,7 +6,7 @@ module.exports = { loader: 'file-loader', options: { publicPath, - name: env.NODE_ENV === 'production' ? '[name]-[hash].[ext]' : '[name].[ext]' - } - }] -} + name: env.NODE_ENV === 'production' ? '[name]-[hash].[ext]' : '[name].[ext]', + }, + }], +}; diff --git a/config/webpack/loaders/babel.js b/config/webpack/loaders/babel.js @@ -3,6 +3,6 @@ module.exports = { exclude: /node_modules/, loader: 'babel-loader', options: { - forceEnv: process.env.NODE_ENV || 'development' - } -} + forceEnv: process.env.NODE_ENV || 'development', + }, +}; diff --git a/config/webpack/loaders/coffee.js b/config/webpack/loaders/coffee.js @@ -1,4 +1,4 @@ module.exports = { test: /\.coffee(\.erb)?$/, - loader: 'coffee-loader' -} + loader: 'coffee-loader', +}; diff --git a/config/webpack/loaders/erb.js b/config/webpack/loaders/erb.js @@ -4,6 +4,6 @@ module.exports = { exclude: /node_modules/, loader: 'rails-erb-loader', options: { - runner: 'bin/rails runner' - } -} + runner: 'bin/rails runner', + }, +}; diff --git a/config/webpack/loaders/sass.js b/config/webpack/loaders/sass.js @@ -1,5 +1,5 @@ -const ExtractTextPlugin = require('extract-text-webpack-plugin') -const { env } = require('../configuration.js') +const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const { env } = require('../configuration.js'); module.exports = { test: /\.(scss|sass|css)$/i, @@ -8,7 +8,7 @@ module.exports = { use: [ { loader: 'css-loader', options: { minimize: env.NODE_ENV === 'production' } }, 'postcss-loader', - 'sass-loader' - ] - }) -} + 'sass-loader', + ], + }), +}; diff --git a/config/webpack/production.js b/config/webpack/production.js @@ -2,10 +2,10 @@ /* eslint global-require: 0 */ -const webpack = require('webpack') -const merge = require('webpack-merge') -const CompressionPlugin = require('compression-webpack-plugin') -const sharedConfig = require('./shared.js') +const webpack = require('webpack'); +const merge = require('webpack-merge'); +const CompressionPlugin = require('compression-webpack-plugin'); +const sharedConfig = require('./shared.js'); module.exports = merge(sharedConfig, { @@ -19,15 +19,15 @@ module.exports = merge(sharedConfig, { mangle: true, output: { - comments: false + comments: false, }, - sourceMap: true + sourceMap: true, }), new CompressionPlugin({ asset: '[path].gz[query]', algorithm: 'gzip', - test: /\.(js|css|svg|eot|ttf|woff|woff2)$/ - }) - ] -}) + test: /\.(js|css|svg|eot|ttf|woff|woff2)$/, + }), + ], +}); diff --git a/config/webpack/shared.js b/config/webpack/shared.js @@ -3,24 +3,24 @@ /* eslint global-require: 0 */ /* eslint import/no-dynamic-require: 0 */ -const webpack = require('webpack') -const { basename, dirname, join, relative, resolve } = require('path') -const { sync } = require('glob') -const ExtractTextPlugin = require('extract-text-webpack-plugin') -const ManifestPlugin = require('webpack-manifest-plugin') -const extname = require('path-complete-extname') -const { env, paths, publicPath, loadersDir } = require('./configuration.js') +const webpack = require('webpack'); +const { basename, dirname, join, relative, resolve } = require('path'); +const { sync } = require('glob'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const ManifestPlugin = require('webpack-manifest-plugin'); +const extname = require('path-complete-extname'); +const { env, paths, publicPath, loadersDir } = require('./configuration.js'); -const extensionGlob = `**/*{${paths.extensions.join(',')}}*` -const packPaths = sync(join(paths.source, paths.entry, extensionGlob)) +const extensionGlob = `**/*{${paths.extensions.join(',')}}*`; +const packPaths = sync(join(paths.source, paths.entry, extensionGlob)); module.exports = { entry: packPaths.reduce( (map, entry) => { - const localMap = map - const namespace = relative(join(paths.source, paths.entry), dirname(entry)) - localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry) - return localMap + const localMap = map; + const namespace = relative(join(paths.source, paths.entry), dirname(entry)); + localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry); + return localMap; }, {} ), @@ -28,11 +28,11 @@ module.exports = { filename: '[name].js', chunkFilename: '[name]-[chunkhash].js', path: resolve(paths.output, paths.entry), - publicPath + publicPath, }, module: { - rules: sync(join(loadersDir, '*.js')).map(loader => require(loader)) + rules: sync(join(loadersDir, '*.js')).map(loader => require(loader)), }, plugins: [ @@ -41,25 +41,25 @@ module.exports = { new ManifestPlugin({ fileName: paths.manifest, publicPath, writeToFileEmit: true }), new webpack.optimize.CommonsChunkPlugin({ name: 'common', - minChunks: 2 - }) + minChunks: 2, + }), ], resolve: { extensions: paths.extensions, modules: [ resolve(paths.source), - resolve(paths.node_modules) - ] + resolve(paths.node_modules), + ], }, resolveLoader: { - modules: [paths.node_modules] + modules: [paths.node_modules], }, node: { // Called by http-link-header in an API we never use, increases // bundle size unnecessarily - Buffer: false - } -} + Buffer: false, + }, +}; diff --git a/config/webpack/test.js b/config/webpack/test.js @@ -1,6 +1,6 @@ // Note: You must restart bin/webpack-dev-server for changes to take effect -const merge = require('webpack-merge') -const sharedConfig = require('./shared.js') +const merge = require('webpack-merge'); +const sharedConfig = require('./shared.js'); -module.exports = merge(sharedConfig, {}) +module.exports = merge(sharedConfig, {}); diff --git a/config/webpack/translationRunner.js b/config/webpack/translationRunner.js @@ -7,16 +7,16 @@ const testRFC5626 = function (reRFC5646) { if (!language.match(reRFC5646)) { throw new Error('Not RFC5626 name'); } - } -} + }; +}; const testAvailability = function (availableLanguages) { return function (language) { if ((argv.force !== true) && availableLanguages.indexOf(language) < 0) { throw new Error('Not an available language'); } - } -} + }; +}; const validateLanguages = function (languages, validators) { let invalidLanguages = languages.reduce((acc, language) => { @@ -41,7 +41,7 @@ const validateLanguages = function (languages, validators) { console.log(`\nUse yarn "manage:translations -- --help" for usage information\n`); process.exit(1); } -} +}; const printHelpMessages = function () { console.log( @@ -62,13 +62,13 @@ to input multiple languages, separate them with space. Available languages: ${availableLanguages} `); -} +}; // parse arguments const argv = require('minimist')(process.argv.slice(2), { 'boolean': [ 'force', - 'help' + 'help', ], 'alias': { 'f': 'force', diff --git a/package.json b/package.json @@ -9,7 +9,7 @@ "start": "babel-node ./streaming/index.js", "storybook": "start-storybook -p 9001 -c storybook", "test": "npm run test:lint && npm run test:mocha", - "test:lint": "eslint -c .eslintrc.yml --ext=js --ext=jsx app/javascript/", + "test:lint": "eslint -c .eslintrc.yml --ext=js app/javascript/ config/webpack/ storyboard/ streaming/", "test:mocha": "NODE_ENV=test mocha --require ./spec/javascript/setup.js --compilers js:babel-register ./spec/javascript/components/*.test.jsx", "postinstall": "npm rebuild node-sass" }, diff --git a/storybook/config.js b/storybook/config.js @@ -13,7 +13,7 @@ addLocaleData(en); let req = require.context('./stories/', true, /.story.js$/); function loadStories () { - req.keys().forEach((filename) => req(filename)) + req.keys().forEach((filename) => req(filename)); } configure(loadStories, module); diff --git a/storybook/stories/autosuggest_textarea.story.js b/storybook/stories/autosuggest_textarea.story.js @@ -1,7 +1,7 @@ import React from 'react'; -import { List } from 'immutable' +import { List } from 'immutable'; import { action, storiesOf } from '@kadira/storybook'; -import AutosuggestTextarea from 'mastodon/components/autosuggest_textarea' +import AutosuggestTextarea from 'mastodon/components/autosuggest_textarea'; const props = { onChange: action('changed'), @@ -9,9 +9,9 @@ const props = { onSuggestionSelected: action('suggestionsSelected'), onSuggestionsClearRequested: action('suggestionsClearRequested'), onSuggestionsFetchRequested: action('suggestionsFetchRequested'), - suggestions: List([]) -} + suggestions: List([]), +}; storiesOf('AutosuggestTextarea', module) .add('default state', () => <AutosuggestTextarea value='' {...props} />) - .add('with text', () => <AutosuggestTextarea value='Hello' {...props} />) + .add('with text', () => <AutosuggestTextarea value='Hello' {...props} />); diff --git a/storybook/webpack.config.js b/storybook/webpack.config.js @@ -5,19 +5,19 @@ module.exports = { loaders: [ { test: /\.(jpg|jpeg|png|gif|svg|eot|ttf|woff|woff2)$/i, - loader: 'url-loader' + loader: 'url-loader', }, { test: /.scss$/, - loaders: ["style-loader", "css-loader", "postcss-loader", "sass-loader"] - } - ] + loaders: ["style-loader", "css-loader", "postcss-loader", "sass-loader"], + }, + ], }, resolve: { modulesDirectories: [ path.resolve(__dirname, '..', 'storybook'), path.resolve(__dirname, '..', 'app', 'javascript'), - path.resolve(__dirname, '..', 'node_modules') - ] - } + path.resolve(__dirname, '..', 'node_modules'), + ], + }, }; diff --git a/streaming/index.js b/streaming/index.js @@ -1,56 +1,56 @@ import os from 'os'; import cluster from 'cluster'; -import dotenv from 'dotenv' -import express from 'express' -import http from 'http' -import redis from 'redis' -import pg from 'pg' -import log from 'npmlog' -import url from 'url' -import WebSocket from 'uws' -import uuid from 'uuid' - -const env = process.env.NODE_ENV || 'development' +import dotenv from 'dotenv'; +import express from 'express'; +import http from 'http'; +import redis from 'redis'; +import pg from 'pg'; +import log from 'npmlog'; +import url from 'url'; +import WebSocket from 'uws'; +import uuid from 'uuid'; + +const env = process.env.NODE_ENV || 'development'; dotenv.config({ - path: env === 'production' ? '.env.production' : '.env' -}) + path: env === 'production' ? '.env.production' : '.env', +}); const dbUrlToConfig = (dbUrl) => { if (!dbUrl) { - return {} + return {}; } - const params = url.parse(dbUrl) - const config = {} + const params = url.parse(dbUrl); + const config = {}; if (params.auth) { - [config.user, config.password] = params.auth.split(':') + [config.user, config.password] = params.auth.split(':'); } if (params.hostname) { - config.host = params.hostname + config.host = params.hostname; } if (params.port) { - config.port = params.port + config.port = params.port; } if (params.pathname) { - config.database = params.pathname.split('/')[1] + config.database = params.pathname.split('/')[1]; } - const ssl = params.query && params.query.ssl + const ssl = params.query && params.query.ssl; if (ssl) { - config.ssl = ssl === 'true' || ssl === '1' + config.ssl = ssl === 'true' || ssl === '1'; } - return config -} + return config; +}; if (cluster.isMaster) { // Cluster master - const core = +process.env.STREAMING_CLUSTER_NUM || (env === 'development' ? 1 : Math.max(os.cpus().length - 1, 1)) + const core = +process.env.STREAMING_CLUSTER_NUM || (env === 'development' ? 1 : Math.max(os.cpus().length - 1, 1)); const fork = () => { const worker = cluster.fork(); @@ -63,14 +63,14 @@ if (cluster.isMaster) { for (let i = 0; i < core; i++) fork(); - log.info(`Starting streaming API server master with ${core} workers`) + log.info(`Starting streaming API server master with ${core} workers`); } else { // Cluster worker const pgConfigs = { development: { database: 'mastodon_development', host: '/var/run/postgresql', - max: 10 + max: 10, }, production: { @@ -79,315 +79,315 @@ if (cluster.isMaster) { database: process.env.DB_NAME || 'mastodon_production', host: process.env.DB_HOST || 'localhost', port: process.env.DB_PORT || 5432, - max: 10 - } - } + max: 10, + }, + }; - const app = express() - const pgPool = new pg.Pool(Object.assign(pgConfigs[env], dbUrlToConfig(process.env.DATABASE_URL))) - const server = http.createServer(app) - const wss = new WebSocket.Server({ server }) - const redisNamespace = process.env.REDIS_NAMESPACE || null + const app = express(); + const pgPool = new pg.Pool(Object.assign(pgConfigs[env], dbUrlToConfig(process.env.DATABASE_URL))); + const server = http.createServer(app); + const wss = new WebSocket.Server({ server }); + const redisNamespace = process.env.REDIS_NAMESPACE || null; const redisParams = { host: process.env.REDIS_HOST || '127.0.0.1', port: process.env.REDIS_PORT || 6379, db: process.env.REDIS_DB || 0, password: process.env.REDIS_PASSWORD, - url: process.env.REDIS_URL || null - } + url: process.env.REDIS_URL || null, + }; if (redisNamespace) { - redisParams.namespace = redisNamespace + redisParams.namespace = redisNamespace; } - const redisPrefix = redisNamespace ? `${redisNamespace}:` : '' + const redisPrefix = redisNamespace ? `${redisNamespace}:` : ''; - const redisClient = redis.createClient(redisParams) + const redisClient = redis.createClient(redisParams); - const subs = {} + const subs = {}; redisClient.on('pmessage', (_, channel, message) => { - const callbacks = subs[channel] + const callbacks = subs[channel]; - log.silly(`New message on channel ${channel}`) + log.silly(`New message on channel ${channel}`); if (!callbacks) { - return + return; } - callbacks.forEach(callback => callback(message)) - }) + callbacks.forEach(callback => callback(message)); + }); - redisClient.psubscribe(`${redisPrefix}timeline:*`) + redisClient.psubscribe(`${redisPrefix}timeline:*`); const subscribe = (channel, callback) => { - log.silly(`Adding listener for ${channel}`) - subs[channel] = subs[channel] || [] - subs[channel].push(callback) - } + log.silly(`Adding listener for ${channel}`); + subs[channel] = subs[channel] || []; + subs[channel].push(callback); + }; const unsubscribe = (channel, callback) => { - log.silly(`Removing listener for ${channel}`) - subs[channel] = subs[channel].filter(item => item !== callback) - } + log.silly(`Removing listener for ${channel}`); + subs[channel] = subs[channel].filter(item => item !== callback); + }; const allowCrossDomain = (req, res, next) => { - res.header('Access-Control-Allow-Origin', '*') - res.header('Access-Control-Allow-Headers', 'Authorization, Accept, Cache-Control') - res.header('Access-Control-Allow-Methods', 'GET, OPTIONS') + res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Headers', 'Authorization, Accept, Cache-Control'); + res.header('Access-Control-Allow-Methods', 'GET, OPTIONS'); - next() - } + next(); + }; const setRequestId = (req, res, next) => { - req.requestId = uuid.v4() - res.header('X-Request-Id', req.requestId) + req.requestId = uuid.v4(); + res.header('X-Request-Id', req.requestId); - next() - } + next(); + }; const accountFromToken = (token, req, next) => { pgPool.connect((err, client, done) => { if (err) { - next(err) - return + next(err); + return; } client.query('SELECT oauth_access_tokens.resource_owner_id, users.account_id FROM oauth_access_tokens INNER JOIN users ON oauth_access_tokens.resource_owner_id = users.id WHERE oauth_access_tokens.token = $1 LIMIT 1', [token], (err, result) => { - done() + done(); if (err) { - next(err) - return + next(err); + return; } if (result.rows.length === 0) { - err = new Error('Invalid access token') - err.statusCode = 401 + err = new Error('Invalid access token'); + err.statusCode = 401; - next(err) - return + next(err); + return; } - req.accountId = result.rows[0].account_id + req.accountId = result.rows[0].account_id; - next() - }) - }) - } + next(); + }); + }); + }; const authenticationMiddleware = (req, res, next) => { if (req.method === 'OPTIONS') { - next() - return + next(); + return; } - const authorization = req.get('Authorization') + const authorization = req.get('Authorization'); if (!authorization) { - const err = new Error('Missing access token') - err.statusCode = 401 + const err = new Error('Missing access token'); + err.statusCode = 401; - next(err) - return + next(err); + return; } - const token = authorization.replace(/^Bearer /, '') + const token = authorization.replace(/^Bearer /, ''); - accountFromToken(token, req, next) - } + accountFromToken(token, req, next); + }; const errorMiddleware = (err, req, res, next) => { - log.error(req.requestId, err) - res.writeHead(err.statusCode || 500, { 'Content-Type': 'application/json' }) - res.end(JSON.stringify({ error: err.statusCode ? `${err}` : 'An unexpected error occurred' })) - } + log.error(req.requestId, err); + res.writeHead(err.statusCode || 500, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ error: err.statusCode ? `${err}` : 'An unexpected error occurred' })); + }; const placeholders = (arr, shift = 0) => arr.map((_, i) => `$${i + 1 + shift}`).join(', '); const streamFrom = (id, req, output, attachCloseHandler, needsFiltering = false) => { - log.verbose(req.requestId, `Starting stream from ${id} for ${req.accountId}`) + log.verbose(req.requestId, `Starting stream from ${id} for ${req.accountId}`); const listener = message => { - const { event, payload, queued_at } = JSON.parse(message) + const { event, payload, queued_at } = JSON.parse(message); const transmit = () => { - const now = new Date().getTime() + const now = new Date().getTime(); const delta = now - queued_at; - log.silly(req.requestId, `Transmitting for ${req.accountId}: ${event} ${payload} Delay: ${delta}ms`) - output(event, payload) - } + log.silly(req.requestId, `Transmitting for ${req.accountId}: ${event} ${payload} Delay: ${delta}ms`); + output(event, payload); + }; // Only messages that may require filtering are statuses, since notifications // are already personalized and deletes do not matter if (needsFiltering && event === 'update') { pgPool.connect((err, client, done) => { if (err) { - log.error(err) - return + log.error(err); + return; } - const unpackedPayload = JSON.parse(payload) - const targetAccountIds = [unpackedPayload.account.id].concat(unpackedPayload.mentions.map(item => item.id)).concat(unpackedPayload.reblog ? [unpackedPayload.reblog.account.id] : []) - const accountDomain = unpackedPayload.account.acct.split('@')[1] + const unpackedPayload = JSON.parse(payload); + const targetAccountIds = [unpackedPayload.account.id].concat(unpackedPayload.mentions.map(item => item.id)).concat(unpackedPayload.reblog ? [unpackedPayload.reblog.account.id] : []); + const accountDomain = unpackedPayload.account.acct.split('@')[1]; const queries = [ client.query(`SELECT 1 FROM blocks WHERE account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 1)}) UNION SELECT 1 FROM mutes WHERE account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 1)})`, [req.accountId].concat(targetAccountIds)), - ] + ]; if (accountDomain) { - queries.push(client.query('SELECT 1 FROM account_domain_blocks WHERE account_id = $1 AND domain = $2', [req.accountId, accountDomain])) + queries.push(client.query('SELECT 1 FROM account_domain_blocks WHERE account_id = $1 AND domain = $2', [req.accountId, accountDomain])); } Promise.all(queries).then(values => { - done() + done(); if (values[0].rows.length > 0 || (values.length > 1 && values[1].rows.length > 0)) { - return + return; } - transmit() + transmit(); }).catch(err => { - log.error(err) - }) - }) + log.error(err); + }); + }); } else { - transmit() + transmit(); } - } + }; - subscribe(`${redisPrefix}${id}`, listener) - attachCloseHandler(`${redisPrefix}${id}`, listener) - } + subscribe(`${redisPrefix}${id}`, listener); + attachCloseHandler(`${redisPrefix}${id}`, listener); + }; // Setup stream output to HTTP const streamToHttp = (req, res) => { - res.setHeader('Content-Type', 'text/event-stream') - res.setHeader('Transfer-Encoding', 'chunked') + res.setHeader('Content-Type', 'text/event-stream'); + res.setHeader('Transfer-Encoding', 'chunked'); - const heartbeat = setInterval(() => res.write(':thump\n'), 15000) + const heartbeat = setInterval(() => res.write(':thump\n'), 15000); req.on('close', () => { - log.verbose(req.requestId, `Ending stream for ${req.accountId}`) - clearInterval(heartbeat) - }) + log.verbose(req.requestId, `Ending stream for ${req.accountId}`); + clearInterval(heartbeat); + }); return (event, payload) => { - res.write(`event: ${event}\n`) - res.write(`data: ${payload}\n\n`) - } - } + res.write(`event: ${event}\n`); + res.write(`data: ${payload}\n\n`); + }; + }; // Setup stream end for HTTP const streamHttpEnd = req => (id, listener) => { req.on('close', () => { - unsubscribe(id, listener) - }) - } + unsubscribe(id, listener); + }); + }; // Setup stream output to WebSockets const streamToWs = (req, ws) => { const heartbeat = setInterval(() => { // TODO: Can't add multiple listeners, due to the limitation of uws. if (ws.readyState !== ws.OPEN) { - log.verbose(req.requestId, `Ending stream for ${req.accountId}`) - clearInterval(heartbeat) - return + log.verbose(req.requestId, `Ending stream for ${req.accountId}`); + clearInterval(heartbeat); + return; } - ws.ping() - }, 15000) + ws.ping(); + }, 15000); return (event, payload) => { if (ws.readyState !== ws.OPEN) { - log.error(req.requestId, 'Tried writing to closed socket') - return + log.error(req.requestId, 'Tried writing to closed socket'); + return; } - ws.send(JSON.stringify({ event, payload })) - } - } + ws.send(JSON.stringify({ event, payload })); + }; + }; // Setup stream end for WebSockets const streamWsEnd = ws => (id, listener) => { ws.on('close', () => { - unsubscribe(id, listener) - }) + unsubscribe(id, listener); + }); ws.on('error', e => { - unsubscribe(id, listener) - }) - } + unsubscribe(id, listener); + }); + }; - app.use(setRequestId) - app.use(allowCrossDomain) - app.use(authenticationMiddleware) - app.use(errorMiddleware) + app.use(setRequestId); + app.use(allowCrossDomain); + app.use(authenticationMiddleware); + app.use(errorMiddleware); app.get('/api/v1/streaming/user', (req, res) => { - streamFrom(`timeline:${req.accountId}`, req, streamToHttp(req, res), streamHttpEnd(req)) - }) + streamFrom(`timeline:${req.accountId}`, req, streamToHttp(req, res), streamHttpEnd(req)); + }); app.get('/api/v1/streaming/public', (req, res) => { - streamFrom('timeline:public', req, streamToHttp(req, res), streamHttpEnd(req), true) - }) + streamFrom('timeline:public', req, streamToHttp(req, res), streamHttpEnd(req), true); + }); app.get('/api/v1/streaming/public/local', (req, res) => { - streamFrom('timeline:public:local', req, streamToHttp(req, res), streamHttpEnd(req), true) - }) + streamFrom('timeline:public:local', req, streamToHttp(req, res), streamHttpEnd(req), true); + }); app.get('/api/v1/streaming/hashtag', (req, res) => { - streamFrom(`timeline:hashtag:${req.query.tag}`, req, streamToHttp(req, res), streamHttpEnd(req), true) - }) + streamFrom(`timeline:hashtag:${req.query.tag}`, req, streamToHttp(req, res), streamHttpEnd(req), true); + }); app.get('/api/v1/streaming/hashtag/local', (req, res) => { - streamFrom(`timeline:hashtag:${req.query.tag}:local`, req, streamToHttp(req, res), streamHttpEnd(req), true) - }) + streamFrom(`timeline:hashtag:${req.query.tag}:local`, req, streamToHttp(req, res), streamHttpEnd(req), true); + }); wss.on('connection', ws => { - const location = url.parse(ws.upgradeReq.url, true) - const token = location.query.access_token - const req = { requestId: uuid.v4() } + const location = url.parse(ws.upgradeReq.url, true); + const token = location.query.access_token; + const req = { requestId: uuid.v4() }; accountFromToken(token, req, err => { if (err) { - log.error(req.requestId, err) - ws.close() - return + log.error(req.requestId, err); + ws.close(); + return; } switch(location.query.stream) { case 'user': - streamFrom(`timeline:${req.accountId}`, req, streamToWs(req, ws), streamWsEnd(ws)) + streamFrom(`timeline:${req.accountId}`, req, streamToWs(req, ws), streamWsEnd(ws)); break; case 'public': - streamFrom('timeline:public', req, streamToWs(req, ws), streamWsEnd(ws), true) + streamFrom('timeline:public', req, streamToWs(req, ws), streamWsEnd(ws), true); break; case 'public:local': - streamFrom('timeline:public:local', req, streamToWs(req, ws), streamWsEnd(ws), true) + streamFrom('timeline:public:local', req, streamToWs(req, ws), streamWsEnd(ws), true); break; case 'hashtag': - streamFrom(`timeline:hashtag:${location.query.tag}`, req, streamToWs(req, ws), streamWsEnd(ws), true) + streamFrom(`timeline:hashtag:${location.query.tag}`, req, streamToWs(req, ws), streamWsEnd(ws), true); break; case 'hashtag:local': - streamFrom(`timeline:hashtag:${location.query.tag}:local`, req, streamToWs(req, ws), streamWsEnd(ws), true) + streamFrom(`timeline:hashtag:${location.query.tag}:local`, req, streamToWs(req, ws), streamWsEnd(ws), true); break; default: - ws.close() + ws.close(); } - }) - }) + }); + }); server.listen(process.env.PORT || 4000, () => { - log.level = process.env.LOG_LEVEL || 'verbose' - log.info(`Starting streaming API server worker on ${server.address().address}:${server.address().port}`) - }) + log.level = process.env.LOG_LEVEL || 'verbose'; + log.info(`Starting streaming API server worker on ${server.address().address}:${server.address().port}`); + }); - process.on('SIGINT', exit) - process.on('SIGTERM', exit) - process.on('exit', exit) + process.on('SIGINT', exit); + process.on('SIGTERM', exit); + process.on('exit', exit); function exit() { - server.close() + server.close(); } }