Remove access checks when watching

https://github.com/basecamp/fizzy/pull/425#discussion_r2056039581
This commit is contained in:
Jorge Manrubia
2025-04-23 15:22:18 +02:00
parent a9df2d48d1
commit ad58de9e76
3 changed files with 1 additions and 11 deletions
+1 -3
View File
@@ -13,9 +13,7 @@ module Card::Watchable
end
def watch_by(user)
if collection.accessible_to?(user)
watches.where(user: user).first_or_create.update!(watching: true)
end
watches.where(user: user).first_or_create.update!(watching: true)
end
def unwatch_by(user)
-4
View File
@@ -32,10 +32,6 @@ module Collection::Accessible
accesses.find_by(user: user)
end
def accessible_to?(user)
access_for(user).present?
end
private
def grant_access_to_everyone
accesses.grant_to(User.all) if all_access_previously_changed?(to: true)
-4
View File
@@ -9,10 +9,6 @@ module User::Accessor
after_create_commit :grant_access_to_collections
end
def can_access_card?(card)
card.collection.accessible_to?(self)
end
private
def grant_access_to_collections
Access.insert_all Collection.all_access.pluck(:id).collect { |collection_id| { collection_id: collection_id, user_id: id } }