Commit 7ad7222a authored by Alexis Reigel's avatar Alexis Reigel

simplify if/else with guards

parent 00392d92
......@@ -83,16 +83,16 @@ module Gitlab
end
def verification_status(gpg_key)
if gpg_key && gpg_key.verified_and_belongs_to_email?(@commit.committer_email) && verified_signature.valid?
return GpgSignature.verification_statuses[:unknown_key] unless gpg_key
return GpgSignature.verification_statuses[:unverified_key] unless gpg_key.verified?
return GpgSignature.verification_statuses[:unverified] unless verified_signature.valid?
if gpg_key.verified_and_belongs_to_email?(@commit.committer_email)
GpgSignature.verification_statuses[:verified]
elsif gpg_key && gpg_key.verified? && verified_signature.valid? && gpg_key.user.all_emails.include?(@commit.committer_email)
elsif gpg_key.user.all_emails.include?(@commit.committer_email)
GpgSignature.verification_statuses[:same_user_different_email]
elsif gpg_key && gpg_key.verified? && verified_signature.valid?
GpgSignature.verification_statuses[:other_user]
elsif gpg_key
GpgSignature.verification_statuses[:unverified_key]
else
GpgSignature.verification_statuses[:unknown_key]
GpgSignature.verification_statuses[:other_user]
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment