mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
Remove things as spam or not spam.
This commit is contained in:
@@ -1426,19 +1426,27 @@ class ApiController(RedditController):
|
||||
|
||||
@noresponse(VUser(), VModhash(),
|
||||
why = VSrCanBan('id'),
|
||||
thing = VByName('id'))
|
||||
def POST_remove(self, why, thing):
|
||||
thing = VByName('id'),
|
||||
spam = VBoolean('spam', default=True))
|
||||
def POST_remove(self, why, thing, spam):
|
||||
if getattr(thing, "promoted", None) is None:
|
||||
end_trial(thing, why + "-removed")
|
||||
kw = {}
|
||||
if thing._spam:
|
||||
|
||||
kw = {'target': thing}
|
||||
if thing._spam and spam:
|
||||
kw['details'] = 'confirm_spam'
|
||||
admintools.spam(thing, False, not c.user_is_admin, c.user.name)
|
||||
sr = thing.subreddit_slow
|
||||
if isinstance(thing, Link):
|
||||
ModAction.create(sr, c.user, 'removelink', target=thing, **kw)
|
||||
elif isinstance(thing, Comment):
|
||||
ModAction.create(sr, c.user, 'removecomment', target=thing, **kw)
|
||||
|
||||
admintools.spam(thing, auto=False,
|
||||
moderator_banned=not c.user_is_admin,
|
||||
banner=c.user.name,
|
||||
train_spam=spam)
|
||||
|
||||
if isinstance(thing, (Link, Comment)):
|
||||
if not spam:
|
||||
kw['details'] = 'not_spam'
|
||||
sr = thing.subreddit_slow
|
||||
action = 'remove' + thing.__class__.__name__.lower()
|
||||
ModAction.create(sr, c.user, action, **kw)
|
||||
|
||||
@noresponse(VUser(), VModhash(),
|
||||
why = VSrCanBan('id'),
|
||||
|
||||
@@ -32,7 +32,7 @@ from copy import copy
|
||||
class AdminTools(object):
|
||||
|
||||
def spam(self, things, auto=True, moderator_banned=False,
|
||||
banner=None, date = None, **kw):
|
||||
banner=None, date=None, train_spam=True, **kw):
|
||||
from r2.lib.db import queries
|
||||
|
||||
all_things = tup(things)
|
||||
@@ -58,6 +58,8 @@ class AdminTools(object):
|
||||
else:
|
||||
ban_info['banner'] = banner
|
||||
|
||||
ban_info['not_spam'] = not train_spam
|
||||
|
||||
t.ban_info = ban_info
|
||||
t._commit()
|
||||
|
||||
|
||||
@@ -238,6 +238,8 @@ class Builder(object):
|
||||
w.moderator_banned = ban_info.get('moderator_banned', False)
|
||||
w.autobanned = ban_info.get('auto', False)
|
||||
w.banner = ban_info.get('banner')
|
||||
if ban_info.get('not_spam', False) and w.banner:
|
||||
w.banner += ' (not spam)'
|
||||
w.use_big_modbuttons = True
|
||||
if getattr(w, "author", None) and w.author._spam:
|
||||
w.show_spam = "author"
|
||||
|
||||
@@ -62,6 +62,7 @@ class ModAction(tdb_cassandra.UuidThing, Printable):
|
||||
'unspam': _('unspam'),
|
||||
# remove comment/link
|
||||
'confirm_spam': _('confirmed spam'),
|
||||
'not_spam': _('not spam'),
|
||||
# removemoderator
|
||||
'remove_self': _('removed self'),
|
||||
# editsettings
|
||||
|
||||
@@ -41,7 +41,10 @@
|
||||
%if not getattr(thing.thing, "use_big_modbuttons", False):
|
||||
%if not thing.show_spam:
|
||||
<li>
|
||||
${ynbutton(_("remove"), _("removed"), "remove")}
|
||||
${ynbutton(_("spam"), _("spammed"), "remove")}
|
||||
</li>
|
||||
<li>
|
||||
${ynbutton(_("remove"), _("removed"), "remove", hidden_data=dict(spam=False))}
|
||||
</li>
|
||||
%endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user