mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-30 01:08:32 -05:00
Add ignore/unignore reports functionality for moderators.
When a thing has ignore_reports, the thing is no longer added to the moderator cached queries (reported queue, mod queue, etc) when a user reports it.
This commit is contained in:
@@ -1062,6 +1062,8 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
or (item._ups + item._downs > 2)):
|
||||
item.editted = c.start_time
|
||||
|
||||
item.ignore_reports = False
|
||||
|
||||
item._commit()
|
||||
|
||||
changed(item)
|
||||
@@ -1855,6 +1857,38 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
action = 'approve' + thing.__class__.__name__.lower()
|
||||
ModAction.create(sr, c.user, action, **kw)
|
||||
|
||||
@require_oauth2_scope("modposts")
|
||||
@noresponse(VUser(), VModhash(),
|
||||
VSrCanBan('id'),
|
||||
thing=VByName('id'))
|
||||
@api_doc(api_section.moderation)
|
||||
def POST_ignore_reports(self, thing):
|
||||
if not thing: return
|
||||
if thing._deleted: return
|
||||
if thing.ignore_reports: return
|
||||
|
||||
thing.ignore_reports = True
|
||||
thing._commit()
|
||||
|
||||
sr = thing.subreddit_slow
|
||||
ModAction.create(sr, c.user, 'ignorereports', target=thing)
|
||||
|
||||
@require_oauth2_scope("modposts")
|
||||
@noresponse(VUser(), VModhash(),
|
||||
VSrCanBan('id'),
|
||||
thing=VByName('id'))
|
||||
@api_doc(api_section.moderation)
|
||||
def POST_unignore_reports(self, thing):
|
||||
if not thing: return
|
||||
if thing._deleted: return
|
||||
if not thing.ignore_reports: return
|
||||
|
||||
thing.ignore_reports = False
|
||||
thing._commit()
|
||||
|
||||
sr = thing.subreddit_slow
|
||||
ModAction.create(sr, c.user, 'unignorereports', target=thing)
|
||||
|
||||
@require_oauth2_scope("modposts")
|
||||
@validatedForm(VUser(), VModhash(),
|
||||
VCanDistinguish(('id', 'how')),
|
||||
|
||||
@@ -75,6 +75,7 @@ class Link(Thing, Printable):
|
||||
comment_tree_id=0,
|
||||
contest_mode=False,
|
||||
skip_commentstree_q="",
|
||||
ignore_reports=False,
|
||||
)
|
||||
_essentials = ('sr_id', 'author_id')
|
||||
_nsfw = re.compile(r"\bnsfw\b", re.I)
|
||||
@@ -689,7 +690,9 @@ class Comment(Thing, Printable):
|
||||
new=False,
|
||||
gildings=0,
|
||||
banned_before_moderator=False,
|
||||
parents=None)
|
||||
parents=None,
|
||||
ignore_reports=False,
|
||||
)
|
||||
_essentials = ('link_id', 'author_id')
|
||||
|
||||
def _markdown(self):
|
||||
|
||||
@@ -55,7 +55,8 @@ class ModAction(tdb_cassandra.UuidThing, Printable):
|
||||
'removemoderator', 'addcontributor', 'removecontributor',
|
||||
'editsettings', 'editflair', 'distinguish', 'marknsfw',
|
||||
'wikibanned', 'wikicontributor', 'wikiunbanned',
|
||||
'removewikicontributor', 'wikirevise', 'wikipermlevel')
|
||||
'removewikicontributor', 'wikirevise', 'wikipermlevel',
|
||||
'ignorereports', 'unignorereports')
|
||||
|
||||
_menu = {'banuser': _('ban user'),
|
||||
'unbanuser': _('unban user'),
|
||||
@@ -79,7 +80,9 @@ class ModAction(tdb_cassandra.UuidThing, Printable):
|
||||
'wikicontributor': _('add wiki contributor'),
|
||||
'removewikicontributor': _('remove wiki contributor'),
|
||||
'wikirevise': _('wiki revise page'),
|
||||
'wikipermlevel': _('wiki page permissions')}
|
||||
'wikipermlevel': _('wiki page permissions'),
|
||||
'ignorereports': _('ignore reports'),
|
||||
'unignorereports': _('unignore reports')}
|
||||
|
||||
_text = {'banuser': _('banned'),
|
||||
'wikibanned': _('wiki banned'),
|
||||
@@ -103,7 +106,9 @@ class ModAction(tdb_cassandra.UuidThing, Printable):
|
||||
'wikirevise': _('edited wiki page'),
|
||||
'wikipermlevel': _('changed wiki page permission level'),
|
||||
'distinguish': _('distinguished'),
|
||||
'marknsfw': _('marked nsfw')}
|
||||
'marknsfw': _('marked nsfw'),
|
||||
'ignorereports': _('ignored reports'),
|
||||
'unignorereports': _('unignored reports')}
|
||||
|
||||
_details_text = {# approve comment/link
|
||||
'unspam': _('unspam'),
|
||||
@@ -146,7 +151,8 @@ class ModAction(tdb_cassandra.UuidThing, Printable):
|
||||
'flair_delete_template': _('delete flair template'),
|
||||
'flair_clear_template': _('clear flair templates'),
|
||||
# distinguish/nsfw
|
||||
'remove': _('remove')}
|
||||
'remove': _('remove'),
|
||||
'ignore_reports': _('ignore reports')}
|
||||
|
||||
# This stuff won't change
|
||||
cache_ignore = set(['subreddit', 'target']).union(Printable.cache_ignore)
|
||||
|
||||
@@ -72,7 +72,7 @@ class Report(MultiRelation('report',
|
||||
author._incr('reported')
|
||||
|
||||
item_age = datetime.now(g.tz) - thing._date
|
||||
if item_age.days < g.REPORT_AGE_LIMIT:
|
||||
if item_age.days < g.REPORT_AGE_LIMIT and not thing.ignore_reports:
|
||||
# update the reports queue if it exists
|
||||
queries.new_report(thing, r)
|
||||
|
||||
@@ -80,7 +80,7 @@ class Report(MultiRelation('report',
|
||||
if thing._spam:
|
||||
cls.accept(thing)
|
||||
else:
|
||||
g.log.debug("Ignoring old report %s" % r)
|
||||
g.log.debug("Ignoring report %s" % r)
|
||||
|
||||
return r
|
||||
|
||||
|
||||
@@ -5668,7 +5668,9 @@ body:not(.gold) .allminus-link {
|
||||
.modactions.wikibanned,
|
||||
.modactions.wikiunbanned,
|
||||
.modactions.wikicontributor,
|
||||
.modactions.removewikicontributor {
|
||||
.modactions.removewikicontributor,
|
||||
.modactions.ignorereports,
|
||||
.modactions.unignorereports {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
display: block;
|
||||
@@ -5739,6 +5741,12 @@ body:not(.gold) .allminus-link {
|
||||
.modactions.removewikicontributor {
|
||||
background-image: url(../modactions_removecontributor.png); /* SPRITE */
|
||||
}
|
||||
.modactions.ignorereports {
|
||||
background-image: url(../modactions_mute.png); /* SPRITE */
|
||||
}
|
||||
.modactions.unignorereports {
|
||||
background-image: url(../modactions_unmute.png); /* SPRITE */
|
||||
}
|
||||
|
||||
.adminpasswordform {
|
||||
display: block;
|
||||
|
||||
@@ -1195,6 +1195,8 @@ function big_mod_action(elem, dir) {
|
||||
} else if (dir == 1) {
|
||||
$.request("approve", d, null, true);
|
||||
elem.siblings(".approved").show();
|
||||
} else if (dir == 2) {
|
||||
$.request("ignore_reports", d, null, true);
|
||||
}
|
||||
}
|
||||
elem.siblings(".pretty-button").removeClass("pressed");
|
||||
|
||||
BIN
r2/r2/public/static/modactions_mute.png
Normal file
BIN
r2/r2/public/static/modactions_mute.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 474 B |
BIN
r2/r2/public/static/modactions_unmute.png
Normal file
BIN
r2/r2/public/static/modactions_unmute.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 610 B |
@@ -124,22 +124,29 @@
|
||||
|
||||
<%def name="big_modbuttons(thing, kind)">
|
||||
<span class="big-mod-buttons">
|
||||
%if getattr(thing, "moderator_banned", None):
|
||||
<!-- pass -->
|
||||
%elif thing._spam:
|
||||
${pretty_button(_("confirm spam"), "big_mod_action", -2, "negative")}
|
||||
${pretty_button(_("remove ham"), "big_mod_action", -1, "neutral")}
|
||||
%else:
|
||||
${pretty_button(_("spam"), "big_mod_action", -2, "negative")}
|
||||
${pretty_button(_("remove"), "big_mod_action", -1, "neutral")}
|
||||
%endif
|
||||
<span role="radiogroup">
|
||||
%if getattr(thing, "moderator_banned", None):
|
||||
<!-- pass -->
|
||||
%elif thing._spam:
|
||||
${pretty_button(_("confirm spam"), "big_mod_action", -2, "negative")}
|
||||
${pretty_button(_("remove ham"), "big_mod_action", -1, "neutral")}
|
||||
%else:
|
||||
${pretty_button(_("spam"), "big_mod_action", -2, "negative")}
|
||||
${pretty_button(_("remove"), "big_mod_action", -1, "neutral")}
|
||||
%endif
|
||||
|
||||
%if getattr(thing, "approval_checkmark", None):
|
||||
${pretty_button(_("reapprove %(obj)s") % dict(obj=kind),
|
||||
"big_mod_action", 1, "positive")}
|
||||
%else:
|
||||
${pretty_button(_("approve %(obj)s") % dict(obj=kind),
|
||||
"big_mod_action", 1, "positive")}
|
||||
%endif
|
||||
</span>
|
||||
|
||||
%if getattr(thing, "approval_checkmark", None):
|
||||
${pretty_button(_("reapprove %(obj)s") % dict(obj=kind),
|
||||
"big_mod_action", 1, "positive")}
|
||||
%else:
|
||||
${pretty_button(_("approve %(obj)s") % dict(obj=kind),
|
||||
"big_mod_action", 1, "positive")}
|
||||
%if not thing.ignore_reports:
|
||||
${pretty_button(_("ignore reports"),
|
||||
"big_mod_action", 2, "neutral")}
|
||||
%endif
|
||||
|
||||
 
|
||||
|
||||
Reference in New Issue
Block a user