Browse Source

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
custom
Yamagishi Kazutoshi 5 years ago
committed by Eugen Rochko
parent
commit
2e112e2406
  1. 7
      .eslintrc.yml
  2. 136
      app/javascript/mastodon/actions/accounts.js
  3. 6
      app/javascript/mastodon/actions/alerts.js
  4. 14
      app/javascript/mastodon/actions/blocks.js
  5. 6
      app/javascript/mastodon/actions/cards.js
  6. 54
      app/javascript/mastodon/actions/compose.js
  7. 20
      app/javascript/mastodon/actions/domain_blocks.js
  8. 14
      app/javascript/mastodon/actions/favourites.js
  9. 38
      app/javascript/mastodon/actions/interactions.js
  10. 4
      app/javascript/mastodon/actions/modal.js
  11. 14
      app/javascript/mastodon/actions/mutes.js
  12. 24
      app/javascript/mastodon/actions/notifications.js
  13. 14
      app/javascript/mastodon/actions/reports.js
  14. 18
      app/javascript/mastodon/actions/search.js
  15. 4
      app/javascript/mastodon/actions/settings.js
  16. 30
      app/javascript/mastodon/actions/statuses.js
  17. 2
      app/javascript/mastodon/actions/store.js
  18. 28
      app/javascript/mastodon/actions/timelines.js
  19. 4
      app/javascript/mastodon/api.js
  20. 6
      app/javascript/mastodon/components/account.js
  21. 2
      app/javascript/mastodon/components/attachment_list.js
  22. 8
      app/javascript/mastodon/components/autosuggest_textarea.js
  23. 8
      app/javascript/mastodon/components/avatar.js
  24. 7
      app/javascript/mastodon/components/avatar_overlay.js
  25. 6
      app/javascript/mastodon/components/button.js
  26. 2
      app/javascript/mastodon/components/collapsable.js
  27. 2
      app/javascript/mastodon/components/column_back_button.js
  28. 3
      app/javascript/mastodon/components/column_back_button_slim.js
  29. 5
      app/javascript/mastodon/components/column_collapsable.js
  30. 2
      app/javascript/mastodon/components/display_name.js
  31. 6
      app/javascript/mastodon/components/dropdown_menu.js
  32. 2
      app/javascript/mastodon/components/extended_video_player.js
  33. 8
      app/javascript/mastodon/components/icon_button.js
  34. 2
      app/javascript/mastodon/components/load_more.js
  35. 8
      app/javascript/mastodon/components/media_gallery.js
  36. 4
      app/javascript/mastodon/components/permalink.js
  37. 2
      app/javascript/mastodon/components/relative_timestamp.js
  38. 4
      app/javascript/mastodon/components/status.js
  39. 4
      app/javascript/mastodon/components/status_action_bar.js
  40. 8
      app/javascript/mastodon/components/status_content.js
  41. 4
      app/javascript/mastodon/components/status_list.js
  42. 8
      app/javascript/mastodon/components/video_player.js
  43. 4
      app/javascript/mastodon/containers/account_container.js
  44. 8
      app/javascript/mastodon/containers/mastodon.js
  45. 18
      app/javascript/mastodon/containers/status_container.js
  46. 2
      app/javascript/mastodon/features/account/components/action_bar.js
  47. 12
      app/javascript/mastodon/features/account/components/header.js
  48. 3
      app/javascript/mastodon/features/account_gallery/components/media_item.js
  49. 2
      app/javascript/mastodon/features/account_gallery/index.js
  50. 2
      app/javascript/mastodon/features/account_timeline/components/header.js
  51. 12
      app/javascript/mastodon/features/account_timeline/containers/header_container.js
  52. 6
      app/javascript/mastodon/features/account_timeline/index.js
  53. 7
      app/javascript/mastodon/features/blocks/index.js
  54. 10
      app/javascript/mastodon/features/community_timeline/index.js
  55. 2
      app/javascript/mastodon/features/compose/components/autosuggest_account.js
  56. 2
      app/javascript/mastodon/features/compose/components/character_counter.js
  57. 2
      app/javascript/mastodon/features/compose/components/compose_form.js
  58. 12
      app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js
  59. 2
      app/javascript/mastodon/features/compose/components/navigation_bar.js
  60. 12
      app/javascript/mastodon/features/compose/components/privacy_dropdown.js
  61. 6
      app/javascript/mastodon/features/compose/components/reply_indicator.js
  62. 4
      app/javascript/mastodon/features/compose/components/search.js
  63. 2
      app/javascript/mastodon/features/compose/components/search_results.js
  64. 2
      app/javascript/mastodon/features/compose/components/text_icon_button.js
  65. 10
      app/javascript/mastodon/features/compose/components/upload_button.js
  66. 4
      app/javascript/mastodon/features/compose/components/upload_form.js
  67. 2
      app/javascript/mastodon/features/compose/components/upload_progress.js
  68. 2
      app/javascript/mastodon/features/compose/components/warning.js
  69. 2
      app/javascript/mastodon/features/compose/containers/autosuggest_account_container.js
  70. 2
      app/javascript/mastodon/features/compose/containers/autosuggest_status_container.js
  71. 4
      app/javascript/mastodon/features/compose/containers/compose_form_container.js
  72. 2
      app/javascript/mastodon/features/compose/containers/navigation_container.js
  73. 4
      app/javascript/mastodon/features/compose/containers/privacy_dropdown_container.js
  74. 2
      app/javascript/mastodon/features/compose/containers/reply_indicator_container.js
  75. 6
      app/javascript/mastodon/features/compose/containers/search_container.js
  76. 2
      app/javascript/mastodon/features/compose/containers/search_results_container.js
  77. 8
      app/javascript/mastodon/features/compose/containers/sensitive_button_container.js
  78. 6
      app/javascript/mastodon/features/compose/containers/spoiler_button_container.js
  79. 4
      app/javascript/mastodon/features/compose/containers/upload_button_container.js
  80. 2
      app/javascript/mastodon/features/compose/containers/upload_form_container.js
  81. 2
      app/javascript/mastodon/features/compose/containers/upload_progress_container.js
  82. 2
      app/javascript/mastodon/features/compose/containers/warning_container.js
  83. 6
      app/javascript/mastodon/features/compose/index.js
  84. 6
      app/javascript/mastodon/features/favourited_statuses/index.js
  85. 4
      app/javascript/mastodon/features/favourites/index.js
  86. 4
      app/javascript/mastodon/features/follow_requests/components/account_authorize.js
  87. 4
      app/javascript/mastodon/features/follow_requests/containers/account_authorize_container.js
  88. 6
      app/javascript/mastodon/features/follow_requests/index.js
  89. 6
      app/javascript/mastodon/features/followers/index.js
  90. 6
      app/javascript/mastodon/features/following/index.js
  91. 9
      app/javascript/mastodon/features/getting_started/index.js
  92. 8
      app/javascript/mastodon/features/hashtag_timeline/index.js
  93. 4
      app/javascript/mastodon/features/home_timeline/components/column_settings.js
  94. 4
      app/javascript/mastodon/features/home_timeline/components/setting_text.js
  95. 4
      app/javascript/mastodon/features/home_timeline/containers/column_settings_container.js
  96. 8
      app/javascript/mastodon/features/home_timeline/index.js
  97. 6
      app/javascript/mastodon/features/mutes/index.js
  98. 5
      app/javascript/mastodon/features/notifications/components/clear_column_button.js
  99. 6
      app/javascript/mastodon/features/notifications/components/column_settings.js
  100. 2
      app/javascript/mastodon/features/notifications/components/notification.js

7
.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

136
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,
};
};

6
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,
};
};

14
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,
};
};

6
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,
};
};

54
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,
};
};

20
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,
};
};

14
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,
};
};

38
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,
};
};

4
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,
};
};

14
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,
};
};

24
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,
};
};

14
app/javascript/mastodon/actions/reports.js

@ -14,13 +14,13 @@ export function initReport(account, status) {
return {
type: REPORT_INIT,
account,
status
status,
};