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
This commit is contained in:
Yamagishi Kazutoshi 2017-05-21 00:31:47 +09:00 committed by Eugen Rochko
parent 812fe90eca
commit 2e112e2406
170 changed files with 919 additions and 904 deletions

View file

@ -47,6 +47,13 @@ rules:
no-mixed-spaces-and-tabs: warn no-mixed-spaces-and-tabs: warn
no-nested-ternary: warn no-nested-ternary: warn
no-trailing-spaces: warn no-trailing-spaces: warn
semi: error
padded-blocks:
- error
- classes: always
comma-dangle:
- error
- always-multiline
react/jsx-wrap-multilines: error react/jsx-wrap-multilines: error
react/jsx-no-bind: error react/jsx-no-bind: error

View file

@ -1,4 +1,4 @@
import api, { getLinks } from '../api' import api, { getLinks } from '../api';
import Immutable from 'immutable'; import Immutable from 'immutable';
export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST'; export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST';
@ -154,8 +154,8 @@ export function expandAccountTimeline(id) {
api(getState).get(`/api/v1/accounts/${id}/statuses`, { api(getState).get(`/api/v1/accounts/${id}/statuses`, {
params: { params: {
limit: 10, limit: 10,
max_id: lastId max_id: lastId,
} },
}).then(response => { }).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next'); const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(expandAccountTimelineSuccess(id, response.data, next)); dispatch(expandAccountTimelineSuccess(id, response.data, next));
@ -175,8 +175,8 @@ export function expandAccountMediaTimeline(id) {
params: { params: {
limit: 12, limit: 12,
only_media: 'true', only_media: 'true',
max_id: lastId max_id: lastId,
} },
}).then(response => { }).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next'); const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(expandAccountMediaTimelineSuccess(id, response.data, next)); dispatch(expandAccountMediaTimelineSuccess(id, response.data, next));
@ -189,14 +189,14 @@ export function expandAccountMediaTimeline(id) {
export function fetchAccountRequest(id) { export function fetchAccountRequest(id) {
return { return {
type: ACCOUNT_FETCH_REQUEST, type: ACCOUNT_FETCH_REQUEST,
id id,
}; };
}; };
export function fetchAccountSuccess(account) { export function fetchAccountSuccess(account) {
return { return {
type: ACCOUNT_FETCH_SUCCESS, type: ACCOUNT_FETCH_SUCCESS,
account account,
}; };
}; };
@ -205,7 +205,7 @@ export function fetchAccountFail(id, error) {
type: ACCOUNT_FETCH_FAIL, type: ACCOUNT_FETCH_FAIL,
id, id,
error, error,
skipAlert: true skipAlert: true,
}; };
}; };
@ -230,48 +230,48 @@ export function unfollowAccount(id) {
}).catch(error => { }).catch(error => {
dispatch(unfollowAccountFail(error)); dispatch(unfollowAccountFail(error));
}); });
} };
}; };
export function followAccountRequest(id) { export function followAccountRequest(id) {
return { return {
type: ACCOUNT_FOLLOW_REQUEST, type: ACCOUNT_FOLLOW_REQUEST,
id id,
}; };
}; };
export function followAccountSuccess(relationship) { export function followAccountSuccess(relationship) {
return { return {
type: ACCOUNT_FOLLOW_SUCCESS, type: ACCOUNT_FOLLOW_SUCCESS,
relationship relationship,
}; };
}; };
export function followAccountFail(error) { export function followAccountFail(error) {
return { return {
type: ACCOUNT_FOLLOW_FAIL, type: ACCOUNT_FOLLOW_FAIL,
error error,
}; };
}; };
export function unfollowAccountRequest(id) { export function unfollowAccountRequest(id) {
return { return {
type: ACCOUNT_UNFOLLOW_REQUEST, type: ACCOUNT_UNFOLLOW_REQUEST,
id id,
}; };
}; };
export function unfollowAccountSuccess(relationship) { export function unfollowAccountSuccess(relationship) {
return { return {
type: ACCOUNT_UNFOLLOW_SUCCESS, type: ACCOUNT_UNFOLLOW_SUCCESS,
relationship relationship,
}; };
}; };
export function unfollowAccountFail(error) { export function unfollowAccountFail(error) {
return { return {
type: ACCOUNT_UNFOLLOW_FAIL, type: ACCOUNT_UNFOLLOW_FAIL,
error error,
}; };
}; };
@ -279,7 +279,7 @@ export function fetchAccountTimelineRequest(id, skipLoading) {
return { return {
type: ACCOUNT_TIMELINE_FETCH_REQUEST, type: ACCOUNT_TIMELINE_FETCH_REQUEST,
id, id,
skipLoading skipLoading,
}; };
}; };
@ -289,7 +289,7 @@ export function fetchAccountTimelineSuccess(id, statuses, replace, skipLoading)
id, id,
statuses, statuses,
replace, replace,
skipLoading skipLoading,
}; };
}; };
@ -299,7 +299,7 @@ export function fetchAccountTimelineFail(id, error, skipLoading) {
id, id,
error, error,
skipLoading, skipLoading,
skipAlert: error.response.status === 404 skipAlert: error.response.status === 404,
}; };
}; };
@ -307,7 +307,7 @@ export function fetchAccountMediaTimelineRequest(id, skipLoading) {
return { return {
type: ACCOUNT_MEDIA_TIMELINE_FETCH_REQUEST, type: ACCOUNT_MEDIA_TIMELINE_FETCH_REQUEST,
id, id,
skipLoading skipLoading,
}; };
}; };
@ -317,7 +317,7 @@ export function fetchAccountMediaTimelineSuccess(id, statuses, replace, skipLoad
id, id,
statuses, statuses,
replace, replace,
skipLoading skipLoading,
}; };
}; };
@ -327,14 +327,14 @@ export function fetchAccountMediaTimelineFail(id, error, skipLoading) {
id, id,
error, error,
skipLoading, skipLoading,
skipAlert: error.response.status === 404 skipAlert: error.response.status === 404,
}; };
}; };
export function expandAccountTimelineRequest(id) { export function expandAccountTimelineRequest(id) {
return { return {
type: ACCOUNT_TIMELINE_EXPAND_REQUEST, type: ACCOUNT_TIMELINE_EXPAND_REQUEST,
id id,
}; };
}; };
@ -343,7 +343,7 @@ export function expandAccountTimelineSuccess(id, statuses, next) {
type: ACCOUNT_TIMELINE_EXPAND_SUCCESS, type: ACCOUNT_TIMELINE_EXPAND_SUCCESS,
id, id,
statuses, statuses,
next next,
}; };
}; };
@ -351,14 +351,14 @@ export function expandAccountTimelineFail(id, error) {
return { return {
type: ACCOUNT_TIMELINE_EXPAND_FAIL, type: ACCOUNT_TIMELINE_EXPAND_FAIL,
id, id,
error error,
}; };
}; };
export function expandAccountMediaTimelineRequest(id) { export function expandAccountMediaTimelineRequest(id) {
return { return {
type: ACCOUNT_MEDIA_TIMELINE_EXPAND_REQUEST, type: ACCOUNT_MEDIA_TIMELINE_EXPAND_REQUEST,
id id,
}; };
}; };
@ -367,7 +367,7 @@ export function expandAccountMediaTimelineSuccess(id, statuses, next) {
type: ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS, type: ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS,
id, id,
statuses, statuses,
next next,
}; };
}; };
@ -375,7 +375,7 @@ export function expandAccountMediaTimelineFail(id, error) {
return { return {
type: ACCOUNT_MEDIA_TIMELINE_EXPAND_FAIL, type: ACCOUNT_MEDIA_TIMELINE_EXPAND_FAIL,
id, id,
error error,
}; };
}; };
@ -407,7 +407,7 @@ export function unblockAccount(id) {
export function blockAccountRequest(id) { export function blockAccountRequest(id) {
return { return {
type: ACCOUNT_BLOCK_REQUEST, type: ACCOUNT_BLOCK_REQUEST,
id id,
}; };
}; };
@ -415,35 +415,35 @@ export function blockAccountSuccess(relationship, statuses) {
return { return {
type: ACCOUNT_BLOCK_SUCCESS, type: ACCOUNT_BLOCK_SUCCESS,
relationship, relationship,
statuses statuses,
}; };
}; };
export function blockAccountFail(error) { export function blockAccountFail(error) {
return { return {
type: ACCOUNT_BLOCK_FAIL, type: ACCOUNT_BLOCK_FAIL,
error error,
}; };
}; };
export function unblockAccountRequest(id) { export function unblockAccountRequest(id) {
return { return {
type: ACCOUNT_UNBLOCK_REQUEST, type: ACCOUNT_UNBLOCK_REQUEST,
id id,
}; };
}; };
export function unblockAccountSuccess(relationship) { export function unblockAccountSuccess(relationship) {
return { return {
type: ACCOUNT_UNBLOCK_SUCCESS, type: ACCOUNT_UNBLOCK_SUCCESS,
relationship relationship,
}; };
}; };
export function unblockAccountFail(error) { export function unblockAccountFail(error) {
return { return {
type: ACCOUNT_UNBLOCK_FAIL, type: ACCOUNT_UNBLOCK_FAIL,
error error,
}; };
}; };
@ -476,7 +476,7 @@ export function unmuteAccount(id) {
export function muteAccountRequest(id) { export function muteAccountRequest(id) {
return { return {
type: ACCOUNT_MUTE_REQUEST, type: ACCOUNT_MUTE_REQUEST,
id id,
}; };
}; };
@ -484,35 +484,35 @@ export function muteAccountSuccess(relationship, statuses) {
return { return {
type: ACCOUNT_MUTE_SUCCESS, type: ACCOUNT_MUTE_SUCCESS,
relationship, relationship,
statuses statuses,
}; };
}; };
export function muteAccountFail(error) { export function muteAccountFail(error) {
return { return {
type: ACCOUNT_MUTE_FAIL, type: ACCOUNT_MUTE_FAIL,
error error,
}; };
}; };
export function unmuteAccountRequest(id) { export function unmuteAccountRequest(id) {
return { return {
type: ACCOUNT_UNMUTE_REQUEST, type: ACCOUNT_UNMUTE_REQUEST,
id id,
}; };
}; };
export function unmuteAccountSuccess(relationship) { export function unmuteAccountSuccess(relationship) {
return { return {
type: ACCOUNT_UNMUTE_SUCCESS, type: ACCOUNT_UNMUTE_SUCCESS,
relationship relationship,
}; };
}; };
export function unmuteAccountFail(error) { export function unmuteAccountFail(error) {
return { return {
type: ACCOUNT_UNMUTE_FAIL, type: ACCOUNT_UNMUTE_FAIL,
error error,
}; };
}; };
@ -535,7 +535,7 @@ export function fetchFollowers(id) {
export function fetchFollowersRequest(id) { export function fetchFollowersRequest(id) {
return { return {
type: FOLLOWERS_FETCH_REQUEST, type: FOLLOWERS_FETCH_REQUEST,
id id,
}; };
}; };
@ -544,7 +544,7 @@ export function fetchFollowersSuccess(id, accounts, next) {
type: FOLLOWERS_FETCH_SUCCESS, type: FOLLOWERS_FETCH_SUCCESS,
id, id,
accounts, accounts,
next next,
}; };
}; };
@ -552,7 +552,7 @@ export function fetchFollowersFail(id, error) {
return { return {
type: FOLLOWERS_FETCH_FAIL, type: FOLLOWERS_FETCH_FAIL,
id, id,
error error,
}; };
}; };
@ -580,7 +580,7 @@ export function expandFollowers(id) {
export function expandFollowersRequest(id) { export function expandFollowersRequest(id) {
return { return {
type: FOLLOWERS_EXPAND_REQUEST, type: FOLLOWERS_EXPAND_REQUEST,
id id,
}; };
}; };
@ -589,7 +589,7 @@ export function expandFollowersSuccess(id, accounts, next) {
type: FOLLOWERS_EXPAND_SUCCESS, type: FOLLOWERS_EXPAND_SUCCESS,
id, id,
accounts, accounts,
next next,
}; };
}; };
@ -597,7 +597,7 @@ export function expandFollowersFail(id, error) {
return { return {
type: FOLLOWERS_EXPAND_FAIL, type: FOLLOWERS_EXPAND_FAIL,
id, id,
error error,
}; };
}; };
@ -619,7 +619,7 @@ export function fetchFollowing(id) {
export function fetchFollowingRequest(id) { export function fetchFollowingRequest(id) {
return { return {
type: FOLLOWING_FETCH_REQUEST, type: FOLLOWING_FETCH_REQUEST,
id id,
}; };
}; };
@ -628,7 +628,7 @@ export function fetchFollowingSuccess(id, accounts, next) {
type: FOLLOWING_FETCH_SUCCESS, type: FOLLOWING_FETCH_SUCCESS,
id, id,
accounts, accounts,
next next,
}; };
}; };
@ -636,7 +636,7 @@ export function fetchFollowingFail(id, error) {
return { return {
type: FOLLOWING_FETCH_FAIL, type: FOLLOWING_FETCH_FAIL,
id, id,
error error,
}; };
}; };
@ -664,7 +664,7 @@ export function expandFollowing(id) {
export function expandFollowingRequest(id) { export function expandFollowingRequest(id) {
return { return {
type: FOLLOWING_EXPAND_REQUEST, type: FOLLOWING_EXPAND_REQUEST,
id id,
}; };
}; };
@ -673,7 +673,7 @@ export function expandFollowingSuccess(id, accounts, next) {
type: FOLLOWING_EXPAND_SUCCESS, type: FOLLOWING_EXPAND_SUCCESS,
id, id,
accounts, accounts,
next next,
}; };
}; };
@ -681,7 +681,7 @@ export function expandFollowingFail(id, error) {
return { return {
type: FOLLOWING_EXPAND_FAIL, type: FOLLOWING_EXPAND_FAIL,
id, id,
error error,
}; };
}; };
@ -708,7 +708,7 @@ export function fetchRelationshipsRequest(ids) {
return { return {
type: RELATIONSHIPS_FETCH_REQUEST, type: RELATIONSHIPS_FETCH_REQUEST,
ids, ids,
skipLoading: true skipLoading: true,
}; };
}; };
@ -716,7 +716,7 @@ export function fetchRelationshipsSuccess(relationships) {
return { return {
type: RELATIONSHIPS_FETCH_SUCCESS, type: RELATIONSHIPS_FETCH_SUCCESS,
relationships, relationships,
skipLoading: true skipLoading: true,
}; };
}; };
@ -724,7 +724,7 @@ export function fetchRelationshipsFail(error) {
return { return {
type: RELATIONSHIPS_FETCH_FAIL, type: RELATIONSHIPS_FETCH_FAIL,
error, error,
skipLoading: true skipLoading: true,
}; };
}; };
@ -734,14 +734,14 @@ export function fetchFollowRequests() {
api(getState).get('/api/v1/follow_requests').then(response => { api(getState).get('/api/v1/follow_requests').then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next'); 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))); }).catch(error => dispatch(fetchFollowRequestsFail(error)));
}; };
}; };
export function fetchFollowRequestsRequest() { export function fetchFollowRequestsRequest() {
return { return {
type: FOLLOW_REQUESTS_FETCH_REQUEST type: FOLLOW_REQUESTS_FETCH_REQUEST,
}; };
}; };
@ -749,14 +749,14 @@ export function fetchFollowRequestsSuccess(accounts, next) {
return { return {
type: FOLLOW_REQUESTS_FETCH_SUCCESS, type: FOLLOW_REQUESTS_FETCH_SUCCESS,
accounts, accounts,
next next,
}; };
}; };
export function fetchFollowRequestsFail(error) { export function fetchFollowRequestsFail(error) {
return { return {
type: FOLLOW_REQUESTS_FETCH_FAIL, type: FOLLOW_REQUESTS_FETCH_FAIL,
error error,
}; };
}; };
@ -772,14 +772,14 @@ export function expandFollowRequests() {
api(getState).get(url).then(response => { api(getState).get(url).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next'); 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))); }).catch(error => dispatch(expandFollowRequestsFail(error)));
}; };
}; };
export function expandFollowRequestsRequest() { export function expandFollowRequestsRequest() {
return { return {
type: FOLLOW_REQUESTS_EXPAND_REQUEST type: FOLLOW_REQUESTS_EXPAND_REQUEST,
}; };
}; };
@ -787,14 +787,14 @@ export function expandFollowRequestsSuccess(accounts, next) {
return { return {
type: FOLLOW_REQUESTS_EXPAND_SUCCESS, type: FOLLOW_REQUESTS_EXPAND_SUCCESS,
accounts, accounts,
next next,
}; };
}; };
export function expandFollowRequestsFail(error) { export function expandFollowRequestsFail(error) {
return { return {
type: FOLLOW_REQUESTS_EXPAND_FAIL, type: FOLLOW_REQUESTS_EXPAND_FAIL,
error error,
}; };
}; };
@ -812,14 +812,14 @@ export function authorizeFollowRequest(id) {
export function authorizeFollowRequestRequest(id) { export function authorizeFollowRequestRequest(id) {
return { return {
type: FOLLOW_REQUEST_AUTHORIZE_REQUEST, type: FOLLOW_REQUEST_AUTHORIZE_REQUEST,
id id,
}; };
}; };
export function authorizeFollowRequestSuccess(id) { export function authorizeFollowRequestSuccess(id) {
return { return {
type: FOLLOW_REQUEST_AUTHORIZE_SUCCESS, type: FOLLOW_REQUEST_AUTHORIZE_SUCCESS,
id id,
}; };
}; };
@ -827,7 +827,7 @@ export function authorizeFollowRequestFail(id, error) {
return { return {
type: FOLLOW_REQUEST_AUTHORIZE_FAIL, type: FOLLOW_REQUEST_AUTHORIZE_FAIL,
id, id,
error error,
}; };
}; };
@ -846,14 +846,14 @@ export function rejectFollowRequest(id) {
export function rejectFollowRequestRequest(id) { export function rejectFollowRequestRequest(id) {
return { return {
type: FOLLOW_REQUEST_REJECT_REQUEST, type: FOLLOW_REQUEST_REJECT_REQUEST,
id id,
}; };
}; };
export function rejectFollowRequestSuccess(id) { export function rejectFollowRequestSuccess(id) {
return { return {
type: FOLLOW_REQUEST_REJECT_SUCCESS, type: FOLLOW_REQUEST_REJECT_SUCCESS,
id id,
}; };
}; };
@ -861,6 +861,6 @@ export function rejectFollowRequestFail(id, error) {
return { return {
type: FOLLOW_REQUEST_REJECT_FAIL, type: FOLLOW_REQUEST_REJECT_FAIL,
id, id,
error error,
}; };
}; };

