File tree Expand file tree Collapse file tree 3 files changed +27
-9
lines changed
backup/CrossPlatformBackup Expand file tree Collapse file tree 3 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,10 @@ export const exportCPBHistoryFromDatabase = async ({
156
156
}
157
157
158
158
const conversationId = new BackupQualifiedId ( qualified_conversation . id , qualified_conversation . domain ?? '' ) ;
159
- const senderUserId = new BackupQualifiedId ( qualified_from ?. id ?? from ?? '' , qualified_from ?. domain ?? '' ) ;
159
+ const senderUserId = new BackupQualifiedId (
160
+ qualified_from ?. id ?? from ?? user . id ,
161
+ qualified_from ?. domain ?? user . domain ,
162
+ ) ;
160
163
const senderClientId = from_client_id ?? '' ;
161
164
const creationDate = new BackupDateTime ( new Date ( time ) ) ;
162
165
// for debugging purposes
@@ -178,7 +181,7 @@ export const exportCPBHistoryFromDatabase = async ({
178
181
const asset = new BackupMessageContent . Asset (
179
182
assetParseData . content_type ,
180
183
Number . parseInt ( `${ assetParseData . content_length } ` ) ,
181
- assetParseData . info . name ,
184
+ assetParseData . info ? .name ?? '' ,
182
185
transformObjectToArray ( assetParseData . otr_key ) ,
183
186
transformObjectToArray ( assetParseData . sha256 ) ,
184
187
assetParseData . key ,
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export type ConversationTableEntry = zod.infer<typeof ConversationTableEntrySche
32
32
export const UserTableEntrySchema = zod . object ( {
33
33
handle : zod . string ( ) . optional ( ) ,
34
34
id : zod . string ( ) ,
35
- name : zod . string ( ) . optional ( ) ,
35
+ name : zod . string ( ) . optional ( ) . nullable ( ) ,
36
36
qualified_id : QualifiedIdSchema . optional ( ) ,
37
37
} ) ;
38
38
export type UserTableEntry = zod . infer < typeof UserTableEntrySchema > ;
@@ -41,7 +41,7 @@ export const EventTableEntrySchema = zod.object({
41
41
category : zod . number ( ) . int ( ) . optional ( ) ,
42
42
conversation : zod . string ( ) . min ( 1 , 'Conversation is required' ) ,
43
43
data : zod . any ( ) ,
44
- from : zod . string ( ) . optional ( ) ,
44
+ from : zod . string ( ) . optional ( ) . nullable ( ) ,
45
45
from_client_id : zod . string ( ) . optional ( ) ,
46
46
id : zod . string ( ) . optional ( ) ,
47
47
primary_key : zod . number ( ) . int ( ) . positive ( 'Primary key must be a positive integer' ) ,
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import {
30
30
ADD_PERMISSION ,
31
31
CONVERSATION_CELLS_STATE ,
32
32
} from '@wireapp/api-client/lib/conversation' ;
33
+ import { QualifiedId } from '@wireapp/api-client/lib/user' ;
33
34
import ko from 'knockout' ;
34
35
import { isObject } from 'underscore' ;
35
36
@@ -292,11 +293,25 @@ export class ConversationMapper {
292
293
}
293
294
294
295
// Active participants from database or backend payload
295
- const participatingUserIds =
296
- qualified_others ||
297
- ( members ?. others
298
- ? members . others . map ( other => ( { domain : other . qualified_id ?. domain || '' , id : other . id } ) )
299
- : others . map ( userId => ( { domain : '' , id : userId } ) ) ) ;
296
+ let participatingUserIds : QualifiedId [ ] = [ ] ;
297
+
298
+ if ( qualified_others ) {
299
+ participatingUserIds = qualified_others ;
300
+ }
301
+
302
+ if ( ! qualified_others && members ?. others ?. length ) {
303
+ participatingUserIds = members . others . map ( other => ( {
304
+ domain : other . qualified_id ?. domain ?? '' ,
305
+ id : other . id ,
306
+ } ) ) ;
307
+ }
308
+
309
+ if ( ! qualified_others && ! members ?. others ?. length && others ) {
310
+ participatingUserIds = others . map ( userId => ( {
311
+ domain : '' ,
312
+ id : userId ,
313
+ } ) ) ;
314
+ }
300
315
301
316
conversationEntity . participating_user_ids ( participatingUserIds ) ;
302
317
You can’t perform that action at this time.
0 commit comments