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
Wiki
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
Matrix-Sasuke
pleroma-fe
Commits
e892fffd
Commit
e892fffd
authored
8 years ago
by
lain
Browse files
Options
Downloads
Patches
Plain Diff
Correctly calculate the newStatusesCount.
Fixes a bug when viewing an updating twkn while logged in.
parent
06021f49
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
src/modules/statuses.js
+4
-2
4 additions, 2 deletions
src/modules/statuses.js
test/unit/specs/modules/statuses.spec.js
+18
-0
18 additions, 0 deletions
test/unit/specs/modules/statuses.spec.js
with
22 additions
and
2 deletions
src/modules/statuses.js
+
4
−
2
View file @
e892fffd
...
...
@@ -153,16 +153,18 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
}
}
// Decide if we should treat the status as new for this timeline.
let
resultForCurrentTimeline
// Some statuses should only be added to the global status repository.
if
(
timeline
&&
addToTimeline
)
{
mergeOrAdd
(
timelineObject
.
statuses
,
status
)
resultForCurrentTimeline
=
mergeOrAdd
(
timelineObject
.
statuses
,
status
)
}
if
(
timeline
&&
showImmediately
)
{
// Add it directly to the visibleStatuses, don't change
// newStatusCount
mergeOrAdd
(
timelineObject
.
visibleStatuses
,
status
)
}
else
if
(
timeline
&&
addToTimeline
&&
result
.
new
)
{
}
else
if
(
timeline
&&
addToTimeline
&&
result
ForCurrentTimeline
.
new
)
{
// Just change newStatuscount
timelineObject
.
newStatusCount
+=
1
}
...
...
This diff is collapsed.
Click to expand it.
test/unit/specs/modules/statuses.spec.js
+
18
−
0
View file @
e892fffd
...
...
@@ -79,6 +79,24 @@ describe('The Statuses module', () => {
expect
(
state
.
timelines
.
public
.
newStatusCount
).
to
.
equal
(
1
)
})
it
(
'
counts the status as new if it has not been seen on this timeline
'
,
()
=>
{
const
state
=
cloneDeep
(
defaultState
)
const
status
=
makeMockStatus
({
id
:
1
})
mutations
.
addNewStatuses
(
state
,
{
statuses
:
[
status
],
timeline
:
'
public
'
})
mutations
.
addNewStatuses
(
state
,
{
statuses
:
[
status
],
timeline
:
'
friends
'
})
expect
(
state
.
allStatuses
).
to
.
eql
([
status
])
expect
(
state
.
timelines
.
public
.
statuses
).
to
.
eql
([
status
])
expect
(
state
.
timelines
.
public
.
visibleStatuses
).
to
.
eql
([])
expect
(
state
.
timelines
.
public
.
newStatusCount
).
to
.
equal
(
1
)
expect
(
state
.
allStatuses
).
to
.
eql
([
status
])
expect
(
state
.
timelines
.
friends
.
statuses
).
to
.
eql
([
status
])
expect
(
state
.
timelines
.
friends
.
visibleStatuses
).
to
.
eql
([])
expect
(
state
.
timelines
.
friends
.
newStatusCount
).
to
.
equal
(
1
)
})
it
(
'
add the statuses to allStatuses if no timeline is given
'
,
()
=>
{
const
state
=
cloneDeep
(
defaultState
)
const
status
=
makeMockStatus
({
id
:
1
})
...
...
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