Skip to content

Commit

Permalink
Fix (visually) removing first notification when executing an action
Browse files Browse the repository at this point in the history
When an action is executed first its element is faded out and then the
notification data is removed, which removes the component as a whole.
However, the index of the notification was not provided, so the event
that handles the "remove" event always removed the data of the first
notification. Due to this when the action was triggered in another
notification the first notification was also (visually) removed (and
only until the notifications were fetched again from the server).

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Sep 19, 2023
1 parent 0179f6c commit 61e1d9f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions js/notifications-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/notifications-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/Components/Action.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default {
default: false,
required: true,
},
notificationIndex: {
type: Number,
required: true,
},
},
data() {
Expand Down Expand Up @@ -118,7 +122,7 @@ export default {
// emit event to current app
this.$parent._$el.fadeOut(OC.menuSpeed)
this.$parent.$emit('remove')
this.$parent.$emit('remove', this.notificationIndex)
emit('notifications:action:executed', event)
Expand Down
5 changes: 4 additions & 1 deletion src/Components/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
</div>

<div v-if="actions.length" class="notification-actions">
<Action v-for="(a, i) in actions" :key="i" v-bind="a" />
<Action v-for="(a, i) in actions"
:key="i"
v-bind="a"
:notification-index="index" />
</div>
<div v-else-if="externalLink" class="notification-actions">
<NcButton type="primary"
Expand Down

0 comments on commit 61e1d9f

Please sign in to comment.