List alerts in profile

This commit is contained in:
DebaucheryLibrarian
2021-04-05 00:48:03 +02:00
parent d36e52d5d1
commit 7f25846d55
17 changed files with 439 additions and 14 deletions

View File

@@ -152,6 +152,32 @@ function curateStash(stash) {
return curatedStash;
}
function curateAlert(alert) {
if (!alert) {
return null;
}
const curatedAlert = alert;
if (alert.actors) {
curatedAlert.actors = alert.actors.map(actor => curateActor(actor.actor || actor));
}
if (alert.tags) {
curatedAlert.tags = alert.tags.map(tag => curateTag(tag.tag || tag));
}
if (alert.entity) {
curatedAlert.entity = curateEntity(alert.entity.entity || alert.entity);
}
if (alert.stashes) {
curatedAlert.stashes = alert.stashes.map(stash => curateStash(stash.stash || stash));
}
return curatedAlert;
}
function curateUser(user) {
if (!user) {
return null;
@@ -163,6 +189,10 @@ function curateUser(user) {
curatedUser.stashes = user.stashes.map(stash => curateStash(stash.stash || stash));
}
if (user.alerts) {
curatedUser.alerts = user.alerts.map(alert => curateAlert(alert.alert || alert));
}
return curatedUser;
}

View File

@@ -59,6 +59,13 @@ function initUsersActions(store, _router) {
id
notify
email
stashes: alertsStashes {
stash {
id
name
slug
}
}
tags: alertsTags {
tag {
id
@@ -76,12 +83,16 @@ function initUsersActions(store, _router) {
id
name
slug
type
independent
hasLogo
parent {
id
name
slug
type
independent
hasLogo
}
}
}