-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notifications - Add details to new candidate notification (#164)
* Add extra details to new detection notifications * Add listener count to new detection notification, add a table * Add number since last in subject * Add extra notifications in subject * Fix rendering message for confirmed candidate
- Loading branch information
Showing
8 changed files
with
116 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
server/lib/orcasite/notifications/manual_read_notifications_since.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
defmodule Orcasite.Notifications.ManualReadNotificationsSince do | ||
use Ash.Resource.ManualRead | ||
|
||
alias Orcasite.Notifications | ||
alias Orcasite.Notifications.Notification | ||
|
||
require Ash.Query | ||
|
||
def read(query, _ecto_query, _opts, _context) do | ||
# Get notifications of the same type after the passed-in notification_id | ||
notification_id = | ||
query | ||
|> Ash.Query.get_argument(:notification_id) | ||
|
||
notification = | ||
Notification | ||
|> Notifications.get!(notification_id) | ||
|
||
Notification | ||
|> Ash.Query.filter( | ||
event_type == ^notification.event_type and | ||
inserted_at > ^notification.inserted_at | ||
) | ||
|> Notifications.read() | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.