Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
ebbb8471
Unverified
Commit
ebbb8471
authored
2 years ago
by
Tasso Evangelista
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix the upserting of data into cached collections (#27965)
parent
5cc83feb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/meteor/app/ui-cached-collection/client/models/CachedCollection.ts
+6
-6
6 additions, 6 deletions
...pp/ui-cached-collection/client/models/CachedCollection.ts
apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts
+1
-1
1 addition, 1 deletion
apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts
with
7 additions
and
7 deletions
apps/meteor/app/ui-cached-collection/client/models/CachedCollection.ts
+
6
−
6
View file @
ebbb8471
...
@@ -168,8 +168,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
...
@@ -168,8 +168,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
return
;
return
;
}
}
const
{
_id
,
...
data
}
=
newRecord
;
const
{
_id
}
=
newRecord
;
this
.
collection
.
direct
.
upsert
({
_id
}
as
Mongo
.
Selector
<
T
>
,
{
$set
:
data
}
as
Mongo
.
Modifier
<
T
>
);
this
.
collection
.
direct
.
upsert
({
_id
}
as
Mongo
.
Selector
<
T
>
,
newRecord
);
this
.
emit
(
'
changed
'
,
newRecord
as
any
);
// TODO: investigate why this is needed
this
.
emit
(
'
changed
'
,
newRecord
as
any
);
// TODO: investigate why this is needed
if
(
hasUpdatedAt
(
newRecord
)
&&
newRecord
.
_updatedAt
>
this
.
updatedAt
)
{
if
(
hasUpdatedAt
(
newRecord
)
&&
newRecord
.
_updatedAt
>
this
.
updatedAt
)
{
...
@@ -232,8 +232,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
...
@@ -232,8 +232,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
if
(
action
===
'
removed
'
)
{
if
(
action
===
'
removed
'
)
{
this
.
collection
.
remove
(
newRecord
.
_id
);
this
.
collection
.
remove
(
newRecord
.
_id
);
}
else
{
}
else
{
const
{
_id
,
...
data
}
=
newRecord
;
const
{
_id
}
=
newRecord
;
this
.
collection
.
direct
.
upsert
({
_id
}
as
Mongo
.
Selector
<
T
>
,
{
$set
:
data
}
as
Mongo
.
Modifier
<
T
>
);
this
.
collection
.
direct
.
upsert
({
_id
}
as
Mongo
.
Selector
<
T
>
,
newRecord
);
}
}
this
.
save
();
this
.
save
();
});
});
...
@@ -276,8 +276,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
...
@@ -276,8 +276,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
const
actionTime
=
newRecord
.
_updatedAt
;
const
actionTime
=
newRecord
.
_updatedAt
;
changes
.
push
({
changes
.
push
({
action
:
()
=>
{
action
:
()
=>
{
const
{
_id
,
...
data
}
=
newRecord
;
const
{
_id
}
=
newRecord
;
this
.
collection
.
direct
.
upsert
({
_id
}
as
Mongo
.
Selector
<
T
>
,
{
$set
:
data
}
as
Mongo
.
Modifier
<
T
>
);
this
.
collection
.
direct
.
upsert
({
_id
}
as
Mongo
.
Selector
<
T
>
,
newRecord
);
if
(
actionTime
>
this
.
updatedAt
)
{
if
(
actionTime
>
this
.
updatedAt
)
{
this
.
updatedAt
=
actionTime
;
this
.
updatedAt
=
actionTime
;
}
}
...
...
This diff is collapsed.
Click to expand it.
apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts
+
1
−
1
View file @
ebbb8471
...
@@ -59,7 +59,7 @@ export async function upsertMessage(
...
@@ -59,7 +59,7 @@ export async function upsertMessage(
);
);
}
}
return
direct
.
upsert
({
_id
},
{
$set
:
messageToUpsert
}
);
return
direct
.
upsert
({
_id
},
msg
);
}
}
export
function
upsertMessageBulk
(
export
function
upsertMessageBulk
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment