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

This commit is contained in:
KMY 2023-03-21 15:20:00 +09:00
commit 0071b15fa3
18 changed files with 455 additions and 2 deletions

View file

@ -32,6 +32,7 @@ import {
COMPOSE_LANGUAGE_CHANGE,
COMPOSE_COMPOSING_CHANGE,
COMPOSE_EMOJI_INSERT,
COMPOSE_EXPIRATION_INSERT,
COMPOSE_UPLOAD_CHANGE_REQUEST,
COMPOSE_UPLOAD_CHANGE_SUCCESS,
COMPOSE_UPLOAD_CHANGE_FAIL,
@ -217,6 +218,17 @@ const insertEmoji = (state, position, emojiData, needsSpace) => {
});
};
const insertExpiration = (state, position, data) => {
const oldText = state.get('text');
return state.merge({
text: `${oldText.slice(0, position)} ${data} ${oldText.slice(position)}`,
focusDate: new Date(),
caretPosition: position + data.length + 1,
idempotencyKey: uuid(),
});
};
const privacyPreference = (a, b) => {
const order = ['public', 'public_unlisted', 'unlisted', 'private', 'direct'];
return order[Math.max(order.indexOf(a), order.indexOf(b), 0)];
@ -443,6 +455,8 @@ export default function compose(state = initialState, action) {
}
case COMPOSE_EMOJI_INSERT:
return insertEmoji(state, action.position, action.emoji, action.needsSpace);
case COMPOSE_EXPIRATION_INSERT:
return insertExpiration(state, action.position, action.data);
case COMPOSE_UPLOAD_CHANGE_SUCCESS:
return state
.set('is_changing_upload', false)