First "asPlain" test
This commit is contained in:
parent
6b7b01af8d
commit
c0d5a84ccd
|
@ -136,4 +136,68 @@ export default class Subscription extends Model {
|
||||||
@field('on_hold') onHold;
|
@field('on_hold') onHold;
|
||||||
|
|
||||||
@json('source', sanitizer) source;
|
@json('source', sanitizer) source;
|
||||||
|
|
||||||
|
// TODO: if this is proven to be the best way to do it, we should use TS to map through the properties
|
||||||
|
asPlain() {
|
||||||
|
return {
|
||||||
|
_id: this._id,
|
||||||
|
f: this.f,
|
||||||
|
t: this.t,
|
||||||
|
ts: this.ts,
|
||||||
|
ls: this.ls,
|
||||||
|
name: this.name,
|
||||||
|
fname: this.fname,
|
||||||
|
rid: this.rid,
|
||||||
|
open: this.open,
|
||||||
|
alert: this.alert,
|
||||||
|
unread: this.unread,
|
||||||
|
userMentions: this.userMentions,
|
||||||
|
groupMentions: this.groupMentions,
|
||||||
|
roomUpdatedAt: this.roomUpdatedAt,
|
||||||
|
ro: this.ro,
|
||||||
|
lastOpen: this.lastOpen,
|
||||||
|
description: this.description,
|
||||||
|
announcement: this.announcement,
|
||||||
|
bannerClosed: this.bannerClosed,
|
||||||
|
topic: this.topic,
|
||||||
|
blocked: this.blocked,
|
||||||
|
blocker: this.blocker,
|
||||||
|
reactWhenReadOnly: this.reactWhenReadOnly,
|
||||||
|
archived: this.archived,
|
||||||
|
joinCodeRequired: this.joinCodeRequired,
|
||||||
|
notifications: this.notifications,
|
||||||
|
broadcast: this.broadcast,
|
||||||
|
prid: this.prid,
|
||||||
|
draftMessage: this.draftMessage,
|
||||||
|
lastThreadSync: this.lastThreadSync,
|
||||||
|
jitsiTimeout: this.jitsiTimeout,
|
||||||
|
autoTranslate: this.autoTranslate,
|
||||||
|
autoTranslateLanguage: this.autoTranslateLanguage,
|
||||||
|
hideUnreadStatus: this.hideUnreadStatus,
|
||||||
|
hideMentionStatus: this.hideMentionStatus,
|
||||||
|
departmentId: this.departmentId,
|
||||||
|
E2EKey: this.E2EKey,
|
||||||
|
encrypted: this.encrypted,
|
||||||
|
e2eKeyId: this.e2eKeyId,
|
||||||
|
avatarETag: this.avatarETag,
|
||||||
|
teamId: this.teamId,
|
||||||
|
teamMain: this.teamMain,
|
||||||
|
onHold: this.onHold,
|
||||||
|
roles: this.roles,
|
||||||
|
tunread: this.tunread,
|
||||||
|
tunreadUser: this.tunreadUser,
|
||||||
|
tunreadGroup: this.tunreadGroup,
|
||||||
|
muted: this.muted,
|
||||||
|
ignored: this.ignored,
|
||||||
|
lastMessage: this.lastMessage,
|
||||||
|
sysMes: this.sysMes,
|
||||||
|
uids: this.uids,
|
||||||
|
usernames: this.usernames,
|
||||||
|
visitor: this.visitor,
|
||||||
|
servedBy: this.servedBy,
|
||||||
|
livechatData: this.livechatData,
|
||||||
|
tags: this.tags,
|
||||||
|
source: this.source
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,41 +522,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
|
||||||
this.querySubscription = observable.subscribe(data => {
|
this.querySubscription = observable.subscribe(data => {
|
||||||
console.log('update query');
|
console.log('update query');
|
||||||
let tempChats = [] as TSubscriptionModel[];
|
let tempChats = [] as TSubscriptionModel[];
|
||||||
let chats = data.map(item => ({
|
let chats = data.map(item => item.asPlain());
|
||||||
rid: item.rid,
|
|
||||||
t: item.t,
|
|
||||||
prid: item.prid,
|
|
||||||
name: item.name,
|
|
||||||
fname: item.fname,
|
|
||||||
usernames: item.usernames,
|
|
||||||
// avatar: item.avatar,
|
|
||||||
// testID: item.testID,
|
|
||||||
status: item.status,
|
|
||||||
// isGroupChat: item.isGroupChat,
|
|
||||||
// isRead: item.isRead,
|
|
||||||
teamMain: item.teamMain,
|
|
||||||
roomUpdatedAt: item.roomUpdatedAt,
|
|
||||||
// date: item.date,
|
|
||||||
// accessibilityLabel: item.accessibilityLabel,
|
|
||||||
lastMessage: item.lastMessage,
|
|
||||||
f: item.f,
|
|
||||||
alert: item.alert,
|
|
||||||
hideUnreadStatus: item.hideUnreadStatus,
|
|
||||||
unread: item.unread,
|
|
||||||
userMentions: item.userMentions,
|
|
||||||
groupMentions: item.groupMentions,
|
|
||||||
tunread: item.tunread,
|
|
||||||
tunreadUser: item.tunreadUser,
|
|
||||||
tunreadGroup: item.tunreadGroup,
|
|
||||||
// size: item.size,
|
|
||||||
// sourceType: item.sourceType,
|
|
||||||
hideMentionStatus: item.hideMentionStatus,
|
|
||||||
onHold: item.onHold,
|
|
||||||
v: item.v,
|
|
||||||
visitor: item.visitor,
|
|
||||||
archived: item.archived,
|
|
||||||
open: item.open
|
|
||||||
}));
|
|
||||||
|
|
||||||
let omnichannelsUpdate: string[] = [];
|
let omnichannelsUpdate: string[] = [];
|
||||||
const isOmnichannelAgent = user?.roles?.includes('livechat-agent');
|
const isOmnichannelAgent = user?.roles?.includes('livechat-agent');
|
||||||
|
|
Loading…
Reference in New Issue