Set glitchy elephant friend variant in initial state. #294.
Also lay some groundwork needed to interactively change the glitchfriend. The codebase uses "elefriend" because it's shorter and didn't require me to realign the actions in actions/compose.js. Same idea, though.
This commit is contained in:
parent
1e0b707018
commit
1dbb6b5e08
8 changed files with 22 additions and 7 deletions
|
@ -2,6 +2,7 @@ import {
|
|||
COMPOSE_MOUNT,
|
||||
COMPOSE_UNMOUNT,
|
||||
COMPOSE_CHANGE,
|
||||
COMPOSE_CYCLE_ELEFRIEND,
|
||||
COMPOSE_REPLY,
|
||||
COMPOSE_REPLY_CANCEL,
|
||||
COMPOSE_MENTION,
|
||||
|
@ -35,6 +36,8 @@ import uuid from 'flavours/glitch/util/uuid';
|
|||
import { me } from 'flavours/glitch/util/initial_state';
|
||||
import { overwrite } from 'flavours/glitch/util/js_helpers';
|
||||
|
||||
const totalElefriends = 3;
|
||||
|
||||
const initialState = ImmutableMap({
|
||||
mounted: false,
|
||||
advanced_options: ImmutableMap({
|
||||
|
@ -42,6 +45,7 @@ const initialState = ImmutableMap({
|
|||
threaded_mode: false,
|
||||
}),
|
||||
sensitive: false,
|
||||
elefriend: Math.floor(Math.random() * totalElefriends),
|
||||
spoiler: false,
|
||||
spoiler_text: '',
|
||||
privacy: null,
|
||||
|
@ -259,6 +263,9 @@ export default function compose(state = initialState, action) {
|
|||
return state
|
||||
.set('text', action.text)
|
||||
.set('idempotencyKey', uuid());
|
||||
case COMPOSE_CYCLE_ELEFRIEND:
|
||||
return state
|
||||
.set('elefriend', (state.get('elefriend') + 1) % totalElefriends);
|
||||
case COMPOSE_REPLY:
|
||||
return state.withMutations(map => {
|
||||
map.set('in_reply_to', action.status.get('id'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue