diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-03-20 23:37:29 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-03-21 14:20:15 -0300 |
commit | d730b69eb26ab5917b773a242c21f5967661d964 (patch) | |
tree | a295e3a825afb93f189adda53dfc83401439b4d9 /app/models | |
parent | 86ef67eee559c536e159673b26fb524c92d2eb82 (diff) | |
download | gitlab-ce-d730b69eb26ab5917b773a242c21f5967661d964.tar.gz |
Spam check only when spammable attributes have changed
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/issue.rb | 3 | ||||
-rw-r--r-- | app/models/snippet.rb | 3 |
2 files changed, 3 insertions, 3 deletions
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 |