diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-22 11:53:24 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-22 11:53:24 +0000 |
commit | 85ffd85a2bde09691784adb32395ad2c5a3ff909 (patch) | |
tree | a781997b91e5aa1dd770b63712ed21ed8ddfa042 /app/models | |
parent | 78840333d7e1432fc6235b59e90040d0f9e43b41 (diff) | |
parent | d730b69eb26ab5917b773a242c21f5967661d964 (diff) | |
download | gitlab-ce-85ffd85a2bde09691784adb32395ad2c5a3ff909.tar.gz |
Merge branch '29483-spam-check-only-title-and-description' into 'master'
Spam check only when Snippet / Issue "title" or "description" are changed
Closes #29483 and #29645
See merge request !10104
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/spammable.rb | 2 | ||||
-rw-r--r-- | app/models/issue.rb | 3 | ||||
-rw-r--r-- | app/models/snippet.rb | 3 |
3 files changed, 4 insertions, 4 deletions
diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb index 107e6764ba2..647a6cad3d7 100644 --- a/app/models/concerns/spammable.rb +++ b/app/models/concerns/spammable.rb @@ -41,7 +41,7 @@ module Spammable def check_for_spam error_msg = if Gitlab::Recaptcha.enabled? "Your #{spammable_entity_type} has been recognized as spam. "\ - "You can still submit it by solving Captcha." + "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 diff --git a/app/models/issue.rb b/app/models/issue.rb index 602eed86d9e..10a5d9d2a24 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -211,9 +211,8 @@ class Issue < ActiveRecord::Base due_date.try(:past?) || false end - # Only issues on public projects should be checked for spam def check_for_spam? - project.public? + project.public? && (title_changed? || description_changed?) end def as_json(options = {}) diff --git a/app/models/snippet.rb b/app/models/snippet.rb index dbd564e5e7d..30aca62499c 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -132,7 +132,8 @@ class Snippet < ActiveRecord::Base end def check_for_spam? - public? + visibility_level_changed?(to: Snippet::PUBLIC) || + (public? && (title_changed? || content_changed?)) end def spammable_entity_type |