Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
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
Ilja
pleroma-fe
Commits
72de9592
Commit
72de9592
authored
7 years ago
by
lain
Browse files
Options
Downloads
Patches
Plain Diff
Remove notifications for deleted messages.
parent
449a466e
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
-0
4 additions, 0 deletions
src/modules/statuses.js
test/unit/specs/modules/statuses.spec.js
+28
-0
28 additions, 0 deletions
test/unit/specs/modules/statuses.spec.js
with
32 additions
and
0 deletions
src/modules/statuses.js
+
4
−
0
View file @
72de9592
...
...
@@ -242,6 +242,10 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
const
uri
=
deletion
.
uri
updateMaxId
(
deletion
)
// Remove possible notification
const
status
=
find
(
allStatuses
,
{
uri
})
remove
(
state
.
notifications
,
({
action
:
{
id
}})
=>
status
.
id
)
remove
(
allStatuses
,
{
uri
})
if
(
timeline
)
{
remove
(
timelineObject
.
statuses
,
{
uri
})
...
...
This diff is collapsed.
Click to expand it.
test/unit/specs/modules/statuses.spec.js
+
28
−
0
View file @
72de9592
...
...
@@ -319,6 +319,34 @@ describe('The Statuses module', () => {
expect
(
state
.
notifications
[
0
].
type
).
to
.
eql
(
'
mention
'
)
})
it
(
'
removes a notification when the notice gets removed
'
,
()
=>
{
const
user
=
{
id
:
1
}
const
state
=
cloneDeep
(
defaultState
)
const
status
=
makeMockStatus
({
id
:
1
})
const
mentionedStatus
=
makeMockStatus
({
id
:
2
})
mentionedStatus
.
attentions
=
[
user
]
mentionedStatus
.
uri
=
'
xxx
'
const
deletion
=
makeMockStatus
({
id
:
3
,
is_post_verb
:
false
})
deletion
.
text
=
'
Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.
'
deletion
.
uri
=
'
xxx
'
mutations
.
addNewStatuses
(
state
,
{
statuses
:
[
status
],
user
})
expect
(
state
.
notifications
.
length
).
to
.
eql
(
0
)
mutations
.
addNewStatuses
(
state
,
{
statuses
:
[
mentionedStatus
],
user
})
expect
(
state
.
allStatuses
.
length
).
to
.
eql
(
2
)
expect
(
state
.
notifications
.
length
).
to
.
eql
(
1
)
expect
(
state
.
notifications
[
0
].
status
).
to
.
eql
(
mentionedStatus
)
expect
(
state
.
notifications
[
0
].
action
).
to
.
eql
(
mentionedStatus
)
expect
(
state
.
notifications
[
0
].
type
).
to
.
eql
(
'
mention
'
)
mutations
.
addNewStatuses
(
state
,
{
statuses
:
[
deletion
],
user
})
expect
(
state
.
allStatuses
.
length
).
to
.
eql
(
1
)
expect
(
state
.
notifications
.
length
).
to
.
eql
(
0
)
})
it
(
'
adds the message to mentions when you are mentioned
'
,
()
=>
{
const
user
=
{
id
:
1
}
const
state
=
cloneDeep
(
defaultState
)
...
...
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