summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 09:09:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 09:09:13 +0000
commit41cb558299b483b44b45351730ee4c0e9fe4ca2c (patch)
tree00688a9e40021c66195ad826ceddd9c19385cdcf /app
parent3d064c737e8448880e6180aeddc59000a01aa6a8 (diff)
downloadgitlab-ce-41cb558299b483b44b45351730ee4c0e9fe4ca2c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/spammable.rb24
-rw-r--r--app/views/shared/issuable/form/_branch_chooser.html.haml2
2 files changed, 17 insertions, 9 deletions
diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb
index 7c12fe29ade..4fbb5dcb649 100644
--- a/app/models/concerns/spammable.rb
+++ b/app/models/concerns/spammable.rb
@@ -37,15 +37,23 @@ module Spammable
end
end
+ def needs_recaptcha!
+ self.errors.add(:base, "Your #{spammable_entity_type} has been recognized as spam. "\
+ "Please, change the content or solve the reCAPTCHA to proceed.")
+ end
+
+ def unrecoverable_spam_error!
+ self.errors.add(:base, "Your #{spammable_entity_type} has been recognized as spam and has been discarded.")
+ end
+
def invalidate_if_spam
- error_msg = if Gitlab::Recaptcha.enabled?
- "Your #{spammable_entity_type} has been recognized as spam. "\
- "Please, change the content or solve the reCAPTCHA to proceed."
- else
- "Your #{spammable_entity_type} has been recognized as spam and has been discarded."
- end
-
- self.errors.add(:base, error_msg) if spam?
+ return unless spam?
+
+ if Gitlab::Recaptcha.enabled?
+ needs_recaptcha!
+ else
+ unrecoverable_spam_error!
+ end
end
def spammable_entity_type
diff --git a/app/views/shared/issuable/form/_branch_chooser.html.haml b/app/views/shared/issuable/form/_branch_chooser.html.haml
index 8d9e5ddf065..d8253924e0a 100644
--- a/app/views/shared/issuable/form/_branch_chooser.html.haml
+++ b/app/views/shared/issuable/form/_branch_chooser.html.haml
@@ -12,7 +12,7 @@
= _('From <code>%{source_title}</code> into').html_safe % { source_title: source_title }
- if issuable.new_record?
- %code= target_title
+ %code#js-target-branch-title= target_title
&nbsp;
= link_to _('Change branches'), mr_change_branches_path(issuable)
- elsif issuable.for_fork?