From 91d5a81b72710d77918630e9aa6788da29ea487f Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Tue, 14 Jul 2020 00:19:02 -0500 Subject: [PATCH] Added composeClear function in redux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added: - composeClear function in redux --- app/javascript/gabsocial/actions/compose.js | 8 ++++++++ app/javascript/gabsocial/reducers/compose.js | 2 ++ 2 files changed, 10 insertions(+) diff --git a/app/javascript/gabsocial/actions/compose.js b/app/javascript/gabsocial/actions/compose.js index 642ebd4b..87b9c54d 100644 --- a/app/javascript/gabsocial/actions/compose.js +++ b/app/javascript/gabsocial/actions/compose.js @@ -68,6 +68,8 @@ export const COMPOSE_SCHEDULED_AT_CHANGE = 'COMPOSE_SCHEDULED_AT_CHANGE'; export const COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY = 'COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY' +export const COMPOSE_CLEAR = 'COMPOSE_CLEAR' + const messages = defineMessages({ uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' }, uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' }, @@ -335,6 +337,12 @@ export function submitComposeSuccess(status) { }; }; +export function clearCompose() { + return { + type: COMPOSE_CLEAR, + }; +}; + export function submitComposeFail(error) { return { type: COMPOSE_SUBMIT_FAIL, diff --git a/app/javascript/gabsocial/reducers/compose.js b/app/javascript/gabsocial/reducers/compose.js index b6911832..8932bee0 100644 --- a/app/javascript/gabsocial/reducers/compose.js +++ b/app/javascript/gabsocial/reducers/compose.js @@ -37,6 +37,7 @@ import { COMPOSE_POLL_SETTINGS_CHANGE, COMPOSE_SCHEDULED_AT_CHANGE, COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY, + COMPOSE_CLEAR, } from '../actions/compose'; import { TIMELINE_DELETE } from '../actions/timelines'; import { STORE_HYDRATE } from '../actions/store'; @@ -314,6 +315,7 @@ export default function compose(state = initialState, action) { return state.set('is_submitting', true); case COMPOSE_UPLOAD_CHANGE_REQUEST: return state.set('is_changing_upload', true); + case COMPOSE_CLEAR: case COMPOSE_SUBMIT_SUCCESS: return clearAll(state); case COMPOSE_SUBMIT_FAIL: