From b14b73e109c623b518c0c4cfce6900d1ee74b38f Mon Sep 17 00:00:00 2001 From: bsimpson63 Date: Fri, 23 Dec 2011 10:37:13 -0800 Subject: [PATCH] ModAction details field for confirm spam and unspam. --- r2/r2/controllers/api.py | 15 ++++++++++----- r2/r2/models/modaction.py | 6 +++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 8707847b8..3ca6057ec 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1385,12 +1385,15 @@ class ApiController(RedditController): def POST_remove(self, why, thing): if getattr(thing, "promoted", None) is None: end_trial(thing, why + "-removed") + kw = {} + if thing._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) + ModAction.create(sr, c.user, 'removelink', target=thing, **kw) elif isinstance(thing, Comment): - ModAction.create(sr, c.user, 'removecomment', target=thing) + ModAction.create(sr, c.user, 'removecomment', target=thing, **kw) @noresponse(VUser(), VModhash(), why = VSrCanBan('id'), @@ -1398,14 +1401,16 @@ class ApiController(RedditController): def POST_approve(self, why, thing): if not thing: return if thing._deleted: return - end_trial(thing, why + "-approved") + kw = {} + if thing._spam: + kw['details'] = 'unspam' admintools.unspam(thing, c.user.name) sr = thing.subreddit_slow if isinstance(thing, Link): - ModAction.create(sr, c.user, 'approvelink', target=thing) + ModAction.create(sr, c.user, 'approvelink', target=thing, **kw) elif isinstance(thing, Comment): - ModAction.create(sr, c.user, 'approvecomment', target=thing) + ModAction.create(sr, c.user, 'approvecomment', target=thing, **kw) @validatedForm(VUser(), VModhash(), VCanDistinguish(('id', 'how')), diff --git a/r2/r2/models/modaction.py b/r2/r2/models/modaction.py index 2eacc21c1..aa334dcf5 100644 --- a/r2/r2/models/modaction.py +++ b/r2/r2/models/modaction.py @@ -54,7 +54,11 @@ class ModAction(tdb_cassandra.UuidThing, Printable): 'editsettings': _('edited settings'), 'editflair': _('edited user flair')} - _details_text = {# removemoderator + _details_text = {# approve comment/link + 'unspam': _('unspam'), + # remove comment/link + 'confirm_spam': _('confirmed spam'), + # removemoderator 'remove_self': _('removed self'), # editsettings 'title': _('title'),