Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Pleroma
pleroma-fe
Commits
5e8db7ed
Commit
5e8db7ed
authored
4 years ago
by
Shpuld Shpludson
Browse files
Options
Downloads
Patches
Plain Diff
move from using timestamps to ids when tracking last seen in chats
parent
5254fdba
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1278
Merge develop into master for 2.2.0
,
!1270
Fix: Use ids for chat last seen instead of timestamp
Pipeline
#32468
failed
4 years ago
Stage: lint
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/services/chat_service/chat_service.js
+4
-4
4 additions, 4 deletions
src/services/chat_service/chat_service.js
with
4 additions
and
4 deletions
src/services/chat_service/chat_service.js
+
4
−
4
View file @
5e8db7ed
...
...
@@ -6,7 +6,7 @@ const empty = (chatId) => {
idempotencyKeyIndex
:
{},
messages
:
[],
newMessageCount
:
0
,
lastSeen
Timestamp
:
0
,
lastSeen
MessageId
:
'
0
'
,
chatId
:
chatId
,
minId
:
undefined
,
maxId
:
undefined
...
...
@@ -27,7 +27,7 @@ const clear = (storage) => {
storage
.
messages
=
storage
.
messages
.
filter
(
m
=>
failedMessageIds
.
includes
(
m
.
id
))
storage
.
newMessageCount
=
0
storage
.
lastSeen
Timestamp
=
0
storage
.
lastSeen
MessageId
=
'
0
'
storage
.
minId
=
undefined
storage
.
maxId
=
undefined
}
...
...
@@ -104,7 +104,7 @@ const add = (storage, { messages: newMessages, updateMaxId = true }) => {
}
if
(
!
storage
.
idIndex
[
message
.
id
]
&&
!
isConfirmation
(
storage
,
message
))
{
if
(
storage
.
lastSeen
Timestamp
<
message
.
created_at
)
{
if
(
storage
.
lastSeen
MessageId
<
message
.
id
)
{
storage
.
newMessageCount
++
}
storage
.
idIndex
[
message
.
id
]
=
message
...
...
@@ -122,7 +122,7 @@ const isConfirmation = (storage, message) => {
const
resetNewMessageCount
=
(
storage
)
=>
{
if
(
!
storage
)
{
return
}
storage
.
newMessageCount
=
0
storage
.
lastSeen
Timestamp
=
new
Date
()
storage
.
lastSeen
MessageId
=
storage
.
maxId
}
// Inserts date separators and marks the head and tail if it's the chain of messages made by the same user
...
...
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