Check for users being logged in if a user requires it in questions

This commit is contained in:
Andreas Nedbal 2022-11-13 14:26:49 +01:00
parent 18b3ac641b
commit 32d270113d

View file

@ -14,6 +14,7 @@ module UseCase
option :direct, type: Types::Params::Bool, default: proc { true }
def call
check_user
check_anonymous_rules
check_blocks
@ -59,6 +60,10 @@ module UseCase
raise Errors::AskingSelfBlockedOther if source_user.blocking?(target_user)
end
def check_user
raise Errors::LoginRequired if target_user.privacy_require_user && !source_user_id
end
def increment_asked_count
unless source_user_id && !anonymous && !direct
# Only increment the asked count of the source user if the question