Permalink
Browse files

Add option to make subreddit traffic stats page public

  • Loading branch information...
bboe committed Jan 8, 2012
1 parent 5f0c23a commit cc721fce2731f256bb4d99bf117a0cf2a5e858da
View
@@ -1263,6 +1263,7 @@ def POST_upload_sr_img(self, file, header, sponsor, name, form_id, img_type):
over_18 = VBoolean('over_18'),
allow_top = VBoolean('allow_top'),
show_media = VBoolean('show_media'),
+ public_traffic = VBoolean('public_traffic'),
show_cname_sidebar = VBoolean('show_cname_sidebar'),
type = VOneOf('type', ('public', 'private', 'restricted', 'archived')),
link_type = VOneOf('link_type', ('any', 'link', 'self')),
@@ -1280,7 +1281,8 @@ def POST_site_admin(self, form, jquery, name, ip, sr,
redir = False
kw = dict((k, v) for k, v in kw.iteritems()
if k in ('name', 'title', 'domain', 'description', 'over_18',
- 'show_media', 'show_cname_sidebar', 'type', 'link_type', 'lang',
+ 'show_media', 'public_traffic',
+ 'show_cname_sidebar', 'type', 'link_type', 'lang',
"css_on_cname", "header_title",
'allow_top'))
@@ -533,7 +533,7 @@ def _edit_normal_reddit(self, location, num, after, reverse, count, created,
pane = self._make_spamlisting(location, num, after, reverse, count)
if c.user.pref_private_feeds:
extension_handling = "private"
- elif is_moderator and location == 'traffic':
+ elif (c.site.public_traffic or is_moderator) and location == 'traffic':
pane = RedditTraffic()
elif is_moderator and location == 'flair':
pane = FlairPane(num, after, reverse, name, user)
@@ -65,6 +65,7 @@ class ModAction(tdb_cassandra.UuidThing, Printable):
'over_18': _('toggle viewers must be over 18'),
'allow_top': _('toggle allow in default set'),
'show_media': _('toggle show thumbnail images of content'),
+ 'public_traffic': _('toggle public traffic stats page'),
'domain': _('domain'),
'show_cname_sidebar': _('toggle show sidebar from cname'),
'css_on_cname': _('toggle custom CSS from cname'),
@@ -76,6 +76,7 @@ class Subreddit(Thing, Printable):
flair_enabled = True,
flair_position = 'right', # one of ('left', 'right')
flair_self_assign_enabled = False,
+ public_traffic = False,
)
_essentials = ('type', 'name', 'lang')
_data_int_props = Thing._data_int_props + ('mod_actions', 'reported')
@@ -163,6 +163,14 @@ <h1>${_("create a community")}</h1>
${_("show thumbnail images of content")}
</label>
</li>
+ <li>
+ <input class="nomargin" type="checkbox"
+ name="public_traffic" id="public_traffic"
+ ${thing.site and thing.site.public_traffic and "checked='checked'" or ""}/>
+ <label for="public_traffic">
+ ${_("make the traffic stats page available to everyone")}
+ </label>
+ </li>
</ul>
</div>
</%utils:line_field>

0 comments on commit cc721fc

Please sign in to comment.