Skip to content

Commit

Permalink
refs #7 show notifications about new releases in widget
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
  • Loading branch information
Julien Veyssier committed Oct 16, 2020
1 parent e933b2a commit d4bf577
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 3 deletions.
57 changes: 57 additions & 0 deletions img/release.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ export default {
filter(notifications) {
// only keep the unread ones with specific reasons
return notifications.filter((n) => {
return (n.unread && ['assign', 'mention', 'review_requested'].includes(n.reason))
return (
n.unread
&& (
['assign', 'mention', 'review_requested'].includes(n.reason)
|| (n.reason === 'subscribed' && n.subject?.type === 'Release')
)
)
})
},
onUnsubscribe(item) {
Expand Down Expand Up @@ -196,12 +202,12 @@ export default {
})
},
getRepositoryAvatarUrl(n) {
return (n.repository && n.repository.owner && n.repository.owner.login)
return n.repository?.owner?.login
? generateUrl('/apps/integration_github/avatar?') + encodeURIComponent('githubUserName') + '=' + encodeURIComponent(n.repository.owner.login)
: ''
},
getRepositoryOwnerName(n) {
return (n.repository && n.repository.owner && n.repository.owner.login)
return n.repository?.owner?.login
? n.repository.owner.login
: ''
},
Expand All @@ -227,6 +233,8 @@ export default {
return generateUrl('/svg/integration_github/pull_request?color=ffffff')
} else if (n.subject.type === 'Issue') {
return generateUrl('/svg/integration_github/issue?color=ffffff')
} else if (n.subject.type === 'Release') {
return generateUrl('/svg/integration_github/release?color=ffffff')
}
return ''
},
Expand Down

0 comments on commit d4bf577

Please sign in to comment.