DEV: Remove hash-like access from service contracts

We decided to keep only one way to access values from a contract. This
patch thus removes the hash-like access from contracts.
This commit is contained in:
Loïc Guitaut
2024-10-28 17:21:59 +01:00
committed by Loïc Guitaut
parent 4d0ed2e146
commit 2f334964f2
50 changed files with 293 additions and 257 deletions

View File

@@ -30,11 +30,11 @@ class User::Silence
private
def fetch_user(params:)
User.find_by(id: params[:user_id])
User.find_by(id: params.user_id)
end
def fetch_users(user:, params:)
[user, *User.where(id: params[:other_user_ids].to_a.uniq).to_a]
[user, *User.where(id: params.other_user_ids.to_a.uniq).to_a]
end
def can_silence_all_users(guardian:, users:)
@@ -46,7 +46,7 @@ class User::Silence
end
def fetch_post(params:)
Post.find_by(id: params[:post_id])
Post.find_by(id: params.post_id)
end
def perform_post_action(guardian:, post:, params:)

View File

@@ -30,11 +30,11 @@ class User::Suspend
private
def fetch_user(params:)
User.find_by(id: params[:user_id])
User.find_by(id: params.user_id)
end
def fetch_users(user:, params:)
[user, *User.where(id: params[:other_user_ids].to_a.uniq).to_a]
[user, *User.where(id: params.other_user_ids.to_a.uniq).to_a]
end
def can_suspend_all_users(guardian:, users:)
@@ -46,7 +46,7 @@ class User::Suspend
end
def fetch_post(params:)
Post.find_by(id: params[:post_id])
Post.find_by(id: params.post_id)
end
def perform_post_action(guardian:, post:, params:)