feat(service): Remove thumbnail data on retraction

This commit is contained in:
PapaTutuWawa 2022-11-21 21:05:08 +01:00
parent 259e0dacd0
commit 9203905ed8
4 changed files with 8 additions and 0 deletions

View File

@ -418,6 +418,7 @@ class DatabaseService {
Object? originId = notSpecified,
Object? sid = notSpecified,
bool? isRetracted,
Object? thumbnailData = notSpecified,
}) async {
final md = (await _db.query(
'Messages',
@ -490,6 +491,9 @@ class DatabaseService {
if (isRetracted != null) {
m['isRetracted'] = boolToInt(isRetracted);
}
if (thumbnailData != notSpecified) {
m['thumbnailData'] = thumbnailData as String?;
}
await _db.update(
'Messages',

View File

@ -617,6 +617,7 @@ Future<void> performMessageRetraction(RetractMessageComment command, { dynamic e
mediaHeight: null,
mediaSize: null,
isRetracted: true,
thumbnailData: null,
);
sendEvent(MessageUpdatedEvent(message: retractedMessage));

View File

@ -142,6 +142,7 @@ class MessageService {
bool? isDownloading,
Object? originId = notSpecified,
Object? sid = notSpecified,
Object? thumbnailData = notSpecified,
bool? isRetracted,
}) async {
final newMessage = await GetIt.I.get<DatabaseService>().updateMessage(
@ -168,6 +169,7 @@ class MessageService {
sid: sid,
isRetracted: isRetracted,
isMedia: isMedia,
thumbnailData: thumbnailData,
);
if (_messageCache.containsKey(newMessage.conversationJid)) {

View File

@ -785,6 +785,7 @@ class XmppService {
mediaHeight: null,
mediaSize: null,
isRetracted: true,
thumbnailData: null,
);
sendEvent(MessageUpdatedEvent(message: retractedMessage));