compose: Update status text in placeholder instantly after it's updated.

When compose box is opened to self and the user
updates the status, it should instantly update the status
text in a placeholder.
This commit is contained in:
Riken Shah 2021-08-02 14:55:27 +00:00 committed by Tim Abbott
parent b679148788
commit e5b216fc64
2 changed files with 9 additions and 0 deletions

View File

@ -87,6 +87,7 @@ const message_store = zrequire("message_store");
const people = zrequire("people");
const starred_messages = zrequire("starred_messages");
const user_status = zrequire("user_status");
const compose_pm_pill = zrequire("compose_pm_pill");
const emoji = zrequire("../shared/js/emoji");
@ -934,6 +935,7 @@ run_test("user_status", ({override}) => {
{
const stub = make_stub();
override(activity, "redraw_user", stub.f);
override(compose_pm_pill, "get_user_ids", () => [event.user_id]);
dispatch(event);
assert.equal(stub.num_calls, 1);
const args = stub.get_args("user_id");

View File

@ -9,7 +9,9 @@ import * as attachments_ui from "./attachments_ui";
import * as blueslip from "./blueslip";
import * as bot_data from "./bot_data";
import * as compose from "./compose";
import * as compose_actions from "./compose_actions";
import * as compose_fade from "./compose_fade";
import * as compose_pm_pill from "./compose_pm_pill";
import * as composebox_typeahead from "./composebox_typeahead";
import * as emoji_picker from "./emoji_picker";
import * as giphy from "./giphy";
@ -710,6 +712,11 @@ export function dispatch_normal_event(event) {
status_text: event.status_text,
});
activity.redraw_user(event.user_id);
// Update the status text in compose box placeholder when opened to self.
if (compose_pm_pill.get_user_ids().includes(event.user_id)) {
compose_actions.update_placeholder_text();
}
}
if (event.emoji_name !== undefined) {