mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
Modify display of accounts_active info.
This now relies on the fudged number from subreddit.py for obscurity. Rewords the default text, and title text of the metric. Adds a "fudged" class to the block so that low values can be hidden through CSS.
This commit is contained in:
@@ -557,6 +557,8 @@ class SubredditInfoBar(CachedTemplate):
|
||||
# so the menus cache properly
|
||||
self.path = request.path
|
||||
|
||||
self.accounts_active, self.accounts_active_fuzzed = self.sr.get_accounts_active()
|
||||
|
||||
if c.user_is_loggedin and c.user.pref_show_flair:
|
||||
self.flair_prefs = FlairPrefs()
|
||||
else:
|
||||
|
||||
@@ -275,7 +275,7 @@ plurals = PluralManager([P_("comment", "comments"),
|
||||
P_("subscriber", "subscribers"),
|
||||
P_("approved submitter", "approved submitters"),
|
||||
P_("moderator", "moderators"),
|
||||
P_("user online", "users online"),
|
||||
P_("user here now", "users here now"),
|
||||
|
||||
# time words
|
||||
P_("milliseconds","milliseconds"),
|
||||
@@ -325,8 +325,8 @@ class Score(object):
|
||||
return strings.number_label % dict(num=x, thing=f(x))
|
||||
|
||||
@staticmethod
|
||||
def users_online(x, prepend=''):
|
||||
return Score._people(x, plurals.N_users_online, prepend=prepend)
|
||||
def users_here_now(x, prepend=''):
|
||||
return Score._people(x, plurals.N_users_here_now, prepend=prepend)
|
||||
|
||||
@staticmethod
|
||||
def none(x):
|
||||
|
||||
@@ -36,12 +36,8 @@
|
||||
|
||||
${addremove_button(thing.sr)}
|
||||
<span class="subscribers">${unsafe(Score.readers(thing.subscribers))}</span>
|
||||
<p class="users-online" title="${_('number of logged-in users in the past 15 minutes')}">
|
||||
%if thing.sr.accounts_active < 100 and not c.user_is_admin:
|
||||
${unsafe(Score.users_online(100, prepend='<'))}
|
||||
%else:
|
||||
${unsafe(Score.users_online(thing.sr.accounts_active))}
|
||||
%endif
|
||||
<p class="users-online ${'fuzzed' if thing.accounts_active_fuzzed else ''}" title="${_('logged-in users viewing this subreddit in the past 15 minutes')}">
|
||||
${unsafe(Score.users_here_now(thing.accounts_active, prepend='~' if thing.accounts_active_fuzzed else ''))}
|
||||
</p>
|
||||
|
||||
%if thing.sr.moderator:
|
||||
|
||||
Reference in New Issue
Block a user