mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
fix: jsonrpc: emit events when stockstrings change for the resources
that changes, so desktop refetches the affected data automatically.
This commit is contained in:
@@ -35,6 +35,7 @@ use deltachat::qr_code_generator::{generate_backup_qr, get_securejoin_qr_svg};
|
||||
use deltachat::reaction::{get_msg_reactions, send_reaction};
|
||||
use deltachat::securejoin;
|
||||
use deltachat::stock_str::StockMessage;
|
||||
use deltachat::stock_str::{emit_events_for_updated_stock_strings, StockMessage};
|
||||
use deltachat::storage_usage::{get_blobdir_storage_usage, get_storage_usage};
|
||||
use deltachat::webxdc::StatusUpdateSerial;
|
||||
use deltachat::EventEmitter;
|
||||
@@ -467,6 +468,10 @@ impl CommandApi {
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
// In the existing clients only one account is visible at a time.
|
||||
if let Some(context) = accounts.get_selected_account() {
|
||||
emit_events_for_updated_stock_strings(&context);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -1289,6 +1289,21 @@ impl Context {
|
||||
}
|
||||
}
|
||||
|
||||
/// Emits events to invalidate cached data which contains core translated content
|
||||
///
|
||||
/// Only call this once after updating all your stockstrings,
|
||||
/// NOT after every single call to set_stock_translation, just once in the end.
|
||||
pub fn emit_events_for_updated_stock_strings(ctx: &Context) {
|
||||
// update chatlist, which can contain all kinds of stockstrings in the message summary
|
||||
ctx.emit_event(crate::EventType::ChatlistItemChanged { chat_id: None });
|
||||
// And to update contact name [StockMessage::SelfMsg]
|
||||
ctx.emit_event(crate::EventType::ContactsChanged(Some(ContactId::SELF)));
|
||||
// To update bio/status [StockMessage::DeviceMessagesHint]
|
||||
ctx.emit_event(crate::EventType::ContactsChanged(Some(ContactId::DEVICE)));
|
||||
// reload connectivity view, which contains various stock stings
|
||||
ctx.emit_event(crate::EventType::ConnectivityChanged);
|
||||
}
|
||||
|
||||
impl Accounts {
|
||||
/// Set the stock string for the [StockMessage].
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user