mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 07:19:25 -05:00
Stop using end_trial to set verdict on remove/approve.
This commit is contained in:
@@ -42,7 +42,7 @@ from r2.lib.pages import (EnemyList, FriendList, ContributorList, ModList,
|
||||
from r2.lib.pages import FlairList, FlairCsv, FlairTemplateEditor, \
|
||||
FlairSelector
|
||||
from r2.lib.pages import PrefApps
|
||||
from r2.lib.utils.trial_utils import indict, end_trial, trial_info
|
||||
from r2.lib.utils.trial_utils import indict, trial_info
|
||||
from r2.lib.pages.things import wrap_links, default_thing_wrapper
|
||||
from r2.models.last_modified import LastModified
|
||||
|
||||
@@ -1685,8 +1685,6 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
if getattr(thing, "promoted", None):
|
||||
return
|
||||
|
||||
end_trial(thing, why + "-removed")
|
||||
|
||||
filtered = thing._spam
|
||||
kw = {'target': thing}
|
||||
|
||||
@@ -1722,7 +1720,6 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
def POST_approve(self, why, thing):
|
||||
if not thing: return
|
||||
if thing._deleted: return
|
||||
end_trial(thing, why + "-approved")
|
||||
kw = {'target': thing}
|
||||
if thing._spam:
|
||||
kw['details'] = 'unspam'
|
||||
@@ -1733,7 +1730,8 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
train_spam = False
|
||||
insert = False
|
||||
|
||||
admintools.unspam(thing, c.user.name, train_spam=train_spam,
|
||||
admintools.unspam(thing, moderator_unbanned=not c.user_is_admin,
|
||||
unbanner=c.user.name, train_spam=train_spam,
|
||||
insert=insert)
|
||||
|
||||
if isinstance(thing, (Link, Comment)):
|
||||
|
||||
@@ -57,6 +57,11 @@ class AdminTools(object):
|
||||
|
||||
t._spam = True
|
||||
|
||||
if moderator_banned:
|
||||
t.verdict = 'mod-removed'
|
||||
elif not auto:
|
||||
t.verdict = 'admin-removed'
|
||||
|
||||
ban_info = copy(getattr(t, 'ban_info', {}))
|
||||
if isinstance(banner, dict):
|
||||
ban_info['banner'] = banner[t._fullname]
|
||||
@@ -77,7 +82,8 @@ class AdminTools(object):
|
||||
|
||||
queries.ban(all_things, filtered=auto)
|
||||
|
||||
def unspam(self, things, unbanner=None, train_spam=True, insert=True):
|
||||
def unspam(self, things, moderator_unbanned=True, unbanner=None,
|
||||
train_spam=True, insert=True):
|
||||
from r2.lib.db import queries
|
||||
|
||||
things = tup(things)
|
||||
@@ -105,6 +111,10 @@ class AdminTools(object):
|
||||
ban_info['reset_used'] = True
|
||||
t.ban_info = ban_info
|
||||
t._spam = False
|
||||
if moderator_unbanned:
|
||||
t.verdict = 'mod-approved'
|
||||
else:
|
||||
t.verdict = 'admin-approved'
|
||||
t._commit()
|
||||
|
||||
self.author_spammer(things, False)
|
||||
|
||||
Reference in New Issue
Block a user