Add choose expiration form
This commit is contained in:
parent
16079b4db5
commit
d9123e21ba
7 changed files with 344 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue