Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add option to make subreddit traffic stats page public #309

Closed
wants to merge 1 commit into from

2 participants

@spladug
Owner

This looks good to me. As discussed before, we'll merge it up when we make the traffic page bypass the old traffic app and go straight to the db. As is, I don't think the old app could hold up to publicly available traffic pages.

@bboe

Can I get a status update on this PR? Thanks :)

@bboe

:haircut:

Given that traffic is not on it's own app anymore can the site handle these pages publicly? I personally would really like to see this feature go through.

@spladug
Owner

Merged (finally) as 5430a4c. Thanks!

@spladug spladug closed this
@bboe

Woo (finally ;))!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 8, 2012
  1. @bboe
This page is out of date. Refresh to see the latest.
View
4 r2/r2/controllers/api.py
@@ -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'))
View
2  r2/r2/controllers/front.py
@@ -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)
View
1  r2/r2/models/modaction.py
@@ -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'),
View
1  r2/r2/models/subreddit.py
@@ -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')
View
8 r2/r2/templates/createsubreddit.html
@@ -163,6 +163,14 @@
${_("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>
Something went wrong with that request. Please try again.