gearheads
/
mastodon
Archived
2
0
Fork 0

Fix issues with sending direct messages from user profile (#6999)

* Clear compose textarea when starting a new direct message

Previous behaviour resulted in potentially misdirected direct messages.

* Hide search when starting to compose a direct message
gh/stable
Emelia Smith 2018-04-02 13:44:19 +02:00 committed by Eugen Rochko
parent 3f51c6efaa
commit 4fd71accd4
2 changed files with 7 additions and 2 deletions

View File

@ -265,7 +265,7 @@ export default function compose(state = initialState, action) {
.set('idempotencyKey', uuid()); .set('idempotencyKey', uuid());
case COMPOSE_DIRECT: case COMPOSE_DIRECT:
return state return state
.update('text', text => `${text}@${action.account.get('acct')} `) .update('text', text => `@${action.account.get('acct')} `)
.set('privacy', 'direct') .set('privacy', 'direct')
.set('focusDate', new Date()) .set('focusDate', new Date())
.set('idempotencyKey', uuid()); .set('idempotencyKey', uuid());

View File

@ -4,7 +4,11 @@ import {
SEARCH_FETCH_SUCCESS, SEARCH_FETCH_SUCCESS,
SEARCH_SHOW, SEARCH_SHOW,
} from '../actions/search'; } from '../actions/search';
import { COMPOSE_MENTION, COMPOSE_REPLY } from '../actions/compose'; import {
COMPOSE_MENTION,
COMPOSE_REPLY,
COMPOSE_DIRECT,
} from '../actions/compose';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
const initialState = ImmutableMap({ const initialState = ImmutableMap({
@ -29,6 +33,7 @@ export default function search(state = initialState, action) {
return state.set('hidden', false); return state.set('hidden', false);
case COMPOSE_REPLY: case COMPOSE_REPLY:
case COMPOSE_MENTION: case COMPOSE_MENTION:
case COMPOSE_DIRECT:
return state.set('hidden', true); return state.set('hidden', true);
case SEARCH_FETCH_SUCCESS: case SEARCH_FETCH_SUCCESS:
return state.set('results', ImmutableMap({ return state.set('results', ImmutableMap({