Merge remote-tracking branch 'origin/kb_development' into kb_migration

This commit is contained in:
KMY 2023-04-06 16:57:01 +09:00
commit 94cd200097
50 changed files with 801 additions and 66 deletions

View file

@ -47,6 +47,7 @@ import {
COMPOSE_CHANGE_MEDIA_DESCRIPTION,
COMPOSE_CHANGE_MEDIA_FOCUS,
COMPOSE_SET_STATUS,
COMPOSE_SEARCHABILITY_CHANGE,
} from '../actions/compose';
import { TIMELINE_DELETE } from '../actions/timelines';
import { STORE_HYDRATE } from '../actions/store';
@ -62,6 +63,7 @@ const initialState = ImmutableMap({
spoiler: false,
spoiler_text: '',
privacy: null,
searchability: null,
id: null,
text: '',
focusDate: null,
@ -81,6 +83,7 @@ const initialState = ImmutableMap({
suggestion_token: null,
suggestions: ImmutableList(),
default_privacy: 'public',
default_searchability: 'public',
default_sensitive: false,
default_language: 'en',
resetFileKey: Math.floor((Math.random() * 0x10000)),
@ -121,6 +124,7 @@ function clearAll(state) {
map.set('is_changing_upload', false);
map.set('in_reply_to', null);
map.set('privacy', state.get('default_privacy'));
map.set('searchability', state.get('default_searchability'));
map.set('sensitive', state.get('default_sensitive'));
map.set('language', state.get('default_language'));
map.update('media_attachments', list => list.clear());
@ -328,6 +332,10 @@ export default function compose(state = initialState, action) {
return state
.set('privacy', action.value)
.set('idempotencyKey', uuid());
case COMPOSE_SEARCHABILITY_CHANGE:
return state
.set('searchability', action.value)
.set('idempotencyKey', uuid());
case COMPOSE_CHANGE:
return state
.set('text', action.text)
@ -340,6 +348,7 @@ export default function compose(state = initialState, action) {
map.set('in_reply_to', action.status.get('id'));
map.set('text', statusToTextMentions(state, action.status));
map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
map.set('searchability', privacyPreference(action.status.get('searchability'), state.get('default_searchability')));
map.set('focusDate', new Date());
map.set('caretPosition', null);
map.set('preselectDate', new Date());