mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
message_edit: Adjust API of edit_locally.
This makes it more extensible for future use of locally echoing edits to fully sent messages.
This commit is contained in:
@@ -134,10 +134,12 @@ exports.try_deliver_locally = function try_deliver_locally(message_request) {
|
||||
return insert_local_message(message_request, next_local_id);
|
||||
};
|
||||
|
||||
exports.edit_locally = function edit_locally(message, raw_content, new_topic) {
|
||||
exports.edit_locally = function edit_locally(message, request) {
|
||||
const raw_content = request.raw_content;
|
||||
const message_content_edited = raw_content !== undefined && message.raw_content !== raw_content;
|
||||
|
||||
if (new_topic !== undefined) {
|
||||
if (request.new_topic !== undefined) {
|
||||
const new_topic = request.new_topic;
|
||||
topic_data.remove_message({
|
||||
stream_id: message.stream_id,
|
||||
topic_name: util.get_message_topic(message),
|
||||
|
||||
@@ -152,7 +152,10 @@ exports.save = function (row, from_topic_edited_only) {
|
||||
// just results in the in-memory message being changed
|
||||
if (message.locally_echoed) {
|
||||
if (new_content !== message.raw_content || topic_changed) {
|
||||
echo.edit_locally(message, new_content, topic_changed ? new_topic : undefined);
|
||||
echo.edit_locally(message, {
|
||||
raw_content: new_content,
|
||||
new_topic: new_topic,
|
||||
});
|
||||
row = current_msg_list.get_row(message_id);
|
||||
}
|
||||
exports.end(row);
|
||||
|
||||
Reference in New Issue
Block a user