Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nextcloud mail - PostGuard
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
Package Registry
Model registry
Operate
Terraform modules
Analyze
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
Laura Kolijn
Nextcloud mail - PostGuard
Commits
773d1dec
Commit
773d1dec
authored
4 years ago
by
GretaD
Browse files
Options
Downloads
Patches
Plain Diff
Add undo option for trusted senders
Signed-off-by:
GretaD
<
gretadoci@gmail.com
>
parent
20620ea8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/TrustedSenders.vue
+36
-8
36 additions, 8 deletions
src/components/TrustedSenders.vue
with
36 additions
and
8 deletions
src/components/TrustedSenders.vue
+
36
−
8
View file @
773d1dec
...
...
@@ -21,21 +21,28 @@
<
template
>
<div>
<div
v-for=
"
recipient in list
"
:key=
"
recipient
.email"
>
{{
recipient
.
email
}}
<div
v-for=
"
sender in sortedSenders
"
:key=
"
sender
.email"
>
{{
sender
.
email
}}
<button
class=
"button"
@
click=
"
hid
eSender"
>
@
click=
"
remov
eSender
(sender)
"
>
{{
t
(
'
mail
'
,
'
Remove
'
)
}}
</button>
</div>
<span
v-if=
"!sortedSenders.length"
>
{{
t
(
'
mail
'
,
'
No senders are trusted at the moment.
'
)
}}
</span>
</div>
</
template
>
<
script
>
import
{
fetchTrustedSenders
}
from
'
../service/TrustedSenderService
'
import
{
fetchTrustedSenders
,
trustSender
}
from
'
../service/TrustedSenderService
'
import
prop
from
'
lodash/fp/prop
'
import
sortBy
from
'
lodash/fp/sortBy
'
import
logger
from
'
../logger
'
import
{
showError
}
from
'
@nextcloud/dialogs
'
const
sortByEmail
=
sortBy
(
prop
(
'
email
'
))
export
default
{
name
:
'
TrustedSenders
'
,
...
...
@@ -45,12 +52,33 @@ export default {
list
:
[],
}
},
computed
:
{
sortedSenders
()
{
return
sortByEmail
(
this
.
list
)
},
},
async
mounted
()
{
this
.
list
=
await
fetchTrustedSenders
()
this
.
list
=
await
fetchTrustedSenders
()
},
methods
:
{
hideSender
()
{
async
removeSender
(
sender
)
{
// Remove the item immediately
this
.
list
=
this
.
list
.
filter
(
s
=>
s
.
id
!==
sender
.
id
)
try
{
await
trustSender
(
sender
.
email
,
false
)
}
catch
(
error
)
{
logger
.
error
(
`Could not remove trusted sender
${
sender
.
email
}
`
,
{
error
,
})
showError
(
t
(
'
mail
'
,
'
Could not remove trusted sender {sender}
'
,
{
sender
:
sender
.
email
,
}))
// Put the sender back
this
.
list
.
push
(
sender
)
}
},
},
}
...
...
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