Skip to content
This repository

Add option to make subreddit traffic stats page public #309

Closed
wants to merge 1 commit into from

2 participants

Bryce Boe Neil Williams
Neil Williams
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.

Bryce Boe

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

Bryce Boe
bboe commented

: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.

Neil Williams
Owner

Merged (finally) as 5430a4c. Thanks!

Neil Williams spladug closed this
Bryce Boe
bboe commented

Woo (finally ;))!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 07, 2012
Bryce Boe Add option to make subreddit traffic stats page public cc721fc
This page is out of date. Refresh to see the latest.
4  r2/r2/controllers/api.py
@@ -1263,6 +1263,7 @@ def POST_upload_sr_img(self, file, header, sponsor, name, form_id, img_type):
1263 1263
                    over_18 = VBoolean('over_18'),
1264 1264
                    allow_top = VBoolean('allow_top'),
1265 1265
                    show_media = VBoolean('show_media'),
  1266
+                   public_traffic = VBoolean('public_traffic'),
1266 1267
                    show_cname_sidebar = VBoolean('show_cname_sidebar'),
1267 1268
                    type = VOneOf('type', ('public', 'private', 'restricted', 'archived')),
1268 1269
                    link_type = VOneOf('link_type', ('any', 'link', 'self')),
@@ -1280,7 +1281,8 @@ def POST_site_admin(self, form, jquery, name, ip, sr,
1280 1281
         redir = False
1281 1282
         kw = dict((k, v) for k, v in kw.iteritems()
1282 1283
                   if k in ('name', 'title', 'domain', 'description', 'over_18',
1283  
-                           'show_media', 'show_cname_sidebar', 'type', 'link_type', 'lang',
  1284
+                           'show_media', 'public_traffic',
  1285
+                           'show_cname_sidebar', 'type', 'link_type', 'lang',
1284 1286
                            "css_on_cname", "header_title", 
1285 1287
                            'allow_top'))
1286 1288
 
2  r2/r2/controllers/front.py
@@ -533,7 +533,7 @@ def _edit_normal_reddit(self, location, num, after, reverse, count, created,
533 533
             pane = self._make_spamlisting(location, num, after, reverse, count)
534 534
             if c.user.pref_private_feeds:
535 535
                 extension_handling = "private"
536  
-        elif is_moderator and location == 'traffic':
  536
+        elif (c.site.public_traffic or is_moderator) and location == 'traffic':
537 537
             pane = RedditTraffic()
538 538
         elif is_moderator and location == 'flair':
539 539
             pane = FlairPane(num, after, reverse, name, user)
1  r2/r2/models/modaction.py
@@ -65,6 +65,7 @@ class ModAction(tdb_cassandra.UuidThing, Printable):
65 65
                      'over_18': _('toggle viewers must be over 18'),
66 66
                      'allow_top': _('toggle allow in default set'),
67 67
                      'show_media': _('toggle show thumbnail images of content'),
  68
+                     'public_traffic': _('toggle public traffic stats page'),
68 69
                      'domain': _('domain'),
69 70
                      'show_cname_sidebar': _('toggle show sidebar from cname'),
70 71
                      'css_on_cname': _('toggle custom CSS from cname'),
1  r2/r2/models/subreddit.py
@@ -76,6 +76,7 @@ class Subreddit(Thing, Printable):
76 76
                      flair_enabled = True,
77 77
                      flair_position = 'right', # one of ('left', 'right')
78 78
                      flair_self_assign_enabled = False,
  79
+                     public_traffic = False,
79 80
                      )
80 81
     _essentials = ('type', 'name', 'lang')
81 82
     _data_int_props = Thing._data_int_props + ('mod_actions', 'reported')
8  r2/r2/templates/createsubreddit.html
@@ -163,6 +163,14 @@
163 163
             ${_("show thumbnail images of content")}
164 164
           </label>
165 165
         </li>
  166
+        <li>
  167
+          <input class="nomargin" type="checkbox"
  168
+                 name="public_traffic" id="public_traffic"
  169
+                 ${thing.site and thing.site.public_traffic and "checked='checked'" or ""}/>
  170
+          <label for="public_traffic">
  171
+            ${_("make the traffic stats page available to everyone")}
  172
+          </label>
  173
+        </li>
166 174
       </ul>
167 175
     </div>
168 176
   </%utils:line_field>
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.