Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
liamwhite committed Jul 30, 2024
2 parents a8a36dd + 91e1af6 commit 1b8edd2
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions lib/philomena/galleries.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ defmodule Philomena.Galleries do
alias Philomena.GalleryReorderWorker
alias Philomena.Notifications
alias Philomena.NotificationWorker
alias Philomena.Notifications.{Notification, UnreadNotification}
alias Philomena.Images

use Philomena.Subscriptions,
Expand Down Expand Up @@ -95,21 +94,8 @@ defmodule Philomena.Galleries do
|> select([i], i.image_id)
|> Repo.all()

unread_notifications =
UnreadNotification
|> join(:inner, [un], _ in assoc(un, :notification))
|> where([_, n], n.actor_type == "Gallery")
|> where([_, n], n.actor_id == ^gallery.id)

notifications =
Notification
|> where(actor_type: "Gallery")
|> where(actor_id: ^gallery.id)

Multi.new()
|> Multi.delete(:gallery, gallery)
|> Multi.delete_all(:unread_notifications, unread_notifications)
|> Multi.delete_all(:notifications, notifications)
|> Repo.transaction()
|> case do
{:ok, %{gallery: gallery}} ->
Expand Down

0 comments on commit 1b8edd2

Please sign in to comment.