Fix local echoed message replaced only for one acc

This commit is contained in:
miruka 2020-03-07 12:35:12 -04:00
parent 9fc347ac10
commit 5709b5b756
2 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import platform
import re import re
import traceback import traceback
from contextlib import suppress from contextlib import suppress
from copy import copy
from datetime import datetime from datetime import datetime
from functools import partial from functools import partial
from pathlib import Path from pathlib import Path
@ -520,7 +521,7 @@ class MatrixClient(nio.AsyncClient):
for user_id in self.models["accounts"]: for user_id in self.models["accounts"]:
if user_id in self.models[self.user_id, room_id, "members"]: if user_id in self.models[self.user_id, room_id, "members"]:
key = f"echo-{transaction_id}" key = f"echo-{transaction_id}"
self.models[user_id, room_id, "events"][key] = event self.models[user_id, room_id, "events"][key] = copy(event)
await self.set_room_last_event(room_id, event) await self.set_room_last_event(room_id, event)
@ -1033,6 +1034,7 @@ class MatrixClient(nio.AsyncClient):
fields["inline_content"] = HTML.filter(content, inline=True) fields["inline_content"] = HTML.filter(content, inline=True)
# Create Event ModelItem # Create Event ModelItem
item = Event( item = Event(
id = ev.event_id, id = ev.event_id,
event_id = ev.event_id, event_id = ev.event_id,
@ -1050,6 +1052,7 @@ class MatrixClient(nio.AsyncClient):
) )
# Add the Event to model # Add the Event to model
tx_id = ev.source.get("content", {}).get( tx_id = ev.source.get("content", {}).get(
f"{__app_name__}.transaction_id", f"{__app_name__}.transaction_id",
) )

View File

@ -83,6 +83,7 @@ QtObject {
function onModelItemFieldChanged(syncId, oldIndex, newIndex, field, value){ function onModelItemFieldChanged(syncId, oldIndex, newIndex, field, value){
// print("change", syncId, oldIndex, newIndex, field, value)
const model = ModelStore.get(syncId) const model = ModelStore.get(syncId)
model.setProperty(oldIndex, field, value) model.setProperty(oldIndex, field, value)