Only "published" notifies collection subscribers

The other notifications are only sent to the watchers of the bubble.
This commit is contained in:
Kevin McConnell
2025-03-18 17:32:06 +00:00
parent a0d365289f
commit bc5e32e737
5 changed files with 8 additions and 3 deletions
+1
View File
@@ -3,6 +3,7 @@ module Bubble::Watchable
included do
has_many :watches, dependent: :destroy
has_many :watchers, ->{ merge(Watch.watching) }, through: :watches, source: :user
after_create :set_watching_for_creator
end
+1 -1
View File
@@ -27,7 +27,7 @@ class Notifier
end
def recipients
bubble.watchers_and_subscribers.without(creator)
bubble.watchers.without(creator)
end
def resource
+4
View File
@@ -1,2 +1,6 @@
class Notifier::Published < Notifier
private
def recipients
bubble.watchers_and_subscribers.without(creator)
end
end
+1 -1
View File
@@ -31,7 +31,7 @@ class User < ApplicationRecord
after_create_commit :grant_access_to_buckets
scope :alphabetically, -> { order("lower(name)") }
scope :sorted_with_user_first, ->(user) { order(Arel.sql("id != ?, lower(name)", user.id)) }
scope :sorted_with_user_first, ->(user) { order(Arel.sql("users.id != ?, lower(name)", user.id)) }
def initials
name.to_s.scan(/\b\p{L}/).join.upcase
+1 -1
View File
@@ -7,7 +7,7 @@
<div class="flex flex-column gap-half justify-start full-width txt-align-start">
<span>Watching this…</span>
<div class="flex align-center flex-wrap gap-half max-width">
<%= render partial: "bubbles/watches/watcher", collection: bubble.watchers_and_subscribers.sorted_with_user_first(Current.user) %>
<%= render partial: "bubbles/watches/watcher", collection: bubble.watchers.sorted_with_user_first(Current.user) %>
</div>
</div>
<% end %>