mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
compose: Fix unresolve button for empty topics.
When composing to an empty topic, only the compose box topic is changed to remove the tick-prefix from it. Fixes #29182.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
|
||||||
|
import {unresolve_name} from "../shared/src/resolved_topic";
|
||||||
import render_add_poll_modal from "../templates/add_poll_modal.hbs";
|
import render_add_poll_modal from "../templates/add_poll_modal.hbs";
|
||||||
|
|
||||||
import * as compose from "./compose";
|
import * as compose from "./compose";
|
||||||
@@ -168,7 +169,22 @@ export function initialize() {
|
|||||||
const topic_name = $target.attr("data-topic-name");
|
const topic_name = $target.attr("data-topic-name");
|
||||||
|
|
||||||
message_edit.with_first_message_id(stream_id, topic_name, (message_id) => {
|
message_edit.with_first_message_id(stream_id, topic_name, (message_id) => {
|
||||||
message_edit.toggle_resolve_topic(message_id, topic_name, true);
|
if (message_id === undefined) {
|
||||||
|
// There is no message in the topic, so it is sufficient to
|
||||||
|
// just remove the topic resolved prefix (✔) from the topic name.
|
||||||
|
const $input = $("input#stream_message_recipient_topic");
|
||||||
|
const new_topic = unresolve_name(topic_name);
|
||||||
|
$input.val(new_topic);
|
||||||
|
// Trigger an input event, since this is a form of
|
||||||
|
// user-triggered edit to that field.
|
||||||
|
$input.trigger("input");
|
||||||
|
|
||||||
|
// TODO: Probably this should also renarrow to the
|
||||||
|
// new topic, if we were currently viewing the old
|
||||||
|
// topic, just as if a message edit had occurred.
|
||||||
|
} else {
|
||||||
|
message_edit.toggle_resolve_topic(message_id, topic_name, true);
|
||||||
|
}
|
||||||
compose_validate.clear_topic_resolved_warning(true);
|
compose_validate.clear_topic_resolved_warning(true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1375,7 +1375,7 @@ export function with_first_message_id(stream_id, topic_name, success_cb, error_c
|
|||||||
url: "/json/messages",
|
url: "/json/messages",
|
||||||
data,
|
data,
|
||||||
success(data) {
|
success(data) {
|
||||||
const message_id = data.messages[0].id;
|
const message_id = data.messages[0]?.id;
|
||||||
success_cb(message_id);
|
success_cb(message_id);
|
||||||
},
|
},
|
||||||
error: error_cb,
|
error: error_cb,
|
||||||
|
|||||||
Reference in New Issue
Block a user