Add titles and categories to notifications

Also, add more event data to prompts.
This commit is contained in:
Daniel
2020-10-29 22:54:46 +01:00
parent 17a0c8f721
commit ed00e1fe83
5 changed files with 86 additions and 40 deletions

View File

@@ -93,16 +93,28 @@ func createPrompt(ctx context.Context, conn *network.Connection, pkt packet.Pack
return
}
// Reference relevant data for save function
localProfile := conn.Process().Profile().LocalProfile()
entity := conn.Entity
// Create new notification.
n = &notifications.Notification{
EventID: nID,
Type: notifications.Prompt,
EventData: conn.Entity,
Expires: expires,
EventID: nID,
Type: notifications.Prompt,
Title: "Connection Prompt",
Category: "Privacy Filter",
EventData: &promptData{
Entity: entity,
Profile: promptProfile{
Source: string(localProfile.Source),
ID: localProfile.ID,
LinkedPath: localProfile.LinkedPath,
},
},
Expires: expires,
}
// Set action function.
localProfile := conn.Process().Profile().LocalProfile()
entity := conn.Entity
n.SetActionFunction(func(_ context.Context, n *notifications.Notification) error {
return saveResponse(
localProfile,