mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-20 20:27:07 +00:00
parent
fce885f271
commit
0baaee495f
|
@ -8,6 +8,9 @@ import {
|
||||||
REPORT_COMMENT_CHANGE,
|
REPORT_COMMENT_CHANGE,
|
||||||
REPORT_FORWARD_CHANGE,
|
REPORT_FORWARD_CHANGE,
|
||||||
} from 'flavours/glitch/actions/reports';
|
} from 'flavours/glitch/actions/reports';
|
||||||
|
import {
|
||||||
|
TIMELINE_DELETE,
|
||||||
|
} from 'flavours/glitch/actions/timelines';
|
||||||
import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable';
|
import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable';
|
||||||
|
|
||||||
const initialState = ImmutableMap({
|
const initialState = ImmutableMap({
|
||||||
|
@ -20,6 +23,14 @@ const initialState = ImmutableMap({
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const deleteStatus = (state, id, references) => {
|
||||||
|
references.forEach(ref => {
|
||||||
|
state = deleteStatus(state, ref[0], []);
|
||||||
|
});
|
||||||
|
|
||||||
|
return state.updateIn(['new', 'status_ids'], ImmutableSet(), set => set.remove(id));
|
||||||
|
};
|
||||||
|
|
||||||
export default function reports(state = initialState, action) {
|
export default function reports(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case REPORT_INIT:
|
case REPORT_INIT:
|
||||||
|
@ -58,6 +69,8 @@ export default function reports(state = initialState, action) {
|
||||||
map.setIn(['new', 'comment'], '');
|
map.setIn(['new', 'comment'], '');
|
||||||
map.setIn(['new', 'isSubmitting'], false);
|
map.setIn(['new', 'isSubmitting'], false);
|
||||||
});
|
});
|
||||||
|
case TIMELINE_DELETE:
|
||||||
|
return deleteStatus(state, action.id, action.references);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue