|
|
|
@ -56,7 +56,7 @@ export function changeCompose(text) { |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export function replyCompose(status, router) { |
|
|
|
|
export function replyCompose(status, routerHistory) { |
|
|
|
|
return (dispatch, getState) => { |
|
|
|
|
dispatch({ |
|
|
|
|
type: COMPOSE_REPLY, |
|
|
|
@ -64,7 +64,7 @@ export function replyCompose(status, router) { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (!getState().getIn(['compose', 'mounted'])) { |
|
|
|
|
router.push('/statuses/new'); |
|
|
|
|
routerHistory.push('/statuses/new'); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
@ -81,7 +81,7 @@ export function resetCompose() { |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export function mentionCompose(account, router) { |
|
|
|
|
export function mentionCompose(account, routerHistory) { |
|
|
|
|
return (dispatch, getState) => { |
|
|
|
|
dispatch({ |
|
|
|
|
type: COMPOSE_MENTION, |
|
|
|
@ -89,12 +89,12 @@ export function mentionCompose(account, router) { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (!getState().getIn(['compose', 'mounted'])) { |
|
|
|
|
router.push('/statuses/new'); |
|
|
|
|
routerHistory.push('/statuses/new'); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export function directCompose(account, router) { |
|
|
|
|
export function directCompose(account, routerHistory) { |
|
|
|
|
return (dispatch, getState) => { |
|
|
|
|
dispatch({ |
|
|
|
|
type: COMPOSE_DIRECT, |
|
|
|
@ -102,12 +102,12 @@ export function directCompose(account, router) { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (!getState().getIn(['compose', 'mounted'])) { |
|
|
|
|
router.push('/statuses/new'); |
|
|
|
|
routerHistory.push('/statuses/new'); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export function submitCompose() { |
|
|
|
|
export function submitCompose(routerHistory) { |
|
|
|
|
return function (dispatch, getState) { |
|
|
|
|
const status = getState().getIn(['compose', 'text'], ''); |
|
|
|
|
const media = getState().getIn(['compose', 'media_attachments']); |
|
|
|
@ -133,21 +133,22 @@ export function submitCompose() { |
|
|
|
|
dispatch(insertIntoTagHistory(response.data.tags, status)); |
|
|
|
|
dispatch(submitComposeSuccess({ ...response.data })); |
|
|
|
|
|
|
|
|
|
// To make the app more responsive, immediately get the status into the columns
|
|
|
|
|
// To make the app more responsive, immediately push the status
|
|
|
|
|
// into the columns
|
|
|
|
|
|
|
|
|
|
const insertIfOnline = (timelineId) => { |
|
|
|
|
const insertIfOnline = timelineId => { |
|
|
|
|
if (getState().getIn(['timelines', timelineId, 'items', 0]) !== null) { |
|
|
|
|
dispatch(updateTimeline(timelineId, { ...response.data })); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
insertIfOnline('home'); |
|
|
|
|
|
|
|
|
|
if (response.data.in_reply_to_id === null && response.data.visibility === 'public') { |
|
|
|
|
if (response.data.visibility === 'direct' && getState().getIn(['conversations', 'mounted']) <= 0) { |
|
|
|
|
routerHistory.push('/timelines/direct'); |
|
|
|
|
} else if (response.data.visibility !== 'direct') { |
|
|
|
|
insertIfOnline('home'); |
|
|
|
|
} else if (response.data.in_reply_to_id === null && response.data.visibility === 'public') { |
|
|
|
|
insertIfOnline('community'); |
|
|
|
|
insertIfOnline('public'); |
|
|
|
|
} else if (response.data.visibility === 'direct') { |
|
|
|
|
insertIfOnline('direct'); |
|
|
|
|
} |
|
|
|
|
}).catch(function (error) { |
|
|
|
|
dispatch(submitComposeFail(error)); |
|
|
|
|