Include self in watcher list

This commit is contained in:
Kevin McConnell
2025-02-27 10:51:59 +00:00
parent 8bd207096b
commit ab27371115
2 changed files with 3 additions and 2 deletions
@@ -2,7 +2,7 @@ class Bubbles::WatchesController < ApplicationController
include BubbleScoped, BucketScoped
def show
@watchers = @bubble.watchers_and_subscribers.without(Current.user)
@watchers = @bubble.watchers_and_subscribers.sorted_with_user_first(Current.user)
end
def create
+2 -1
View File
@@ -27,7 +27,8 @@ class User < ApplicationRecord
after_create_commit :grant_access_to_buckets
scope :alphabetically, -> { order("LOWER(name)") }
scope :alphabetically, -> { order("lower(name)") }
scope :sorted_with_user_first, ->(user) { order(Arel.sql("id != ?, lower(name)", user.id)) }
def initials
name.to_s.scan(/\b\p{L}/).join.upcase