Merge branch 'main' into avm99963-monorail
Merged commit 3779da353b36d43cf778e7d4f468097714dd4540
GitOrigin-RevId: 6451a5c6b75afb0fd1f37b3f14521148d0722ea8
diff --git a/features/banspammer.py b/features/banspammer.py
index a6be311..fd28045 100644
--- a/features/banspammer.py
+++ b/features/banspammer.py
@@ -8,7 +8,6 @@
from __future__ import division
from __future__ import absolute_import
-import logging
import json
import time
@@ -17,10 +16,10 @@
from framework import framework_helpers
from framework import permissions
from framework import jsonfeed
-from framework import servlet
from framework import urls
-class BanSpammer(servlet.Servlet):
+
+class BanSpammer(flaskservlet.FlaskServlet):
"""Ban a user and mark their content as spam"""
def AssertBasePermission(self, mr):
@@ -57,12 +56,11 @@
mr, mr.viewed_user_auth.user_view.profile_url, include_project=False,
saved=1, ts=int(time.time()))
- # def PostBanSpammerPage(self, **kwargs):
- # return self.handler(**kwargs)
+ def PostBanSpammerPage(self, **kwargs):
+ return self.handler(**kwargs)
-# when convert to flask switch jsonfeed.FlaskInternalTask
-class BanSpammerTask(jsonfeed.InternalTask):
+class BanSpammerTask(jsonfeed.FlaskInternalTask):
"""This task will update all of the comments and issues created by the
target user with is_spam=True, and also add a manual verdict attached
to the user who originated the ban request. This is a potentially long
@@ -96,18 +94,10 @@
self.services.issue, self.services.user, comment.id,
reporter_id, is_spammer)
- # remove the self.response.body when convert to flask
- self.response.body = json.dumps({
- 'comments': len(comments),
- 'issues': len(issues),
+ return json.dumps({
+ 'comments': len(comments),
+ 'issues': len(issues),
})
- # return json.dumps({
- # 'comments': len(comments),
- # 'issues': len(issues),
- # })
- # def GetBanSpammer(self, **kwargs):
- # return self.handler(**kwargs)
-
- # def PostBanSpammer(self, **kwargs):
- # return self.handler(**kwargs)
+ def PostBanSpammer(self, **kwargs):
+ return self.handler(**kwargs)