Only "published" notifies collection subscribers
The other notifications are only sent to the watchers of the bubble.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -27,7 +27,7 @@ class Notifier
|
||||
end
|
||||
|
||||
def recipients
|
||||
bubble.watchers_and_subscribers.without(creator)
|
||||
bubble.watchers.without(creator)
|
||||
end
|
||||
|
||||
def resource
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
class Notifier::Published < Notifier
|
||||
private
|
||||
def recipients
|
||||
bubble.watchers_and_subscribers.without(creator)
|
||||
end
|
||||
end
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
Reference in New Issue
Block a user