View file

@ -5,13 +5,13 @@ export const ALERT_CLEAR = 'ALERT_CLEAR';
export function dismissAlert(alert) { export function dismissAlert(alert) {
return { return {
type: ALERT_DISMISS, type: ALERT_DISMISS,
alert alert,
}; };
}; };
export function clearAlert() { export function clearAlert() {
return { return {
type: ALERT_CLEAR type: ALERT_CLEAR,
}; };
}; };
@ -19,6 +19,6 @@ export function showAlert(title, message) {
return { return {
type: ALERT_SHOW, type: ALERT_SHOW,
title, title,
message message,
}; };
}; };

View file

@ -1,4 +1,4 @@
import api, { getLinks } from '../api' import api, { getLinks } from '../api';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts';
export const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST'; export const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST';
@ -23,7 +23,7 @@ export function fetchBlocks() {
export function fetchBlocksRequest() { export function fetchBlocksRequest() {
return { return {
type: BLOCKS_FETCH_REQUEST type: BLOCKS_FETCH_REQUEST,
}; };
}; };
@ -31,14 +31,14 @@ export function fetchBlocksSuccess(accounts, next) {
return { return {
type: BLOCKS_FETCH_SUCCESS, type: BLOCKS_FETCH_SUCCESS,
accounts, accounts,
next next,
}; };
}; };
export function fetchBlocksFail(error) { export function fetchBlocksFail(error) {
return { return {
type: BLOCKS_FETCH_FAIL, type: BLOCKS_FETCH_FAIL,
error error,
}; };
}; };
@ -62,7 +62,7 @@ export function expandBlocks() {
export function expandBlocksRequest() { export function expandBlocksRequest() {
return { return {
type: BLOCKS_EXPAND_REQUEST type: BLOCKS_EXPAND_REQUEST,
}; };
}; };
@ -70,13 +70,13 @@ export function expandBlocksSuccess(accounts, next) {
return { return {
type: BLOCKS_EXPAND_SUCCESS, type: BLOCKS_EXPAND_SUCCESS,
accounts, accounts,
next next,
}; };
}; };
export function expandBlocksFail(error) { export function expandBlocksFail(error) {
return { return {
type: BLOCKS_EXPAND_FAIL, type: BLOCKS_EXPAND_FAIL,
error error,
}; };
}; };

View file

@ -28,7 +28,7 @@ export function fetchStatusCardRequest(id) {
return { return {
type: STATUS_CARD_FETCH_REQUEST, type: STATUS_CARD_FETCH_REQUEST,
id, id,
skipLoading: true skipLoading: true,
}; };
}; };
@ -37,7 +37,7 @@ export function fetchStatusCardSuccess(id, card) {
type: STATUS_CARD_FETCH_SUCCESS, type: STATUS_CARD_FETCH_SUCCESS,
id, id,
card, card,
skipLoading: true skipLoading: true,
}; };
}; };
@ -47,6 +47,6 @@ export function fetchStatusCardFail(id, error) {
id, id,
error, error,
skipLoading: true, skipLoading: true,
skipAlert: true skipAlert: true,
}; };
}; };

View file

@ -35,7 +35,7 @@ export const COMPOSE_EMOJI_INSERT = 'COMPOSE_EMOJI_INSERT';
export function changeCompose(text) { export function changeCompose(text) {
return { return {
type: COMPOSE_CHANGE, type: COMPOSE_CHANGE,
text: text text: text,
}; };
}; };
@ -43,7 +43,7 @@ export function replyCompose(status, router) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch({ dispatch({
type: COMPOSE_REPLY, type: COMPOSE_REPLY,
status: status status: status,
}); });
if (!getState().getIn(['compose', 'mounted'])) { if (!getState().getIn(['compose', 'mounted'])) {
@ -54,7 +54,7 @@ export function replyCompose(status, router) {
export function cancelReplyCompose() { export function cancelReplyCompose() {
return { return {
type: COMPOSE_REPLY_CANCEL type: COMPOSE_REPLY_CANCEL,
}; };
}; };
@ -62,7 +62,7 @@ export function mentionCompose(account, router) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch({ dispatch({
type: COMPOSE_MENTION, type: COMPOSE_MENTION,
account: account account: account,
}); });
if (!getState().getIn(['compose', 'mounted'])) { if (!getState().getIn(['compose', 'mounted'])) {
@ -84,11 +84,11 @@ export function submitCompose() {
media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')), media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')),
sensitive: getState().getIn(['compose', 'sensitive']), sensitive: getState().getIn(['compose', 'sensitive']),
spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''), spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
visibility: getState().getIn(['compose', 'privacy']) visibility: getState().getIn(['compose', 'privacy']),
}, { }, {
headers: { headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']) 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
} },
}).then(function (response) { }).then(function (response) {
dispatch(submitComposeSuccess({ ...response.data })); dispatch(submitComposeSuccess({ ...response.data }));
@ -112,21 +112,21 @@ export function submitCompose() {
export function submitComposeRequest() { export function submitComposeRequest() {
return { return {
type: COMPOSE_SUBMIT_REQUEST type: COMPOSE_SUBMIT_REQUEST,
}; };
}; };
export function submitComposeSuccess(status) { export function submitComposeSuccess(status) {
return { return {
type: COMPOSE_SUBMIT_SUCCESS, type: COMPOSE_SUBMIT_SUCCESS,
status: status status: status,
}; };
}; };
export function submitComposeFail(error) { export function submitComposeFail(error) {
return { return {
type: COMPOSE_SUBMIT_FAIL, type: COMPOSE_SUBMIT_FAIL,
error: error error: error,
}; };
}; };
@ -144,7 +144,7 @@ export function uploadCompose(files) {
api(getState).post('/api/v1/media', data, { api(getState).post('/api/v1/media', data, {
onUploadProgress: function (e) { onUploadProgress: function (e) {
dispatch(uploadComposeProgress(e.loaded, e.total)); dispatch(uploadComposeProgress(e.loaded, e.total));
} },
}).then(function (response) { }).then(function (response) {
dispatch(uploadComposeSuccess(response.data)); dispatch(uploadComposeSuccess(response.data));
}).catch(function (error) { }).catch(function (error) {
@ -156,7 +156,7 @@ export function uploadCompose(files) {
export function uploadComposeRequest() { export function uploadComposeRequest() {
return { return {
type: COMPOSE_UPLOAD_REQUEST, type: COMPOSE_UPLOAD_REQUEST,
skipLoading: true skipLoading: true,
}; };
}; };
@ -164,7 +164,7 @@ export function uploadComposeProgress(loaded, total) {
return { return {
type: COMPOSE_UPLOAD_PROGRESS, type: COMPOSE_UPLOAD_PROGRESS,
loaded: loaded, loaded: loaded,
total: total total: total,
}; };
}; };
@ -172,7 +172,7 @@ export function uploadComposeSuccess(media) {
return { return {
type: COMPOSE_UPLOAD_SUCCESS, type: COMPOSE_UPLOAD_SUCCESS,
media: media, media: media,
skipLoading: true skipLoading: true,
}; };
}; };
@ -180,20 +180,20 @@ export function uploadComposeFail(error) {
return { return {
type: COMPOSE_UPLOAD_FAIL, type: COMPOSE_UPLOAD_FAIL,
error: error, error: error,
skipLoading: true skipLoading: true,
}; };
}; };
export function undoUploadCompose(media_id) { export function undoUploadCompose(media_id) {
return { return {
type: COMPOSE_UPLOAD_UNDO, type: COMPOSE_UPLOAD_UNDO,
media_id: media_id media_id: media_id,
}; };
}; };
export function clearComposeSuggestions() { export function clearComposeSuggestions() {
return { return {
type: COMPOSE_SUGGESTIONS_CLEAR type: COMPOSE_SUGGESTIONS_CLEAR,
}; };
}; };
@ -203,8 +203,8 @@ export function fetchComposeSuggestions(token) {
params: { params: {
q: token, q: token,
resolve: false, resolve: false,
limit: 4 limit: 4,
} },
}).then(response => { }).then(response => {
dispatch(readyComposeSuggestions(token, response.data)); dispatch(readyComposeSuggestions(token, response.data));
}); });
@ -215,7 +215,7 @@ export function readyComposeSuggestions(token, accounts) {
return { return {
type: COMPOSE_SUGGESTIONS_READY, type: COMPOSE_SUGGESTIONS_READY,
token, token,
accounts accounts,
}; };
}; };
@ -227,20 +227,20 @@ export function selectComposeSuggestion(position, token, accountId) {
type: COMPOSE_SUGGESTION_SELECT, type: COMPOSE_SUGGESTION_SELECT,
position, position,
token, token,
completion completion,
}); });
}; };
}; };
export function mountCompose() { export function mountCompose() {
return { return {
type: COMPOSE_MOUNT type: COMPOSE_MOUNT,
}; };
}; };
export function unmountCompose() { export function unmountCompose() {
return { return {
type: COMPOSE_UNMOUNT type: COMPOSE_UNMOUNT,
}; };
}; };
@ -252,21 +252,21 @@ export function changeComposeSensitivity() {
export function changeComposeSpoilerness() { export function changeComposeSpoilerness() {
return { return {
type: COMPOSE_SPOILERNESS_CHANGE type: COMPOSE_SPOILERNESS_CHANGE,
}; };
}; };
export function changeComposeSpoilerText(text) { export function changeComposeSpoilerText(text) {
return { return {
type: COMPOSE_SPOILER_TEXT_CHANGE, type: COMPOSE_SPOILER_TEXT_CHANGE,
text text,
}; };
}; };
export function changeComposeVisibility(value) { export function changeComposeVisibility(value) {
return { return {
type: COMPOSE_VISIBILITY_CHANGE, type: COMPOSE_VISIBILITY_CHANGE,
value value,
}; };
}; };
@ -274,6 +274,6 @@ export function insertEmojiCompose(position, emoji) {
return { return {
type: COMPOSE_EMOJI_INSERT, type: COMPOSE_EMOJI_INSERT,
position, position,
emoji emoji,
}; };
}; };

