mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:39:53 +01:00
Check for users being logged in if a user requires it in questions
This commit is contained in:
parent
18b3ac641b
commit
32d270113d
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue