fix edited/deleted being reset on channel change
This commit is contained in:
@@ -129,12 +129,14 @@ void ChatWindow::ProcessMessage(const Message *data, bool prepend) {
|
||||
text->signal_action_message_edit().connect([this](Snowflake channel_id, Snowflake id) {
|
||||
m_signal_action_message_edit.emit(channel_id, id);
|
||||
});
|
||||
text->Update();
|
||||
container->AddNewContent(text, prepend);
|
||||
m_id_to_widget[data->ID] = text;
|
||||
} else if (type == ChatDisplayType::Embed) {
|
||||
auto *widget = Gtk::manage(new ChatMessageEmbedItem(data));
|
||||
widget->ID = data->ID;
|
||||
widget->ChannelID = m_active_channel;
|
||||
widget->Update();
|
||||
container->AddNewContent(widget, prepend);
|
||||
m_id_to_widget[data->ID] = widget;
|
||||
}
|
||||
@@ -266,7 +268,7 @@ void ChatWindow::DeleteMessageInternal() {
|
||||
// todo actually delete it when it becomes setting
|
||||
|
||||
auto *item = m_id_to_widget.at(id);
|
||||
item->MarkAsDeleted();
|
||||
item->Update();
|
||||
}
|
||||
|
||||
void ChatWindow::UpdateMessageContentInternal() {
|
||||
@@ -284,7 +286,7 @@ void ChatWindow::UpdateMessageContentInternal() {
|
||||
auto *item = dynamic_cast<ChatMessageTextItem *>(m_id_to_widget.at(id));
|
||||
if (item != nullptr) {
|
||||
item->EditContent(msg->Content);
|
||||
item->MarkAsEdited();
|
||||
item->Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user