View file

@ -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_REQUEST = 'DOMAIN_BLOCK_REQUEST';
export const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS'; export const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS';
@ -27,7 +27,7 @@ export function blockDomain(domain, accountId) {
export function blockDomainRequest(domain) { export function blockDomainRequest(domain) {
return { return {
type: DOMAIN_BLOCK_REQUEST, type: DOMAIN_BLOCK_REQUEST,
domain domain,
}; };
}; };
@ -35,7 +35,7 @@ export function blockDomainSuccess(domain, accountId) {
return { return {
type: DOMAIN_BLOCK_SUCCESS, type: DOMAIN_BLOCK_SUCCESS,
domain, domain,
accountId accountId,
}; };
}; };
@ -43,7 +43,7 @@ export function blockDomainFail(domain, error) {
return { return {
type: DOMAIN_BLOCK_FAIL, type: DOMAIN_BLOCK_FAIL,
domain, domain,
error error,
}; };
}; };
@ -62,7 +62,7 @@ export function unblockDomain(domain, accountId) {
export function unblockDomainRequest(domain) { export function unblockDomainRequest(domain) {
return { return {
type: DOMAIN_UNBLOCK_REQUEST, type: DOMAIN_UNBLOCK_REQUEST,
domain domain,
}; };
}; };
@ -70,7 +70,7 @@ export function unblockDomainSuccess(domain, accountId) {
return { return {
type: DOMAIN_UNBLOCK_SUCCESS, type: DOMAIN_UNBLOCK_SUCCESS,
domain, domain,
accountId accountId,
}; };
}; };
@ -78,7 +78,7 @@ export function unblockDomainFail(domain, error) {
return { return {
type: DOMAIN_UNBLOCK_FAIL, type: DOMAIN_UNBLOCK_FAIL,
domain, domain,
error error,
}; };
}; };
@ -97,7 +97,7 @@ export function fetchDomainBlocks() {
export function fetchDomainBlocksRequest() { export function fetchDomainBlocksRequest() {
return { return {
type: DOMAIN_BLOCKS_FETCH_REQUEST type: DOMAIN_BLOCKS_FETCH_REQUEST,
}; };
}; };
@ -105,13 +105,13 @@ export function fetchDomainBlocksSuccess(domains, next) {
return { return {
type: DOMAIN_BLOCKS_FETCH_SUCCESS, type: DOMAIN_BLOCKS_FETCH_SUCCESS,
domains, domains,
next next,
}; };
}; };
export function fetchDomainBlocksFail(error) { export function fetchDomainBlocksFail(error) {
return { return {
type: DOMAIN_BLOCKS_FETCH_FAIL, type: DOMAIN_BLOCKS_FETCH_FAIL,
error error,
}; };
}; };

View file

@ -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_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST';
export const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS'; export const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS';
@ -23,7 +23,7 @@ export function fetchFavouritedStatuses() {
export function fetchFavouritedStatusesRequest() { export function fetchFavouritedStatusesRequest() {
return { return {
type: FAVOURITED_STATUSES_FETCH_REQUEST type: FAVOURITED_STATUSES_FETCH_REQUEST,
}; };
}; };
@ -31,14 +31,14 @@ export function fetchFavouritedStatusesSuccess(statuses, next) {
return { return {
type: FAVOURITED_STATUSES_FETCH_SUCCESS, type: FAVOURITED_STATUSES_FETCH_SUCCESS,
statuses, statuses,
next next,
}; };
}; };
export function fetchFavouritedStatusesFail(error) { export function fetchFavouritedStatusesFail(error) {
return { return {
type: FAVOURITED_STATUSES_FETCH_FAIL, type: FAVOURITED_STATUSES_FETCH_FAIL,
error error,
}; };
}; };
@ -63,7 +63,7 @@ export function expandFavouritedStatuses() {
export function expandFavouritedStatusesRequest() { export function expandFavouritedStatusesRequest() {
return { return {
type: FAVOURITED_STATUSES_EXPAND_REQUEST type: FAVOURITED_STATUSES_EXPAND_REQUEST,
}; };
}; };
@ -71,13 +71,13 @@ export function expandFavouritedStatusesSuccess(statuses, next) {
return { return {
type: FAVOURITED_STATUSES_EXPAND_SUCCESS, type: FAVOURITED_STATUSES_EXPAND_SUCCESS,
statuses, statuses,
next next,
}; };
}; };
export function expandFavouritedStatusesFail(error) { export function expandFavouritedStatusesFail(error) {
return { return {
type: FAVOURITED_STATUSES_EXPAND_FAIL, type: FAVOURITED_STATUSES_EXPAND_FAIL,
error error,
}; };
}; };

View file

@ -1,4 +1,4 @@
import api from '../api' import api from '../api';
export const REBLOG_REQUEST = 'REBLOG_REQUEST'; export const REBLOG_REQUEST = 'REBLOG_REQUEST';
export const REBLOG_SUCCESS = 'REBLOG_SUCCESS'; export const REBLOG_SUCCESS = 'REBLOG_SUCCESS';
@ -53,7 +53,7 @@ export function unreblog(status) {
export function reblogRequest(status) { export function reblogRequest(status) {
return { return {
type: REBLOG_REQUEST, type: REBLOG_REQUEST,
status: status status: status,
}; };
}; };
@ -61,7 +61,7 @@ export function reblogSuccess(status, response) {
return { return {
type: REBLOG_SUCCESS, type: REBLOG_SUCCESS,
status: status, status: status,
response: response response: response,
}; };
}; };
@ -69,14 +69,14 @@ export function reblogFail(status, error) {
return { return {
type: REBLOG_FAIL, type: REBLOG_FAIL,
status: status, status: status,
error: error error: error,
}; };
}; };
export function unreblogRequest(status) { export function unreblogRequest(status) {
return { return {
type: UNREBLOG_REQUEST, type: UNREBLOG_REQUEST,
status: status status: status,
}; };
}; };
@ -84,7 +84,7 @@ export function unreblogSuccess(status, response) {
return { return {
type: UNREBLOG_SUCCESS, type: UNREBLOG_SUCCESS,
status: status, status: status,
response: response response: response,
}; };
}; };
@ -92,7 +92,7 @@ export function unreblogFail(status, error) {
return { return {
type: UNREBLOG_FAIL, type: UNREBLOG_FAIL,
status: status, status: status,
error: error error: error,
}; };
}; };
@ -123,7 +123,7 @@ export function unfavourite(status) {
export function favouriteRequest(status) { export function favouriteRequest(status) {
return { return {
type: FAVOURITE_REQUEST, type: FAVOURITE_REQUEST,
status: status status: status,
}; };
}; };
@ -131,7 +131,7 @@ export function favouriteSuccess(status, response) {
return { return {
type: FAVOURITE_SUCCESS, type: FAVOURITE_SUCCESS,
status: status, status: status,
response: response response: response,
}; };
}; };
@ -139,14 +139,14 @@ export function favouriteFail(status, error) {
return { return {
type: FAVOURITE_FAIL, type: FAVOURITE_FAIL,
status: status, status: status,
error: error error: error,
}; };
}; };
export function unfavouriteRequest(status) { export function unfavouriteRequest(status) {
return { return {
type: UNFAVOURITE_REQUEST, type: UNFAVOURITE_REQUEST,
status: status status: status,
}; };
}; };
@ -154,7 +154,7 @@ export function unfavouriteSuccess(status, response) {
return { return {
type: UNFAVOURITE_SUCCESS, type: UNFAVOURITE_SUCCESS,
status: status, status: status,
response: response response: response,
}; };
}; };
@ -162,7 +162,7 @@ export function unfavouriteFail(status, error) {
return { return {
type: UNFAVOURITE_FAIL, type: UNFAVOURITE_FAIL,
status: status, status: status,
error: error error: error,
}; };
}; };
@ -181,7 +181,7 @@ export function fetchReblogs(id) {
export function fetchReblogsRequest(id) { export function fetchReblogsRequest(id) {
return { return {
type: REBLOGS_FETCH_REQUEST, type: REBLOGS_FETCH_REQUEST,
id id,
}; };
}; };
@ -189,14 +189,14 @@ export function fetchReblogsSuccess(id, accounts) {
return { return {
type: REBLOGS_FETCH_SUCCESS, type: REBLOGS_FETCH_SUCCESS,
id, id,
accounts accounts,
}; };
}; };
export function fetchReblogsFail(id, error) { export function fetchReblogsFail(id, error) {
return { return {
type: REBLOGS_FETCH_FAIL, type: REBLOGS_FETCH_FAIL,
error error,
}; };
}; };
@ -215,7 +215,7 @@ export function fetchFavourites(id) {
export function fetchFavouritesRequest(id) { export function fetchFavouritesRequest(id) {
return { return {
type: FAVOURITES_FETCH_REQUEST, type: FAVOURITES_FETCH_REQUEST,
id id,
}; };
}; };
@ -223,13 +223,13 @@ export function fetchFavouritesSuccess(id, accounts) {
return { return {
type: FAVOURITES_FETCH_SUCCESS, type: FAVOURITES_FETCH_SUCCESS,
id, id,
accounts accounts,
}; };
}; };
export function fetchFavouritesFail(id, error) { export function fetchFavouritesFail(id, error) {
return { return {
type: FAVOURITES_FETCH_FAIL, type: FAVOURITES_FETCH_FAIL,
error error,
}; };
}; };

View file

@ -5,12 +5,12 @@ export function openModal(type, props) {
return { return {
type: MODAL_OPEN, type: MODAL_OPEN,
modalType: type, modalType: type,
modalProps: props modalProps: props,
}; };
}; };
export function closeModal() { export function closeModal() {
return { return {
type: MODAL_CLOSE type: MODAL_CLOSE,
}; };
}; };

View file

@ -1,4 +1,4 @@
import api, { getLinks } from '../api' import api, { getLinks } from '../api';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts';
export const MUTES_FETCH_REQUEST = 'MUTES_FETCH_REQUEST'; export const MUTES_FETCH_REQUEST = 'MUTES_FETCH_REQUEST';
@ -23,7 +23,7 @@ export function fetchMutes() {
export function fetchMutesRequest() { export function fetchMutesRequest() {
return { return {
type: MUTES_FETCH_REQUEST type: MUTES_FETCH_REQUEST,
}; };
}; };
@ -31,14 +31,14 @@ export function fetchMutesSuccess(accounts, next) {
return { return {
type: MUTES_FETCH_SUCCESS, type: MUTES_FETCH_SUCCESS,
accounts, accounts,
next next,
}; };
}; };
export function fetchMutesFail(error) { export function fetchMutesFail(error) {
return { return {
type: MUTES_FETCH_FAIL, type: MUTES_FETCH_FAIL,
error error,
}; };
}; };
@ -62,7 +62,7 @@ export function expandMutes() {
export function expandMutesRequest() { export function expandMutesRequest() {
return { return {
type: MUTES_EXPAND_REQUEST type: MUTES_EXPAND_REQUEST,
}; };
}; };
@ -70,13 +70,13 @@ export function expandMutesSuccess(accounts, next) {
return { return {
type: MUTES_EXPAND_SUCCESS, type: MUTES_EXPAND_SUCCESS,
accounts, accounts,
next next,
}; };
}; };
export function expandMutesFail(error) { export function expandMutesFail(error) {
return { return {
type: MUTES_EXPAND_FAIL, type: MUTES_EXPAND_FAIL,
error error,
}; };
}; };

View file

