Enable spam checking for snippets regardless of the visibility
Our snippet spammers are back. It seems they found out our anti-spam check only happens for public snippets. As a result they found the following workaround:
- Create private snippet
- Mark snippet as public
- Profit!
As such we need to start checking for snippet spam regardless of the visibility. I applied the following patch to GitLab.com to deal with this:
diff --git a/app/models/project_snippet.rb b/app/models/project_snippet.rb
index cba20dadad..eb60adc16c 100644
--- a/app/models/project_snippet.rb
+++ b/app/models/project_snippet.rb
@@ -16,6 +16,6 @@ class ProjectSnippet < Snippet
participant :notes_with_associations
def check_for_spam?
- super && project.public?
+ true
end
end
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 3b9fa4445d..de462ce6ef 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -133,7 +133,7 @@ class Snippet < ActiveRecord::Base
end
def check_for_spam?
- public?
+ true
end
def spammable_entity_type
cc @smcgivern