mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 15:58:06 -05:00
Add comments/moderator/misc minor listings for LabeledMultis.
Adds the following minor listings: * comments * gilded comments * moderator util listings * modlog * messages
This commit is contained in:
@@ -64,16 +64,6 @@ def make_map():
|
||||
action='subreddit_traffic_report')
|
||||
mc('/account-activity', controller='front', action='account_activity')
|
||||
|
||||
mc('/about/message/:where', controller='message', action='listing')
|
||||
mc('/about/log', controller='front', action='moderationlog')
|
||||
mc('/about/sidebar', controller='front', action='sidebar')
|
||||
mc('/about', controller='front', action='about')
|
||||
mc('/about/flair', controller='front', action='flairlisting')
|
||||
mc('/about/:location', controller='front', action='spamlisting',
|
||||
requirements=dict(location='reports|spam|modqueue|unmoderated'))
|
||||
mc('/about/:location', controller='front', action='editreddit',
|
||||
location='about')
|
||||
|
||||
mc('/subreddits/create', controller='front', action='newreddit')
|
||||
mc('/subreddits/search', controller='front', action='search_reddits')
|
||||
mc('/subreddits/login', controller='forms', action='login')
|
||||
@@ -132,6 +122,23 @@ def make_map():
|
||||
mc('/user/:username/m/:multi/:sort', controller='browse', sort='top',
|
||||
action='listing', requirements=dict(sort='top|controversial'))
|
||||
|
||||
mc('/about/sidebar', controller='front', action='sidebar')
|
||||
mc('/about/flair', controller='front', action='flairlisting')
|
||||
mc('/about', controller='front', action='about')
|
||||
mc('/comments/gilded', controller='redirect', action='gilded_comments',
|
||||
conditions={'function': not_in_sr})
|
||||
for prefix in ('', '/user/:username/m/:multi'):
|
||||
mc(prefix + '/about/message/:where', controller='message',
|
||||
action='listing')
|
||||
mc(prefix + '/about/log', controller='front', action='moderationlog')
|
||||
mc(prefix + '/about/:location', controller='front',
|
||||
action='spamlisting',
|
||||
requirements=dict(location='reports|spam|modqueue|unmoderated'))
|
||||
mc(prefix + '/about/:location', controller='front', action='editreddit',
|
||||
location='about')
|
||||
mc(prefix + '/comments', controller='comments', action='listing')
|
||||
mc(prefix + '/comments/gilded', action='listing', controller='gilded')
|
||||
|
||||
mc('/u/:username', controller='redirect', action='user_redirect')
|
||||
mc('/u/:username/*rest', controller='redirect', action='user_redirect')
|
||||
|
||||
@@ -148,9 +155,6 @@ def make_map():
|
||||
mc('/info/:article/:dest/:comment', controller='front',
|
||||
action='oldinfo', type='old', dest='comments', comment=None)
|
||||
|
||||
mc("/comments/gilded", controller="redirect", action="gilded_comments",
|
||||
conditions={"function": not_in_sr})
|
||||
mc("/comments/gilded", action="listing", controller="gilded")
|
||||
|
||||
mc('/related/:article/:title', controller='front',
|
||||
action='related', title=None)
|
||||
@@ -200,7 +204,7 @@ def make_map():
|
||||
mc('/', controller='hot', action='listing')
|
||||
|
||||
mc('/:controller', action='listing',
|
||||
requirements=dict(controller="hot|new|rising|randomrising|comments"))
|
||||
requirements=dict(controller="hot|new|rising|randomrising"))
|
||||
mc('/saved', controller='user', action='saved_redirect')
|
||||
|
||||
mc('/by_id/:names', controller='byId', action='listing')
|
||||
|
||||
@@ -365,8 +365,10 @@ class Reddit(Templated):
|
||||
box = SubscriptionBox(srs)
|
||||
ps.append(SideContentBox(_('these subreddits'), [box]))
|
||||
|
||||
if c.user_is_admin or c.site.is_moderator(c.user):
|
||||
ps.append(self.sr_admin_menu())
|
||||
if (srs and c.user_is_loggedin and
|
||||
(c.user_is_admin or c.site.is_moderator(c.user))):
|
||||
ps.append(self.sr_admin_menu())
|
||||
|
||||
|
||||
if isinstance(c.site, AllSR):
|
||||
ps.append(AllInfoBar(c.site, c.user))
|
||||
|
||||
@@ -110,6 +110,45 @@ class BaseSite(object):
|
||||
rel = self.is_moderator(user)
|
||||
return bool(rel and rel.is_superuser())
|
||||
|
||||
def get_links(self, sort, time):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_links(self, sort, time)
|
||||
|
||||
def get_spam(self, include_links=True, include_comments=True):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_spam(self, user=c.user, include_links=include_links,
|
||||
include_comments=include_comments)
|
||||
|
||||
def get_reported(self, include_links=True, include_comments=True):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_reported(self, user=c.user,
|
||||
include_links=include_links,
|
||||
include_comments=include_comments)
|
||||
|
||||
def get_modqueue(self, include_links=True, include_comments=True):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_modqueue(self, user=c.user,
|
||||
include_links=include_links,
|
||||
include_comments=include_comments)
|
||||
|
||||
def get_unmoderated(self):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_unmoderated(self, user=c.user)
|
||||
|
||||
def get_all_comments(self):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_sr_comments(self)
|
||||
|
||||
def get_gilded_comments(self):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_gilded_comments(self)
|
||||
|
||||
@classmethod
|
||||
def get_modactions(cls, srs, mod=None, action=None):
|
||||
# Get a query that will yield ModAction objects with mod and action
|
||||
from r2.models import ModAction
|
||||
return ModAction.get_actions(srs, mod=mod, action=action)
|
||||
|
||||
|
||||
class SubredditExists(Exception): pass
|
||||
|
||||
@@ -558,45 +597,6 @@ class Subreddit(Thing, Printable, BaseSite):
|
||||
"""Return whether or not to keep a thing in rising for this SR."""
|
||||
return sr_id == self._id
|
||||
|
||||
def get_links(self, sort, time):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_links(self, sort, time)
|
||||
|
||||
def get_spam(self, include_links=True, include_comments=True):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_spam(self, user=c.user, include_links=include_links,
|
||||
include_comments=include_comments)
|
||||
|
||||
def get_reported(self, include_links=True, include_comments=True):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_reported(self, user=c.user,
|
||||
include_links=include_links,
|
||||
include_comments=include_comments)
|
||||
|
||||
def get_modqueue(self, include_links=True, include_comments=True):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_modqueue(self, user=c.user,
|
||||
include_links=include_links,
|
||||
include_comments=include_comments)
|
||||
|
||||
def get_unmoderated(self):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_unmoderated(self, user=c.user)
|
||||
|
||||
def get_all_comments(self):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_sr_comments(self)
|
||||
|
||||
def get_gilded_comments(self):
|
||||
from r2.lib.db import queries
|
||||
return queries.get_gilded_comments(self)
|
||||
|
||||
@classmethod
|
||||
def get_modactions(cls, srs, mod=None, action=None):
|
||||
# Get a query that will yield ModAction objects with mod and action
|
||||
from r2.models import ModAction
|
||||
return ModAction.get_actions(srs, mod=mod, action=action)
|
||||
|
||||
@classmethod
|
||||
def add_props(cls, user, wrapped):
|
||||
names = ('subscriber', 'moderator', 'contributor')
|
||||
|
||||
Reference in New Issue
Block a user