@ -1,4 +1,4 @@
import api, { getLinks } from '../api' import api, { getLinks } from '../api';
import Immutable from 'immutable'; import Immutable from 'immutable';
import IntlMessageFormat from 'intl-messageformat'; import IntlMessageFormat from 'intl-messageformat';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts';
@ -33,7 +33,7 @@ const unescapeHTML = (html) => {
const wrapper = document.createElement('div'); const wrapper = document.createElement('div');
wrapper.innerHTML = html; wrapper.innerHTML = html;
return wrapper.textContent; return wrapper.textContent;
} };
export function updateNotifications(notification, intlMessages, intlLocale) { export function updateNotifications(notification, intlMessages, intlLocale) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -45,7 +45,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) {
notification, notification,
account: notification.account, account: notification.account,
status: notification.status, status: notification.status,
meta: playSound ? { sound: 'boop' } : undefined meta: playSound ? { sound: 'boop' } : undefined,
}); });
fetchRelatedRelationships(dispatch, [notification]); fetchRelatedRelationships(dispatch, [notification]);
@ -99,7 +99,7 @@ export function refreshNotifications() {
export function refreshNotificationsRequest(skipLoading) { export function refreshNotificationsRequest(skipLoading) {
return { return {
type: NOTIFICATIONS_REFRESH_REQUEST, type: NOTIFICATIONS_REFRESH_REQUEST,
skipLoading skipLoading,
}; };
}; };
@ -110,7 +110,7 @@ export function refreshNotificationsSuccess(notifications, skipLoading, next) {
accounts: notifications.map(item => item.account), accounts: notifications.map(item => item.account),
statuses: notifications.map(item => item.status).filter(status => !!status), statuses: notifications.map(item => item.status).filter(status => !!status),
skipLoading, skipLoading,
next next,
}; };
}; };
@ -118,7 +118,7 @@ export function refreshNotificationsFail(error, skipLoading) {
return { return {
type: NOTIFICATIONS_REFRESH_FAIL, type: NOTIFICATIONS_REFRESH_FAIL,
error, error,
skipLoading skipLoading,
}; };
}; };
@ -135,7 +135,7 @@ export function expandNotifications() {
const params = { const params = {
max_id: lastId, max_id: lastId,
limit: 20 limit: 20,
}; };
params.exclude_types = excludeTypesFromSettings(getState()); params.exclude_types = excludeTypesFromSettings(getState());
@ -153,7 +153,7 @@ export function expandNotifications() {
export function expandNotificationsRequest() { export function expandNotificationsRequest() {
return { return {
type: NOTIFICATIONS_EXPAND_REQUEST type: NOTIFICATIONS_EXPAND_REQUEST,
}; };
}; };
@ -163,21 +163,21 @@ export function expandNotificationsSuccess(notifications, next) {
notifications, notifications,
accounts: notifications.map(item => item.account), accounts: notifications.map(item => item.account),
statuses: notifications.map(item => item.status).filter(status => !!status), statuses: notifications.map(item => item.status).filter(status => !!status),
next next,
}; };
}; };
export function expandNotificationsFail(error) { export function expandNotificationsFail(error) {
return { return {
type: NOTIFICATIONS_EXPAND_FAIL, type: NOTIFICATIONS_EXPAND_FAIL,
error error,
}; };
}; };
export function clearNotifications() { export function clearNotifications() {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch({ dispatch({
type: NOTIFICATIONS_CLEAR type: NOTIFICATIONS_CLEAR,
}); });
api(getState).post('/api/v1/notifications/clear'); api(getState).post('/api/v1/notifications/clear');
@ -187,6 +187,6 @@ export function clearNotifications() {
export function scrollTopNotifications(top) { export function scrollTopNotifications(top) {
return { return {
type: NOTIFICATIONS_SCROLL_TOP, type: NOTIFICATIONS_SCROLL_TOP,
top top,
}; };
}; };

View file

@ -14,13 +14,13 @@ export function initReport(account, status) {
return { return {
type: REPORT_INIT, type: REPORT_INIT,
account, account,
status status,
}; };
}; };
export function cancelReport() { export function cancelReport() {
return { return {
type: REPORT_CANCEL type: REPORT_CANCEL,
}; };
}; };
@ -39,34 +39,34 @@ export function submitReport() {
api(getState).post('/api/v1/reports', { api(getState).post('/api/v1/reports', {
account_id: getState().getIn(['reports', 'new', 'account_id']), account_id: getState().getIn(['reports', 'new', 'account_id']),
status_ids: getState().getIn(['reports', 'new', 'status_ids']), 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))); }).then(response => dispatch(submitReportSuccess(response.data))).catch(error => dispatch(submitReportFail(error)));
}; };
}; };
export function submitReportRequest() { export function submitReportRequest() {
return { return {
type: REPORT_SUBMIT_REQUEST type: REPORT_SUBMIT_REQUEST,
}; };
}; };
export function submitReportSuccess(report) { export function submitReportSuccess(report) {
return { return {
type: REPORT_SUBMIT_SUCCESS, type: REPORT_SUBMIT_SUCCESS,
report report,
}; };
}; };
export function submitReportFail(error) { export function submitReportFail(error) {
return { return {
type: REPORT_SUBMIT_FAIL, type: REPORT_SUBMIT_FAIL,
error error,
}; };
}; };
export function changeReportComment(comment) { export function changeReportComment(comment) {
return { return {
type: REPORT_COMMENT_CHANGE, type: REPORT_COMMENT_CHANGE,
comment comment,
}; };
}; };

View file

@ -1,4 +1,4 @@
import api from '../api' import api from '../api';
export const SEARCH_CHANGE = 'SEARCH_CHANGE'; export const SEARCH_CHANGE = 'SEARCH_CHANGE';
export const SEARCH_CLEAR = 'SEARCH_CLEAR'; export const SEARCH_CLEAR = 'SEARCH_CLEAR';
@ -11,13 +11,13 @@ export const SEARCH_FETCH_FAIL = 'SEARCH_FETCH_FAIL';
export function changeSearch(value) { export function changeSearch(value) {
return { return {
type: SEARCH_CHANGE, type: SEARCH_CHANGE,
value value,
}; };
}; };
export function clearSearch() { export function clearSearch() {
return { return {
type: SEARCH_CLEAR type: SEARCH_CLEAR,
}; };
}; };
@ -34,8 +34,8 @@ export function submitSearch() {
api(getState).get('/api/v1/search', { api(getState).get('/api/v1/search', {
params: { params: {
q: value, q: value,
resolve: true resolve: true,
} },
}).then(response => { }).then(response => {
dispatch(fetchSearchSuccess(response.data)); dispatch(fetchSearchSuccess(response.data));
}).catch(error => { }).catch(error => {
@ -46,7 +46,7 @@ export function submitSearch() {
export function fetchSearchRequest() { export function fetchSearchRequest() {
return { return {
type: SEARCH_FETCH_REQUEST type: SEARCH_FETCH_REQUEST,
}; };
}; };
@ -55,19 +55,19 @@ export function fetchSearchSuccess(results) {
type: SEARCH_FETCH_SUCCESS, type: SEARCH_FETCH_SUCCESS,
results, results,
accounts: results.accounts, accounts: results.accounts,
statuses: results.statuses statuses: results.statuses,
}; };
}; };
export function fetchSearchFail(error) { export function fetchSearchFail(error) {
return { return {
type: SEARCH_FETCH_FAIL, type: SEARCH_FETCH_FAIL,
error error,
}; };
}; };
export function showSearch() { export function showSearch() {
return { return {
type: SEARCH_SHOW type: SEARCH_SHOW,
}; };
}; };

View file

@ -6,14 +6,14 @@ export function changeSetting(key, value) {
return { return {
type: SETTING_CHANGE, type: SETTING_CHANGE,
key, key,
value value,
}; };
}; };
export function saveSettings() { export function saveSettings() {
return (_, getState) => { return (_, getState) => {
axios.put('/api/web/settings', { axios.put('/api/web/settings', {
data: getState().get('settings').toJS() data: getState().get('settings').toJS(),
}); });
}; };
}; };

View file

@ -27,7 +27,7 @@ export function fetchStatusRequest(id, skipLoading) {
return { return {
type: STATUS_FETCH_REQUEST, type: STATUS_FETCH_REQUEST,
id, id,
skipLoading skipLoading,
}; };
}; };
@ -56,7 +56,7 @@ export function fetchStatusSuccess(status, skipLoading) {
return { return {
type: STATUS_FETCH_SUCCESS, type: STATUS_FETCH_SUCCESS,
status, status,
skipLoading skipLoading,
}; };
}; };
@ -66,7 +66,7 @@ export function fetchStatusFail(id, error, skipLoading) {
id, id,
error, error,
skipLoading, skipLoading,
skipAlert: true skipAlert: true,
}; };
}; };
@ -86,14 +86,14 @@ export function deleteStatus(id) {
export function deleteStatusRequest(id) { export function deleteStatusRequest(id) {
return { return {
type: STATUS_DELETE_REQUEST, type: STATUS_DELETE_REQUEST,
id: id id: id,
}; };
}; };
export function deleteStatusSuccess(id) { export function deleteStatusSuccess(id) {
return { return {
type: STATUS_DELETE_SUCCESS, type: STATUS_DELETE_SUCCESS,
id: id id: id,
}; };
}; };
@ -101,7 +101,7 @@ export function deleteStatusFail(id, error) {
return { return {
type: STATUS_DELETE_FAIL, type: STATUS_DELETE_FAIL,
id: id, id: id,
error: error error: error,
}; };
}; };
@ -125,7 +125,7 @@ export function fetchContext(id) {
export function fetchContextRequest(id) { export function fetchContextRequest(id) {
return { return {
type: CONTEXT_FETCH_REQUEST, type: CONTEXT_FETCH_REQUEST,
id id,
}; };
}; };
@ -135,7 +135,7 @@ export function fetchContextSuccess(id, ancestors, descendants) {
id, id,
ancestors, ancestors,
descendants, descendants,
statuses: ancestors.concat(descendants) statuses: ancestors.concat(descendants),
}; };
}; };
@ -144,7 +144,7 @@ export function fetchContextFail(id, error) {
type: CONTEXT_FETCH_FAIL, type: CONTEXT_FETCH_FAIL,
id, id,
error, error,
skipAlert: true skipAlert: true,
}; };
}; };
@ -163,14 +163,14 @@ export function muteStatus(id) {
export function muteStatusRequest(id) { export function muteStatusRequest(id) {
return { return {
type: STATUS_MUTE_REQUEST, type: STATUS_MUTE_REQUEST,
id id,
}; };
}; };
export function muteStatusSuccess(id) { export function muteStatusSuccess(id) {
return { return {
type: STATUS_MUTE_SUCCESS, type: STATUS_MUTE_SUCCESS,
id id,
}; };
}; };
@ -178,7 +178,7 @@ export function muteStatusFail(id, error) {
return { return {
type: STATUS_MUTE_FAIL, type: STATUS_MUTE_FAIL,
id, id,
error error,
}; };
}; };
@ -197,14 +197,14 @@ export function unmuteStatus(id) {
export function unmuteStatusRequest(id) { export function unmuteStatusRequest(id) {
return { return {
type: STATUS_UNMUTE_REQUEST, type: STATUS_UNMUTE_REQUEST,
id id,
}; };
}; };
export function unmuteStatusSuccess(id) { export function unmuteStatusSuccess(id) {
return { return {
type: STATUS_UNMUTE_SUCCESS, type: STATUS_UNMUTE_SUCCESS,
id id,
}; };
}; };
@ -212,6 +212,6 @@ export function unmuteStatusFail(id, error) {
return { return {
type: STATUS_UNMUTE_FAIL, type: STATUS_UNMUTE_FAIL,
id, id,
error error,
}; };
}; };

View file

@ -12,6 +12,6 @@ export function hydrateStore(rawState) {
return { return {
type: STORE_HYDRATE, type: STORE_HYDRATE,
state state,
}; };
}; };

View file

@ -1,4 +1,4 @@
import api, { getLinks } from '../api' import api, { getLinks } from '../api';
import Immutable from 'immutable'; import Immutable from 'immutable';
export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
@ -23,7 +23,7 @@ export function refreshTimelineSuccess(timeline, statuses, skipLoading, next) {
timeline, timeline,
statuses, statuses,
skipLoading, skipLoading,
next next,
}; };
}; };
@ -35,7 +35,7 @@ export function updateTimeline(timeline, status) {
type: TIMELINE_UPDATE, type: TIMELINE_UPDATE,
timeline, timeline,
status, status,
references references,
}); });
}; };
}; };
@ -51,7 +51,7 @@ export function deleteFromTimelines(id) {
id, id,
accountId, accountId,
references, references,
reblogOf reblogOf,
}); });
}; };
}; };
@ -61,7 +61,7 @@ export function refreshTimelineRequest(timeline, id, skipLoading) {
type: TIMELINE_REFRESH_REQUEST, type: TIMELINE_REFRESH_REQUEST,
timeline, timeline,
id, id,
skipLoading skipLoading,
}; };
}; };
@ -106,7 +106,7 @@ export function refreshTimelineFail(timeline, error, skipLoading) {
type: TIMELINE_REFRESH_FAIL, type: TIMELINE_REFRESH_FAIL,
timeline, timeline,
error, error,
skipLoading skipLoading,
}; };
}; };
@ -130,8 +130,8 @@ export function expandTimeline(timeline) {
params: { params: {
...params, ...params,
max_id: lastId, max_id: lastId,
limit: 10 limit: 10,
} },
}).then(response => { }).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next'); const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(expandTimelineSuccess(timeline, response.data, next ? next.uri : null)); dispatch(expandTimelineSuccess(timeline, response.data, next ? next.uri : null));
@ -144,7 +144,7 @@ export function expandTimeline(timeline) {
export function expandTimelineRequest(timeline) { export function expandTimelineRequest(timeline) {
return { return {
type: TIMELINE_EXPAND_REQUEST, type: TIMELINE_EXPAND_REQUEST,
timeline timeline,
}; };
}; };
@ -153,7 +153,7 @@ export function expandTimelineSuccess(timeline, statuses, next) {
type: TIMELINE_EXPAND_SUCCESS, type: TIMELINE_EXPAND_SUCCESS,
timeline, timeline,
statuses, statuses,
next next,
}; };
}; };
@ -161,7 +161,7 @@ export function expandTimelineFail(timeline, error) {
return { return {
type: TIMELINE_EXPAND_FAIL, type: TIMELINE_EXPAND_FAIL,
timeline, timeline,
error error,
}; };
}; };
@ -169,20 +169,20 @@ export function scrollTopTimeline(timeline, top) {
return { return {
type: TIMELINE_SCROLL_TOP, type: TIMELINE_SCROLL_TOP,
timeline, timeline,
top top,
}; };
}; };
export function connectTimeline(timeline) { export function connectTimeline(timeline) {
return { return {
type: TIMELINE_CONNECT, type: TIMELINE_CONNECT,
timeline timeline,
}; };
}; };
export function disconnectTimeline(timeline) { export function disconnectTimeline(timeline) {
return { return {
type: TIMELINE_DISCONNECT, type: TIMELINE_DISCONNECT,
timeline timeline,
}; };
}; };

