Skip to content

Commit

Permalink
Fix editing in threaded mode adding additional local-only emoji
Browse files Browse the repository at this point in the history
The case blocks are not scoped, so redeclaring variables doesn't work, so declare them outside and setting them as needed in case blocks.

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
  • Loading branch information
Plastikmensch committed Oct 1, 2023
1 parent ebd2017 commit f219682
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/javascript/flavours/glitch/reducers/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ const updateSuggestionTags = (state, token) => {
};

export default function compose(state = initialState, action) {
let do_not_federate, text;
switch(action.type) {
case STORE_HYDRATE:
return hydrate(state, action.state.get('compose'));
Expand Down Expand Up @@ -568,8 +569,8 @@ export default function compose(state = initialState, action) {
case COMPOSE_DOODLE_SET:
return state.mergeIn(['doodle'], action.options);
case REDRAFT:
const do_not_federate = !!action.status.get('local_only');
let text = action.raw_text || unescapeHTML(expandMentions(action.status));
do_not_federate = !!action.status.get('local_only');
text = action.raw_text || unescapeHTML(expandMentions(action.status));
if (do_not_federate) text = text.replace(/ ?👁\ufe0f?\u200b?$/, '');
return state.withMutations(map => {
map.set('text', text);
Expand Down Expand Up @@ -609,9 +610,12 @@ export default function compose(state = initialState, action) {
}
});
case COMPOSE_SET_STATUS:
do_not_federate = !!action.status.get('local_only');
text = action.raw_text || unescapeHTML(expandMentions(action.status));
if (do_not_federate && state.getIn(['advanced_options', 'threaded_mode'])) text = text.replace(/ ?👁\ufe0f?\u200b?$/, '');
return state.withMutations(map => {
map.set('id', action.status.get('id'));
map.set('text', action.text);
map.set('text', text);
map.set('content_type', action.content_type || 'text/plain');
map.set('in_reply_to', action.status.get('in_reply_to_id'));
map.set('privacy', action.status.get('visibility'));
Expand Down

0 comments on commit f219682

Please sign in to comment.