View file

@ -13,7 +13,7 @@ export const getLinks = response => {
export default getState => axios.create({ export default getState => axios.create({
headers: { headers: {
'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}` 'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`,
}, },
transformResponse: [function (data) { transformResponse: [function (data) {
@ -22,5 +22,5 @@ export default getState => axios.create({
} catch(Exception) { } catch(Exception) {
return data; return data;
} }
}] }],
}); });

View file

@ -13,7 +13,7 @@ const messages = defineMessages({
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' }, requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' },
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' }, 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 { class Account extends ImmutablePureComponent {
@ -24,7 +24,7 @@ class Account extends ImmutablePureComponent {
onFollow: PropTypes.func.isRequired, onFollow: PropTypes.func.isRequired,
onBlock: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired,
onMute: PropTypes.func.isRequired, onMute: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
constructor (props, context) { constructor (props, context) {
@ -62,7 +62,7 @@ class Account extends ImmutablePureComponent {
const muting = account.getIn(['relationship', 'muting']); const muting = account.getIn(['relationship', 'muting']);
if (requested) { 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) { } else if (blocking) {
buttons = <IconButton active={true} icon='unlock-alt' title={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.handleBlock} />; buttons = <IconButton active={true} icon='unlock-alt' title={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.handleBlock} />;
} else if (muting) { } else if (muting) {

View file

@ -6,7 +6,7 @@ const filename = url => url.split('/').pop().split('#')[0].split('?')[0];
class AttachmentList extends React.PureComponent { class AttachmentList extends React.PureComponent {
static propTypes = { static propTypes = {
media: ImmutablePropTypes.list.isRequired media: ImmutablePropTypes.list.isRequired,
}; };
render () { render () {

View file

@ -44,11 +44,11 @@ class AutosuggestTextarea extends ImmutablePureComponent {
onKeyUp: PropTypes.func, onKeyUp: PropTypes.func,
onKeyDown: PropTypes.func, onKeyDown: PropTypes.func,
onPaste: PropTypes.func.isRequired, onPaste: PropTypes.func.isRequired,
autoFocus: PropTypes.bool autoFocus: PropTypes.bool,
}; };
static defaultProps = { static defaultProps = {
autoFocus: true autoFocus: true,
}; };
constructor (props, context) { constructor (props, context) {
@ -57,7 +57,7 @@ class AutosuggestTextarea extends ImmutablePureComponent {
suggestionsHidden: false, suggestionsHidden: false,
selectedSuggestion: 0, selectedSuggestion: 0,
lastToken: null, lastToken: null,
tokenStart: 0 tokenStart: 0,
}; };
this.onChange = this.onChange.bind(this); this.onChange = this.onChange.bind(this);
this.onKeyDown = this.onKeyDown.bind(this); this.onKeyDown = this.onKeyDown.bind(this);
@ -164,7 +164,7 @@ class AutosuggestTextarea extends ImmutablePureComponent {
onPaste (e) { onPaste (e) {
if (e.clipboardData && e.clipboardData.files.length === 1) { if (e.clipboardData && e.clipboardData.files.length === 1) {
this.props.onPaste(e.clipboardData.files) this.props.onPaste(e.clipboardData.files);
e.preventDefault(); e.preventDefault();
} }
} }

View file

@ -9,17 +9,17 @@ class Avatar extends React.PureComponent {
size: PropTypes.number.isRequired, size: PropTypes.number.isRequired,
style: PropTypes.object, style: PropTypes.object,
animate: PropTypes.bool, animate: PropTypes.bool,
inline: PropTypes.bool inline: PropTypes.bool,
}; };
static defaultProps = { static defaultProps = {
animate: false, animate: false,
size: 20, size: 20,
inline: false inline: false,
}; };
state = { state = {
hovering: true hovering: true,
}; };
handleMouseEnter = () => { handleMouseEnter = () => {
@ -46,7 +46,7 @@ class Avatar extends React.PureComponent {
...this.props.style, ...this.props.style,
width: `${size}px`, width: `${size}px`,
height: `${size}px`, height: `${size}px`,
backgroundSize: `${size}px ${size}px` backgroundSize: `${size}px ${size}px`,
}; };
if (hovering || animate) { if (hovering || animate) {

View file

@ -2,20 +2,21 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
class AvatarOverlay extends React.PureComponent { class AvatarOverlay extends React.PureComponent {
static propTypes = { static propTypes = {
staticSrc: PropTypes.string.isRequired, staticSrc: PropTypes.string.isRequired,
overlaySrc: PropTypes.string.isRequired overlaySrc: PropTypes.string.isRequired,
}; };
render() { render() {
const {staticSrc, overlaySrc} = this.props; const {staticSrc, overlaySrc} = this.props;
const baseStyle = { const baseStyle = {
backgroundImage: `url(${staticSrc})` backgroundImage: `url(${staticSrc})`,
}; };
const overlayStyle = { const overlayStyle = {
backgroundImage: `url(${overlaySrc})` backgroundImage: `url(${overlaySrc})`,
}; };
return ( return (

View file

@ -11,11 +11,11 @@ class Button extends React.PureComponent {
secondary: PropTypes.bool, secondary: PropTypes.bool,
size: PropTypes.number, size: PropTypes.number,
style: PropTypes.object, style: PropTypes.object,
children: PropTypes.node children: PropTypes.node,
}; };
static defaultProps = { static defaultProps = {
size: 36 size: 36,
}; };
handleClick = (e) => { handleClick = (e) => {
@ -29,7 +29,7 @@ class Button extends React.PureComponent {
padding: `0 ${this.props.size / 2.25}px`, padding: `0 ${this.props.size / 2.25}px`,
height: `${this.props.size}px`, height: `${this.props.size}px`,
lineHeight: `${this.props.size}px`, lineHeight: `${this.props.size}px`,
...this.props.style ...this.props.style,
}; };
return ( return (

View file

@ -16,7 +16,7 @@ const Collapsable = ({ fullHeight, isVisible, children }) => (
Collapsable.propTypes = { Collapsable.propTypes = {
fullHeight: PropTypes.number.isRequired, fullHeight: PropTypes.number.isRequired,
isVisible: PropTypes.bool.isRequired, isVisible: PropTypes.bool.isRequired,
children: PropTypes.node.isRequired children: PropTypes.node.isRequired,
}; };
export default Collapsable; export default Collapsable;

View file

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
class ColumnBackButton extends React.PureComponent { class ColumnBackButton extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
handleClick = () => { handleClick = () => {

View file

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
class ColumnBackButtonSlim extends React.PureComponent { class ColumnBackButtonSlim extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
handleClick = () => { handleClick = () => {
@ -22,6 +22,7 @@ class ColumnBackButtonSlim extends React.PureComponent {
</div> </div>
); );
} }
} }
export default ColumnBackButtonSlim; export default ColumnBackButtonSlim;

View file

@ -8,11 +8,11 @@ class ColumnCollapsable extends React.PureComponent {
title: PropTypes.string, title: PropTypes.string,
fullHeight: PropTypes.number.isRequired, fullHeight: PropTypes.number.isRequired,
children: PropTypes.node, children: PropTypes.node,
onCollapse: PropTypes.func onCollapse: PropTypes.func,
}; };
state = { state = {
collapsed: true collapsed: true,
}; };
handleToggleCollapsed = () => { handleToggleCollapsed = () => {
@ -41,6 +41,7 @@ class ColumnCollapsable extends React.PureComponent {
</div> </div>
); );
} }
} }
export default ColumnCollapsable; export default ColumnCollapsable;

View file

@ -6,7 +6,7 @@ import emojify from '../emoji';
class DisplayName extends React.PureComponent { class DisplayName extends React.PureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map.isRequired account: ImmutablePropTypes.map.isRequired,
}; };
render () { render () {

View file

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
class DropdownMenu extends React.PureComponent { class DropdownMenu extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
static propTypes = { static propTypes = {
@ -13,11 +13,11 @@ class DropdownMenu extends React.PureComponent {
items: PropTypes.array.isRequired, items: PropTypes.array.isRequired,
size: PropTypes.number.isRequired, size: PropTypes.number.isRequired,
direction: PropTypes.string, direction: PropTypes.string,
ariaLabel: PropTypes.string ariaLabel: PropTypes.string,
}; };
static defaultProps = { static defaultProps = {
ariaLabel: "Menu" ariaLabel: "Menu",
}; };
state = { state = {

View file

@ -7,7 +7,7 @@ class ExtendedVideoPlayer extends React.PureComponent {
src: PropTypes.string.isRequired, src: PropTypes.string.isRequired,
time: PropTypes.number, time: PropTypes.number,
controls: PropTypes.bool.isRequired, controls: PropTypes.bool.isRequired,
muted: PropTypes.bool.isRequired muted: PropTypes.bool.isRequired,
}; };
handleLoadedData = () => { handleLoadedData = () => {

View file

@ -17,7 +17,7 @@ class IconButton extends React.PureComponent {
disabled: PropTypes.bool, disabled: PropTypes.bool,
inverted: PropTypes.bool, inverted: PropTypes.bool,
animate: PropTypes.bool, animate: PropTypes.bool,
overlay: PropTypes.bool overlay: PropTypes.bool,
}; };
static defaultProps = { static defaultProps = {
@ -25,7 +25,7 @@ class IconButton extends React.PureComponent {
active: false, active: false,
disabled: false, disabled: false,
animate: false, animate: false,
overlay: false overlay: false,
}; };
handleClick = (e) => { handleClick = (e) => {
@ -43,7 +43,7 @@ class IconButton extends React.PureComponent {
height: `${this.props.size * 1.28571429}px`, height: `${this.props.size * 1.28571429}px`,
lineHeight: `${this.props.size}px`, lineHeight: `${this.props.size}px`,
...this.props.style, ...this.props.style,
...(this.props.active ? this.props.activeStyle : {}) ...(this.props.active ? this.props.activeStyle : {}),
}; };
const classes = ['icon-button']; const classes = ['icon-button'];
@ -65,7 +65,7 @@ class IconButton extends React.PureComponent {
} }
if (this.props.className) { if (this.props.className) {
classes.push(this.props.className) classes.push(this.props.className);
} }
return ( return (

View file

@ -9,7 +9,7 @@ const LoadMore = ({ onClick }) => (
); );
LoadMore.propTypes = { LoadMore.propTypes = {
onClick: PropTypes.func onClick: PropTypes.func,
}; };
export default LoadMore; export default LoadMore;

View file

@ -6,7 +6,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { isIOS } from '../is_mobile'; import { isIOS } from '../is_mobile';
const messages = defineMessages({ 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 { class Item extends React.PureComponent {
@ -16,7 +16,7 @@ class Item extends React.PureComponent {
index: PropTypes.number.isRequired, index: PropTypes.number.isRequired,
size: PropTypes.number.isRequired, size: PropTypes.number.isRequired,
onClick: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired,
autoPlayGif: PropTypes.bool.isRequired autoPlayGif: PropTypes.bool.isRequired,
}; };
handleClick = (e) => { handleClick = (e) => {
@ -131,11 +131,11 @@ class MediaGallery extends React.PureComponent {
height: PropTypes.number.isRequired, height: PropTypes.number.isRequired,
onOpenMedia: PropTypes.func.isRequired, onOpenMedia: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
autoPlayGif: PropTypes.bool.isRequired autoPlayGif: PropTypes.bool.isRequired,
}; };
state = { state = {
visible: !this.props.sensitive visible: !this.props.sensitive,
}; };
handleOpen = (e) => { handleOpen = (e) => {

View file

@ -4,14 +4,14 @@ import PropTypes from 'prop-types';
class Permalink extends React.PureComponent { class Permalink extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
static propTypes = { static propTypes = {
className: PropTypes.string, className: PropTypes.string,
href: PropTypes.string.isRequired, href: PropTypes.string.isRequired,
to: PropTypes.string.isRequired, to: PropTypes.string.isRequired,
children: PropTypes.node children: PropTypes.node,
}; };
handleClick = (e) => { handleClick = (e) => {

View file

@ -14,7 +14,7 @@ const RelativeTimestamp = ({ intl, timestamp }) => {
RelativeTimestamp.propTypes = { RelativeTimestamp.propTypes = {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
timestamp: PropTypes.string.isRequired timestamp: PropTypes.string.isRequired,
}; };
export default injectIntl(RelativeTimestamp); export default injectIntl(RelativeTimestamp);

View file

@ -18,7 +18,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class Status extends ImmutablePureComponent { class Status extends ImmutablePureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
static propTypes = { static propTypes = {
@ -35,7 +35,7 @@ class Status extends ImmutablePureComponent {
me: PropTypes.number, me: PropTypes.number,
boostModal: PropTypes.bool, boostModal: PropTypes.bool,
autoPlayGif: PropTypes.bool, autoPlayGif: PropTypes.bool,
muted: PropTypes.bool muted: PropTypes.bool,
}; };
handleClick = () => { handleClick = () => {

View file

@ -24,7 +24,7 @@ const messages = defineMessages({
class StatusActionBar extends React.PureComponent { class StatusActionBar extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
static propTypes = { static propTypes = {
@ -40,7 +40,7 @@ class StatusActionBar extends React.PureComponent {
onMuteConversation: PropTypes.func, onMuteConversation: PropTypes.func,
me: PropTypes.number.isRequired, me: PropTypes.number.isRequired,
withDismiss: PropTypes.bool, withDismiss: PropTypes.bool,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
handleReplyClick = () => { handleReplyClick = () => {

View file

@ -10,16 +10,16 @@ import Permalink from './permalink';
class StatusContent extends React.PureComponent { class StatusContent extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
static propTypes = { static propTypes = {
status: ImmutablePropTypes.map.isRequired, status: ImmutablePropTypes.map.isRequired,
onClick: PropTypes.func onClick: PropTypes.func,
}; };
state = { state = {
hidden: true hidden: true,
}; };
componentDidMount () { 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'> <Permalink to={`/accounts/${item.get('id')}`} href={item.get('url')} key={item.get('id')} className='mention'>
@<span>{item.get('username')}</span> @<span>{item.get('username')}</span>
</Permalink> </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' />; const toggleText = hidden ? <FormattedMessage id='status.show_more' defaultMessage='Show more' /> : <FormattedMessage id='status.show_less' defaultMessage='Show less' />;

View file

@ -20,11 +20,11 @@ class StatusList extends ImmutablePureComponent {
isUnread: PropTypes.bool, isUnread: PropTypes.bool,
hasMore: PropTypes.bool, hasMore: PropTypes.bool,
prepend: PropTypes.node, prepend: PropTypes.node,
emptyMessage: PropTypes.node emptyMessage: PropTypes.node,
}; };
static defaultProps = { static defaultProps = {
trackScroll: true trackScroll: true,
}; };
handleScroll = (e) => { handleScroll = (e) => {

View file

@ -20,12 +20,12 @@ class VideoPlayer extends React.PureComponent {
sensitive: PropTypes.bool, sensitive: PropTypes.bool,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
autoplay: PropTypes.bool, autoplay: PropTypes.bool,
onOpenVideo: PropTypes.func.isRequired onOpenVideo: PropTypes.func.isRequired,
}; };
static defaultProps = { static defaultProps = {
width: 239, width: 239,
height: 110 height: 110,
}; };
state = { state = {
@ -33,7 +33,7 @@ class VideoPlayer extends React.PureComponent {
preview: true, preview: true,
muted: true, muted: true,
hasAudio: true, hasAudio: true,
videoError: false videoError: false,
}; };
handleClick = () => { handleClick = () => {
@ -59,7 +59,7 @@ class VideoPlayer extends React.PureComponent {
handleVisibility = () => { handleVisibility = () => {
this.setState({ this.setState({
visible: !this.state.visible, visible: !this.state.visible,
preview: true preview: true,
}); });
} }

View file

@ -15,7 +15,7 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({ const mapStateToProps = (state, props) => ({
account: getAccount(state, props.id), account: getAccount(state, props.id),
me: state.getIn(['meta', 'me']) me: state.getIn(['meta', 'me']),
}); });
return mapStateToProps; return mapStateToProps;
@ -44,7 +44,7 @@ const mapDispatchToProps = (dispatch) => ({
} else { } else {
dispatch(muteAccount(account.get('id'))); dispatch(muteAccount(account.get('id')));
} }
} },
}); });
export default connect(makeMapStateToProps, mapDispatchToProps)(Account); export default connect(makeMapStateToProps, mapDispatchToProps)(Account);

View file

@ -8,7 +8,7 @@ import {
deleteFromTimelines, deleteFromTimelines,
refreshTimeline, refreshTimeline,
connectTimeline, connectTimeline,
disconnectTimeline disconnectTimeline,
} from '../actions/timelines'; } from '../actions/timelines';
import { showOnboardingOnce } from '../actions/onboarding'; import { showOnboardingOnce } from '../actions/onboarding';
import { updateNotifications, refreshNotifications } from '../actions/notifications'; import { updateNotifications, refreshNotifications } from '../actions/notifications';
@ -75,7 +75,7 @@ const initialState = JSON.parse(document.getElementById("initial-state").textCon
store.dispatch(hydrateStore(initialState)); store.dispatch(hydrateStore(initialState));
const browserHistory = useRouterHistory(createBrowserHistory)({ const browserHistory = useRouterHistory(createBrowserHistory)({
basename: '/web' basename: '/web',
}); });
addLocaleData([ addLocaleData([
@ -155,7 +155,7 @@ class Mastodon extends React.PureComponent {
store.dispatch(connectTimeline('home')); store.dispatch(connectTimeline('home'));
store.dispatch(refreshTimeline('home')); store.dispatch(refreshTimeline('home'));
store.dispatch(refreshNotifications()); store.dispatch(refreshNotifications());
} },
}); });
@ -223,7 +223,7 @@ class Mastodon extends React.PureComponent {
} }
Mastodon.propTypes = { Mastodon.propTypes = {
locale: PropTypes.string.isRequired locale: PropTypes.string.isRequired,
}; };
export default Mastodon; export default Mastodon;

View file

@ -4,23 +4,23 @@ import Status from '../components/status';
import { makeGetStatus } from '../selectors'; import { makeGetStatus } from '../selectors';
import { import {
replyCompose, replyCompose,
mentionCompose mentionCompose,
} from '../actions/compose'; } from '../actions/compose';
import { import {
reblog, reblog,
favourite, favourite,
unreblog, unreblog,
unfavourite unfavourite,
} from '../actions/interactions'; } from '../actions/interactions';
import { import {
blockAccount, blockAccount,
muteAccount muteAccount,
} from '../actions/accounts'; } from '../actions/accounts';
import { muteStatus, unmuteStatus, deleteStatus } from '../actions/statuses'; import { muteStatus, unmuteStatus, deleteStatus } from '../actions/statuses';
import { initReport } from '../actions/reports'; import { initReport } from '../actions/reports';
import { openModal } from '../actions/modal'; import { openModal } from '../actions/modal';
import { createSelector } from 'reselect' import { createSelector } from 'reselect';
import { isMobile } from '../is_mobile' import { isMobile } from '../is_mobile';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
const messages = defineMessages({ const messages = defineMessages({
@ -37,7 +37,7 @@ const makeMapStateToProps = () => {
status: getStatus(state, props.id), status: getStatus(state, props.id),
me: state.getIn(['meta', 'me']), me: state.getIn(['meta', 'me']),
boostModal: state.getIn(['meta', 'boost_modal']), boostModal: state.getIn(['meta', 'boost_modal']),
autoPlayGif: state.getIn(['meta', 'auto_play_gif']) autoPlayGif: state.getIn(['meta', 'auto_play_gif']),
}); });
return mapStateToProps; return mapStateToProps;
@ -77,7 +77,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.deleteMessage), message: intl.formatMessage(messages.deleteMessage),
confirm: intl.formatMessage(messages.deleteConfirm), 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', { 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> }} />, 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), 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', { 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> }} />, 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), confirm: intl.formatMessage(messages.muteConfirm),
onConfirm: () => dispatch(muteAccount(account.get('id'))) onConfirm: () => dispatch(muteAccount(account.get('id'))),
})); }));
}, },

View file

@ -33,7 +33,7 @@ class ActionBar extends React.PureComponent {
onMute: PropTypes.func.isRequired, onMute: PropTypes.func.isRequired,
onBlockDomain: PropTypes.func.isRequired, onBlockDomain: PropTypes.func.isRequired,
onUnblockDomain: PropTypes.func.isRequired, onUnblockDomain: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
render () { render () {

View file

@ -13,12 +13,12 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({ const messages = defineMessages({
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
follow: { id: 'account.follow', defaultMessage: 'Follow' }, follow: { id: 'account.follow', defaultMessage: 'Follow' },
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' } requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' },
}); });
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({ const mapStateToProps = (state, props) => ({
autoPlayGif: state.getIn(['meta', 'auto_play_gif']) autoPlayGif: state.getIn(['meta', 'auto_play_gif']),
}); });
return mapStateToProps; return mapStateToProps;
@ -28,11 +28,11 @@ class Avatar extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map.isRequired, account: ImmutablePropTypes.map.isRequired,
autoPlayGif: PropTypes.bool.isRequired autoPlayGif: PropTypes.bool.isRequired,
}; };
state = { state = {
isHovered: false isHovered: false,
}; };
handleMouseOver = () => { handleMouseOver = () => {
@ -77,7 +77,7 @@ class Header extends ImmutablePureComponent {
me: PropTypes.number.isRequired, me: PropTypes.number.isRequired,
onFollow: PropTypes.func.isRequired, onFollow: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
autoPlayGif: PropTypes.bool.isRequired autoPlayGif: PropTypes.bool.isRequired,
}; };
render () { render () {
@ -97,7 +97,7 @@ class Header extends ImmutablePureComponent {
} }
if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { 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')) { if (me !== account.get('id')) {

View file

@ -6,7 +6,7 @@ import Permalink from '../../../components/permalink';
class MediaItem extends ImmutablePureComponent { class MediaItem extends ImmutablePureComponent {
static propTypes = { static propTypes = {
media: ImmutablePropTypes.map.isRequired media: ImmutablePropTypes.map.isRequired,
}; };
render () { render () {
@ -34,6 +34,7 @@ class MediaItem extends ImmutablePureComponent {
</div> </div>
); );
} }
} }
export default MediaItem; export default MediaItem;

View file

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import { import {
fetchAccount, fetchAccount,
fetchAccountMediaTimeline, fetchAccountMediaTimeline,
expandAccountMediaTimeline expandAccountMediaTimeline,
} from '../../actions/accounts'; } from '../../actions/accounts';
import LoadingIndicator from '../../components/loading_indicator'; import LoadingIndicator from '../../components/loading_indicator';
import Column from '../ui/components/column'; import Column from '../ui/components/column';

View file

@ -21,7 +21,7 @@ class Header extends ImmutablePureComponent {
}; };
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
handleFollow = () => { handleFollow = () => {

View file

@ -8,7 +8,7 @@ import {
blockAccount, blockAccount,
unblockAccount, unblockAccount,
muteAccount, muteAccount,
unmuteAccount unmuteAccount,
} from '../../../actions/accounts'; } from '../../../actions/accounts';
import { mentionCompose } from '../../../actions/compose'; import { mentionCompose } from '../../../actions/compose';
import { initReport } from '../../../actions/reports'; import { initReport } from '../../../actions/reports';
@ -27,7 +27,7 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, { accountId }) => ({ const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, Number(accountId)), account: getAccount(state, Number(accountId)),
me: state.getIn(['meta', 'me']) me: state.getIn(['meta', 'me']),
}); });
return mapStateToProps; return mapStateToProps;
@ -49,7 +49,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
dispatch(openModal('CONFIRM', { 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> }} />, 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), 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', { 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> }} />, 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), 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', { 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> }} />, 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), confirm: intl.formatMessage(messages.blockDomainConfirm),
onConfirm: () => dispatch(blockDomain(domain, accountId)) onConfirm: () => dispatch(blockDomain(domain, accountId)),
})); }));
}, },
onUnblockDomain (domain, accountId) { onUnblockDomain (domain, accountId) {
dispatch(unblockDomain(domain, accountId)); dispatch(unblockDomain(domain, accountId));
} },
}); });
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Header)); export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Header));

View file

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import { import {
fetchAccount, fetchAccount,
fetchAccountTimeline, fetchAccountTimeline,
expandAccountTimeline expandAccountTimeline,
} from '../../actions/accounts'; } from '../../actions/accounts';
import StatusList from '../../components/status_list'; import StatusList from '../../components/status_list';
import LoadingIndicator from '../../components/loading_indicator'; 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()), statusIds: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'items'], Immutable.List()),
isLoading: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'isLoading']), isLoading: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'isLoading']),
hasMore: !!state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'next']), 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 { class AccountTimeline extends ImmutablePureComponent {
@ -30,7 +30,7 @@ class AccountTimeline extends ImmutablePureComponent {
statusIds: ImmutablePropTypes.list, statusIds: ImmutablePropTypes.list,
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
hasMore: PropTypes.bool, hasMore: PropTypes.bool,
me: PropTypes.number.isRequired me: PropTypes.number.isRequired,
}; };
componentWillMount () { componentWillMount () {

View file

@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({ const messages = defineMessages({
heading: { id: 'column.blocks', defaultMessage: 'Blocked users' } heading: { id: 'column.blocks', defaultMessage: 'Blocked users' },
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'blocks', 'items']) accountIds: state.getIn(['user_lists', 'blocks', 'items']),
}); });
class Blocks extends ImmutablePureComponent { class Blocks extends ImmutablePureComponent {
@ -25,7 +25,7 @@ class Blocks extends ImmutablePureComponent {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
componentWillMount () { componentWillMount () {
@ -64,6 +64,7 @@ class Blocks extends ImmutablePureComponent {
</Column> </Column>
); );
} }
} }
export default connect(mapStateToProps)(injectIntl(Blocks)); export default connect(mapStateToProps)(injectIntl(Blocks));

View file

@ -8,20 +8,20 @@ import {
updateTimeline, updateTimeline,
deleteFromTimelines, deleteFromTimelines,
connectTimeline, connectTimeline,
disconnectTimeline disconnectTimeline,
} from '../../actions/timelines'; } from '../../actions/timelines';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ColumnBackButtonSlim from '../../components/column_back_button_slim'; import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import createStream from '../../stream'; import createStream from '../../stream';
const messages = defineMessages({ const messages = defineMessages({
title: { id: 'column.community', defaultMessage: 'Local timeline' } title: { id: 'column.community', defaultMessage: 'Local timeline' },
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'community', 'unread']) > 0, hasUnread: state.getIn(['timelines', 'community', 'unread']) > 0,
streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']), streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']),
accessToken: state.getIn(['meta', 'access_token']) accessToken: state.getIn(['meta', 'access_token']),
}); });
let subscription; let subscription;
@ -33,7 +33,7 @@ class CommunityTimeline extends React.PureComponent {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
streamingAPIBaseURL: PropTypes.string.isRequired, streamingAPIBaseURL: PropTypes.string.isRequired,
accessToken: PropTypes.string.isRequired, accessToken: PropTypes.string.isRequired,
hasUnread: PropTypes.bool hasUnread: PropTypes.bool,
}; };
componentDidMount () { componentDidMount () {
@ -68,7 +68,7 @@ class CommunityTimeline extends React.PureComponent {
dispatch(deleteFromTimelines(data.payload)); dispatch(deleteFromTimelines(data.payload));
break; break;
} }
} },
}); });
} }

View file

@ -7,7 +7,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class AutosuggestAccount extends ImmutablePureComponent { class AutosuggestAccount extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map.isRequired account: ImmutablePropTypes.map.isRequired,
}; };
render () { render () {

View file

@ -6,7 +6,7 @@ class CharacterCounter extends React.PureComponent {
static propTypes = { static propTypes = {
text: PropTypes.string.isRequired, text: PropTypes.string.isRequired,
max: PropTypes.number.isRequired max: PropTypes.number.isRequired,
}; };
checkRemainingText (diff) { checkRemainingText (diff) {

View file

@ -53,7 +53,7 @@ class ComposeForm extends ImmutablePureComponent {
}; };
static defaultProps = { static defaultProps = {
showSearch: false showSearch: false,
}; };
handleChange = (e) => { handleChange = (e) => {

View file

@ -13,13 +13,13 @@ const messages = defineMessages({
travel: { id: 'emoji_button.travel', defaultMessage: 'Travel & Places' }, travel: { id: 'emoji_button.travel', defaultMessage: 'Travel & Places' },
objects: { id: 'emoji_button.objects', defaultMessage: 'Objects' }, objects: { id: 'emoji_button.objects', defaultMessage: 'Objects' },
symbols: { id: 'emoji_button.symbols', defaultMessage: 'Symbols' }, symbols: { id: 'emoji_button.symbols', defaultMessage: 'Symbols' },
flags: { id: 'emoji_button.flags', defaultMessage: 'Flags' } flags: { id: 'emoji_button.flags', defaultMessage: 'Flags' },
}); });
const settings = { const settings = {
imageType: 'png', imageType: 'png',
sprites: false, sprites: false,
imagePathPNG: '/emoji/' imagePathPNG: '/emoji/',
}; };
let EmojiPicker; // load asynchronously let EmojiPicker; // load asynchronously
@ -28,12 +28,12 @@ class EmojiPickerDropdown extends React.PureComponent {
static propTypes = { static propTypes = {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
onPickEmoji: PropTypes.func.isRequired onPickEmoji: PropTypes.func.isRequired,
}; };
state = { state = {
active: false, active: false,
loading: false loading: false,
}; };
setRef = (c) => { setRef = (c) => {
@ -98,8 +98,8 @@ class EmojiPickerDropdown extends React.PureComponent {
flags: { flags: {
title: intl.formatMessage(messages.flags), title: intl.formatMessage(messages.flags),
emoji: 'flag_gb', emoji: 'flag_gb',
} },
} };
const { active, loading } = this.state; const { active, loading } = this.state;

View file

@ -11,7 +11,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class NavigationBar extends ImmutablePureComponent { class NavigationBar extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map.isRequired account: ImmutablePropTypes.map.isRequired,
}; };
render () { render () {

View file

@ -12,24 +12,24 @@ const messages = defineMessages({
private_long: { id: 'privacy.private.long', defaultMessage: 'Post to followers only' }, private_long: { id: 'privacy.private.long', defaultMessage: 'Post to followers only' },
direct_short: { id: 'privacy.direct.short', defaultMessage: 'Direct' }, direct_short: { id: 'privacy.direct.short', defaultMessage: 'Direct' },
direct_long: { id: 'privacy.direct.long', defaultMessage: 'Post to mentioned users only' }, 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 = { const iconStyle = {
height: null, height: null,
lineHeight: '27px' lineHeight: '27px',
} };
class PrivacyDropdown extends React.PureComponent { class PrivacyDropdown extends React.PureComponent {
static propTypes = { static propTypes = {
value: PropTypes.string.isRequired, value: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
state = { state = {
open: false open: false,
}; };
handleToggle = () => { 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: '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: '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: '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); const valueOption = options.find(item => item.value === value);

View file

@ -9,19 +9,19 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({ const messages = defineMessages({
cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' } cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' },
}); });
class ReplyIndicator extends ImmutablePureComponent { class ReplyIndicator extends ImmutablePureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
}; };
static propTypes = { static propTypes = {
status: ImmutablePropTypes.map, status: ImmutablePropTypes.map,
onCancel: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
handleClick = () => { handleClick = () => {

View file

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
const messages = defineMessages({ const messages = defineMessages({
placeholder: { id: 'search.placeholder', defaultMessage: 'Search' } placeholder: { id: 'search.placeholder', defaultMessage: 'Search' },
}); });
class Search extends React.PureComponent { class Search extends React.PureComponent {
@ -15,7 +15,7 @@ class Search extends React.PureComponent {
onSubmit: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired,
onClear: PropTypes.func.isRequired, onClear: PropTypes.func.isRequired,
onShow: PropTypes.func.isRequired, onShow: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
handleChange = (e) => { handleChange = (e) => {

View file

@ -9,7 +9,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class SearchResults extends ImmutablePureComponent { class SearchResults extends ImmutablePureComponent {
static propTypes = { static propTypes = {
results: ImmutablePropTypes.map.isRequired results: ImmutablePropTypes.map.isRequired,
}; };
render () { render () {

View file

@ -8,7 +8,7 @@ class TextIconButton extends React.PureComponent {
title: PropTypes.string, title: PropTypes.string,
active: PropTypes.bool, active: PropTypes.bool,
onClick: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired,
ariaControls: PropTypes.string ariaControls: PropTypes.string,
}; };
handleClick = (e) => { handleClick = (e) => {

View file

@ -5,7 +5,7 @@ import { defineMessages, injectIntl } from 'react-intl';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
const messages = defineMessages({ const messages = defineMessages({
upload: { id: 'upload_button.label', defaultMessage: 'Add media' } upload: { id: 'upload_button.label', defaultMessage: 'Add media' },
}); });
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
@ -14,12 +14,12 @@ const makeMapStateToProps = () => {
}); });
return mapStateToProps; return mapStateToProps;
} };
const iconStyle = { const iconStyle = {
height: null, height: null,
lineHeight: '27px' lineHeight: '27px',
} };
class UploadButton extends React.PureComponent { class UploadButton extends React.PureComponent {
@ -29,7 +29,7 @@ class UploadButton extends React.PureComponent {
style: PropTypes.object, style: PropTypes.object,
resetFileKey: PropTypes.number, resetFileKey: PropTypes.number,
acceptContentTypes: PropTypes.arrayOf(PropTypes.string).isRequired, acceptContentTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
handleChange = (e) => { handleChange = (e) => {

View file

@ -8,7 +8,7 @@ import Motion from 'react-motion/lib/Motion';
import spring from 'react-motion/lib/spring'; import spring from 'react-motion/lib/spring';
const messages = defineMessages({ const messages = defineMessages({
undo: { id: 'upload_form.undo', defaultMessage: 'Undo' } undo: { id: 'upload_form.undo', defaultMessage: 'Undo' },
}); });
class UploadForm extends React.PureComponent { class UploadForm extends React.PureComponent {
@ -16,7 +16,7 @@ class UploadForm extends React.PureComponent {
static propTypes = { static propTypes = {
media: ImmutablePropTypes.list.isRequired, media: ImmutablePropTypes.list.isRequired,
onRemoveFile: PropTypes.func.isRequired, onRemoveFile: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
onRemoveFile = (e) => { onRemoveFile = (e) => {

View file

@ -8,7 +8,7 @@ class UploadProgress extends React.PureComponent {
static propTypes = { static propTypes = {
active: PropTypes.bool, active: PropTypes.bool,
progress: PropTypes.number progress: PropTypes.number,
}; };
render () { render () {

View file

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
class Warning extends React.PureComponent { class Warning extends React.PureComponent {
static propTypes = { static propTypes = {
message: PropTypes.node.isRequired message: PropTypes.node.isRequired,
}; };
render () { render () {

View file

@ -6,7 +6,7 @@ const makeMapStateToProps = () => {
const getAccount = makeGetAccount(); const getAccount = makeGetAccount();
const mapStateToProps = (state, { id }) => ({ const mapStateToProps = (state, { id }) => ({
account: getAccount(state, id) account: getAccount(state, id),
}); });
return mapStateToProps; return mapStateToProps;

View file

@ -6,7 +6,7 @@ const makeMapStateToProps = () => {
const getStatus = makeGetStatus(); const getStatus = makeGetStatus();
const mapStateToProps = (state, { id }) => ({ const mapStateToProps = (state, { id }) => ({
status: getStatus(state, id) status: getStatus(state, id),
}); });
return mapStateToProps; return mapStateToProps;

View file

@ -8,7 +8,7 @@ import {
fetchComposeSuggestions, fetchComposeSuggestions,
selectComposeSuggestion, selectComposeSuggestion,
changeComposeSpoilerText, changeComposeSpoilerText,
insertEmojiCompose insertEmojiCompose,
} from '../../../actions/compose'; } from '../../../actions/compose';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
@ -23,7 +23,7 @@ const mapStateToProps = state => ({
is_submitting: state.getIn(['compose', 'is_submitting']), is_submitting: state.getIn(['compose', 'is_submitting']),
is_uploading: state.getIn(['compose', 'is_uploading']), is_uploading: state.getIn(['compose', 'is_uploading']),
me: state.getIn(['compose', 'me']), 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) => ({ const mapDispatchToProps = (dispatch) => ({

View file

@ -3,7 +3,7 @@ import NavigationBar from '../components/navigation_bar';
const mapStateToProps = (state, props) => { const mapStateToProps = (state, props) => {
return { return {
account: state.getIn(['accounts', state.getIn(['meta', 'me'])]) account: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
}; };
}; };

View file

@ -3,14 +3,14 @@ import PrivacyDropdown from '../components/privacy_dropdown';
import { changeComposeVisibility } from '../../../actions/compose'; import { changeComposeVisibility } from '../../../actions/compose';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
value: state.getIn(['compose', 'privacy']) value: state.getIn(['compose', 'privacy']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
onChange (value) { onChange (value) {
dispatch(changeComposeVisibility(value)); dispatch(changeComposeVisibility(value));
} },
}); });

View file

@ -17,7 +17,7 @@ const mapDispatchToProps = dispatch => ({
onCancel () { onCancel () {
dispatch(cancelReplyCompose()); dispatch(cancelReplyCompose());
} },
}); });

View file

@ -3,13 +3,13 @@ import {
changeSearch, changeSearch,
clearSearch, clearSearch,
submitSearch, submitSearch,
showSearch showSearch,
} from '../../../actions/search'; } from '../../../actions/search';
import Search from '../components/search'; import Search from '../components/search';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
value: state.getIn(['search', 'value']), value: state.getIn(['search', 'value']),
submitted: state.getIn(['search', 'submitted']) submitted: state.getIn(['search', 'submitted']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
@ -28,7 +28,7 @@ const mapDispatchToProps = dispatch => ({
onShow () { onShow () {
dispatch(showSearch()); dispatch(showSearch());
} },
}); });

View file

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import SearchResults from '../components/search_results'; import SearchResults from '../components/search_results';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
results: state.getIn(['search', 'results']) results: state.getIn(['search', 'results']),
}); });
export default connect(mapStateToProps)(SearchResults); export default connect(mapStateToProps)(SearchResults);

View file

@ -8,19 +8,19 @@ import spring from 'react-motion/lib/spring';
import { injectIntl, defineMessages } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl';
const messages = defineMessages({ 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 => ({ const mapStateToProps = state => ({
visible: state.getIn(['compose', 'media_attachments']).size > 0, visible: state.getIn(['compose', 'media_attachments']).size > 0,
active: state.getIn(['compose', 'sensitive']) active: state.getIn(['compose', 'sensitive']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
onClick () { onClick () {
dispatch(changeComposeSensitivity()); dispatch(changeComposeSensitivity());
} },
}); });
@ -30,7 +30,7 @@ class SensitiveButton extends React.PureComponent {
visible: PropTypes.bool, visible: PropTypes.bool,
active: PropTypes.bool, active: PropTypes.bool,
onClick: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
render () { render () {

View file

@ -4,21 +4,21 @@ import { changeComposeSpoilerness } from '../../../actions/compose';
import { injectIntl, defineMessages } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl';
const messages = defineMessages({ 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 }) => ({ const mapStateToProps = (state, { intl }) => ({
label: 'CW', label: 'CW',
title: intl.formatMessage(messages.title), title: intl.formatMessage(messages.title),
active: state.getIn(['compose', 'spoiler']), active: state.getIn(['compose', 'spoiler']),
ariaControls: 'cw-spoiler-input' ariaControls: 'cw-spoiler-input',
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
onClick () { onClick () {
dispatch(changeComposeSpoilerness()); dispatch(changeComposeSpoilerness());
} },
}); });

View file

@ -4,14 +4,14 @@ import { uploadCompose } from '../../../actions/compose';
const mapStateToProps = state => ({ 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')), 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 => ({ const mapDispatchToProps = dispatch => ({
onSelectFile (files) { onSelectFile (files) {
dispatch(uploadCompose(files)); dispatch(uploadCompose(files));
} },
}); });

View file

@ -10,7 +10,7 @@ const mapDispatchToProps = dispatch => ({
onRemoveFile (media_id) { onRemoveFile (media_id) {
dispatch(undoUploadCompose(media_id)); dispatch(undoUploadCompose(media_id));
} },
}); });

View file

@ -3,7 +3,7 @@ import UploadProgress from '../components/upload_progress';
const mapStateToProps = (state, props) => ({ const mapStateToProps = (state, props) => ({
active: state.getIn(['compose', 'is_uploading']), active: state.getIn(['compose', 'is_uploading']),
progress: state.getIn(['compose', 'progress']) progress: state.getIn(['compose', 'progress']),
}); });
export default connect(mapStateToProps)(UploadProgress); export default connect(mapStateToProps)(UploadProgress);

View file

@ -20,7 +20,7 @@ const mapStateToProps = state => {
return { return {
needsLeakWarning: (state.getIn(['compose', 'privacy']) === 'private' || state.getIn(['compose', 'privacy']) === 'direct') && mentionedUsernames !== null, needsLeakWarning: (state.getIn(['compose', 'privacy']) === 'private' || state.getIn(['compose', 'privacy']) === 'direct') && mentionedUsernames !== null,
mentionedDomains: mentionedUsernamesWithDomains, 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']),
}; };
}; };

View file

@ -17,11 +17,11 @@ const messages = defineMessages({
public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' }, public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' }, community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' } logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
}); });
const mapStateToProps = state => ({ 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 { class Compose extends React.PureComponent {
@ -30,7 +30,7 @@ class Compose extends React.PureComponent {
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
withHeader: PropTypes.bool, withHeader: PropTypes.bool,
showSearch: PropTypes.bool, showSearch: PropTypes.bool,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
componentDidMount () { componentDidMount () {

View file

@ -11,13 +11,13 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({ const messages = defineMessages({
heading: { id: 'column.favourites', defaultMessage: 'Favourites' } heading: { id: 'column.favourites', defaultMessage: 'Favourites' },
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
statusIds: state.getIn(['status_lists', 'favourites', 'items']), statusIds: state.getIn(['status_lists', 'favourites', 'items']),
loaded: state.getIn(['status_lists', 'favourites', 'loaded']), loaded: state.getIn(['status_lists', 'favourites', 'loaded']),
me: state.getIn(['meta', 'me']) me: state.getIn(['meta', 'me']),
}); });
class Favourites extends ImmutablePureComponent { class Favourites extends ImmutablePureComponent {
@ -27,7 +27,7 @@ class Favourites extends ImmutablePureComponent {
statusIds: ImmutablePropTypes.list.isRequired, statusIds: ImmutablePropTypes.list.isRequired,
loaded: PropTypes.bool, loaded: PropTypes.bool,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
me: PropTypes.number.isRequired me: PropTypes.number.isRequired,
}; };
componentWillMount () { componentWillMount () {

View file

@ -11,7 +11,7 @@ import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({ 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 { class Favourites extends ImmutablePureComponent {
@ -19,7 +19,7 @@ class Favourites extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list accountIds: ImmutablePropTypes.list,
}; };
componentWillMount () { componentWillMount () {

View file

@ -11,7 +11,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({ const messages = defineMessages({
authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' }, 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 { class AccountAuthorize extends ImmutablePureComponent {
@ -20,7 +20,7 @@ class AccountAuthorize extends ImmutablePureComponent {
account: ImmutablePropTypes.map.isRequired, account: ImmutablePropTypes.map.isRequired,
onAuthorize: PropTypes.func.isRequired, onAuthorize: PropTypes.func.isRequired,
onReject: PropTypes.func.isRequired, onReject: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
render () { render () {

View file

@ -7,7 +7,7 @@ const makeMapStateToProps = () => {
const getAccount = makeGetAccount(); const getAccount = makeGetAccount();
const mapStateToProps = (state, props) => ({ const mapStateToProps = (state, props) => ({
account: getAccount(state, props.id) account: getAccount(state, props.id),
}); });
return mapStateToProps; return mapStateToProps;
@ -20,7 +20,7 @@ const mapDispatchToProps = (dispatch, { id }) => ({
onReject (account) { onReject (account) {
dispatch(rejectFollowRequest(id)); dispatch(rejectFollowRequest(id));
} },
}); });
export default connect(makeMapStateToProps, mapDispatchToProps)(AccountAuthorize); export default connect(makeMapStateToProps, mapDispatchToProps)(AccountAuthorize);

View file

@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({ const messages = defineMessages({
heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' } heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' },
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'follow_requests', 'items']) accountIds: state.getIn(['user_lists', 'follow_requests', 'items']),
}); });
class FollowRequests extends ImmutablePureComponent { class FollowRequests extends ImmutablePureComponent {
@ -25,7 +25,7 @@ class FollowRequests extends ImmutablePureComponent {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
componentWillMount () { componentWillMount () {

View file

@ -6,7 +6,7 @@ import LoadingIndicator from '../../components/loading_indicator';
import { import {
fetchAccount, fetchAccount,
fetchFollowers, fetchFollowers,
expandFollowers expandFollowers,
} from '../../actions/accounts'; } from '../../actions/accounts';
import { ScrollContainer } from 'react-router-scroll'; import { ScrollContainer } from 'react-router-scroll';
import AccountContainer from '../../containers/account_container'; import AccountContainer from '../../containers/account_container';
@ -17,7 +17,7 @@ import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({ 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 { class Followers extends ImmutablePureComponent {
@ -25,7 +25,7 @@ class Followers extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list accountIds: ImmutablePropTypes.list,
}; };
componentWillMount () { componentWillMount () {

View file

@ -6,7 +6,7 @@ import LoadingIndicator from '../../components/loading_indicator';
import { import {
fetchAccount, fetchAccount,
fetchFollowing, fetchFollowing,
expandFollowing expandFollowing,
} from '../../actions/accounts'; } from '../../actions/accounts';
import { ScrollContainer } from 'react-router-scroll'; import { ScrollContainer } from 'react-router-scroll';
import AccountContainer from '../../containers/account_container'; import AccountContainer from '../../containers/account_container';
@ -17,7 +17,7 @@ import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({ 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 { class Following extends ImmutablePureComponent {
@ -25,7 +25,7 @@ class Following extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list accountIds: ImmutablePropTypes.list,
}; };
componentWillMount () { componentWillMount () {

View file

@ -21,18 +21,18 @@ const messages = defineMessages({
favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' },
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted 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 => ({ const mapStateToProps = state => ({
me: state.getIn(['accounts', state.getIn(['meta', 'me'])]) me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
}); });
class GettingStarted extends ImmutablePureComponent { class GettingStarted extends ImmutablePureComponent {
static propTypes = { static propTypes = {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
me: ImmutablePropTypes.map.isRequired me: ImmutablePropTypes.map.isRequired,
}; };
render () { render () {
@ -69,7 +69,7 @@ class GettingStarted extends ImmutablePureComponent {
values={{ 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>, 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>, 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> </p>
@ -85,6 +85,7 @@ class GettingStarted extends ImmutablePureComponent {
</Column> </Column>
); );
} }
} }
export default connect(mapStateToProps)(injectIntl(GettingStarted)); export default connect(mapStateToProps)(injectIntl(GettingStarted));

View file

@ -6,7 +6,7 @@ import Column from '../ui/components/column';
import { import {
refreshTimeline, refreshTimeline,
updateTimeline, updateTimeline,
deleteFromTimelines deleteFromTimelines,
} from '../../actions/timelines'; } from '../../actions/timelines';
import ColumnBackButtonSlim from '../../components/column_back_button_slim'; import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
@ -15,7 +15,7 @@ import createStream from '../../stream';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'tag', 'unread']) > 0, hasUnread: state.getIn(['timelines', 'tag', 'unread']) > 0,
streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']), 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 { class HashtagTimeline extends React.PureComponent {
@ -25,7 +25,7 @@ class HashtagTimeline extends React.PureComponent {
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
streamingAPIBaseURL: PropTypes.string.isRequired, streamingAPIBaseURL: PropTypes.string.isRequired,
accessToken: PropTypes.string.isRequired, accessToken: PropTypes.string.isRequired,
hasUnread: PropTypes.bool hasUnread: PropTypes.bool,
}; };
_subscribe (dispatch, id) { _subscribe (dispatch, id) {
@ -42,7 +42,7 @@ class HashtagTimeline extends React.PureComponent {
dispatch(deleteFromTimelines(data.payload)); dispatch(deleteFromTimelines(data.payload));
break; break;
} }
} },
}); });
} }

View file

@ -8,7 +8,7 @@ import SettingText from './setting_text';
const messages = defineMessages({ const messages = defineMessages({
filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' }, 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 { class ColumnSettings extends React.PureComponent {
@ -17,7 +17,7 @@ class ColumnSettings extends React.PureComponent {
settings: ImmutablePropTypes.map.isRequired, settings: ImmutablePropTypes.map.isRequired,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
onSave: PropTypes.func.isRequired, onSave: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
render () { render () {

View file

@ -8,11 +8,11 @@ class SettingText extends React.PureComponent {
settings: ImmutablePropTypes.map.isRequired, settings: ImmutablePropTypes.map.isRequired,
settingKey: PropTypes.array.isRequired, settingKey: PropTypes.array.isRequired,
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired onChange: PropTypes.func.isRequired,
}; };
handleChange = (e) => { handleChange = (e) => {
this.props.onChange(this.props.settingKey, e.target.value) this.props.onChange(this.props.settingKey, e.target.value);
} }
render () { render () {

View file

@ -3,7 +3,7 @@ import ColumnSettings from '../components/column_settings';
import { changeSetting, saveSettings } from '../../../actions/settings'; import { changeSetting, saveSettings } from '../../../actions/settings';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
settings: state.getIn(['settings', 'home']) settings: state.getIn(['settings', 'home']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
@ -14,7 +14,7 @@ const mapDispatchToProps = dispatch => ({
onSave () { onSave () {
dispatch(saveSettings()); dispatch(saveSettings());
} },
}); });

View file

@ -8,12 +8,12 @@ import ColumnSettingsContainer from './containers/column_settings_container';
import Link from 'react-router/lib/Link'; import Link from 'react-router/lib/Link';
const messages = defineMessages({ const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' } title: { id: 'column.home', defaultMessage: 'Home' },
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0, 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 { class HomeTimeline extends React.PureComponent {
@ -21,7 +21,7 @@ class HomeTimeline extends React.PureComponent {
static propTypes = { static propTypes = {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
hasUnread: PropTypes.bool, hasUnread: PropTypes.bool,
hasFollows: PropTypes.bool hasFollows: PropTypes.bool,
}; };
render () { render () {
@ -30,7 +30,7 @@ class HomeTimeline extends React.PureComponent {
let emptyMessage; let emptyMessage;
if (hasFollows) { 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 { } 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> }} />; 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> }} />;
} }

View file

@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({ const messages = defineMessages({
heading: { id: 'column.mutes', defaultMessage: 'Muted users' } heading: { id: 'column.mutes', defaultMessage: 'Muted users' },
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'mutes', 'items']) accountIds: state.getIn(['user_lists', 'mutes', 'items']),
}); });
class Mutes extends ImmutablePureComponent { class Mutes extends ImmutablePureComponent {
@ -64,7 +64,7 @@ Mutes.propTypes = {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
export default connect(mapStateToProps)(injectIntl(Mutes)); export default connect(mapStateToProps)(injectIntl(Mutes));

View file

@ -3,14 +3,14 @@ import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
const messages = defineMessages({ const messages = defineMessages({
clear: { id: 'notifications.clear', defaultMessage: 'Clear notifications' } clear: { id: 'notifications.clear', defaultMessage: 'Clear notifications' },
}); });
class ClearColumnButton extends React.Component { class ClearColumnButton extends React.Component {
static propTypes = { static propTypes = {
onClick: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired,
}; };
render () { render () {
@ -22,6 +22,7 @@ class ClearColumnButton extends React.Component {
</div> </div>
); );
} }
} }
export default injectIntl(ClearColumnButton); export default injectIntl(ClearColumnButton);

View file

@ -6,7 +6,7 @@ import ColumnCollapsable from '../../../components/column_collapsable';
import SettingToggle from './setting_toggle'; import SettingToggle from './setting_toggle';
const messages = defineMessages({ const messages = defineMessages({
settings: { id: 'notifications.settings', defaultMessage: 'Column settings' } settings: { id: 'notifications.settings', defaultMessage: 'Column settings' },
}); });
class ColumnSettings extends React.PureComponent { class ColumnSettings extends React.PureComponent {
@ -16,8 +16,8 @@ class ColumnSettings extends React.PureComponent {
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
onSave: PropTypes.func.isRequired, onSave: PropTypes.func.isRequired,
intl: PropTypes.shape({ intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired formatMessage: PropTypes.func.isRequired,
}).isRequired }).isRequired,
}; };
render () { render () {

View file

@ -12,7 +12,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class Notification extends ImmutablePureComponent { class Notification extends ImmutablePureComponent {
static propTypes = { static propTypes = {
notification: ImmutablePropTypes.map.isRequired notification: ImmutablePropTypes.map.isRequired,
}; };
renderFollow (account, link) { renderFollow (account, link) {

Some files were not shown because too many files have changed in this diff Show more