mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 07:48:16 -05:00
ServerSecondsBar can be made public.
This commit is contained in:
@@ -342,6 +342,9 @@ def make_map():
|
||||
mc('/api/recommend/sr/:srnames', controller='api',
|
||||
action='subreddit_recommendations')
|
||||
|
||||
mc('/api/server_seconds_visibility', controller='api',
|
||||
action='server_seconds_visibility')
|
||||
|
||||
mc("/api/multi/mine", controller="multiapi", action="my_multis")
|
||||
mc("/api/multi/copy", controller="multiapi", action="multi_copy")
|
||||
mc("/api/multi/rename", controller="multiapi", action="multi_rename")
|
||||
|
||||
@@ -3616,3 +3616,17 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
to_omit=to_omit.values())
|
||||
sr_data = [{'sr_name': sr.name} for sr in rec_srs]
|
||||
return json.dumps(sr_data)
|
||||
|
||||
|
||||
@validatedForm(
|
||||
VUser(),
|
||||
VModhash(),
|
||||
seconds_visibility=VOneOf(
|
||||
"seconds_visibility",
|
||||
("public", "private"),
|
||||
default="private",
|
||||
),
|
||||
)
|
||||
def POST_server_seconds_visibility(self, form, jquery, seconds_visibility):
|
||||
c.user.pref_public_server_seconds = seconds_visibility == "public"
|
||||
c.user._commit()
|
||||
|
||||
6
r2/r2/lib/pages/pages.py
Executable file → Normal file
6
r2/r2/lib/pages/pages.py
Executable file → Normal file
@@ -1607,7 +1607,8 @@ class ProfilePage(Reddit):
|
||||
from admin_pages import SponsorSidebar
|
||||
rb.push(SponsorSidebar(self.user))
|
||||
|
||||
if c.user == self.user or c.user.employee:
|
||||
if (c.user == self.user or c.user.employee or
|
||||
self.user.pref_public_server_seconds):
|
||||
seconds_bar = ServerSecondsBar(self.user)
|
||||
if seconds_bar.message:
|
||||
rb.push(seconds_bar)
|
||||
@@ -1722,6 +1723,9 @@ class ServerSecondsBar(Templated):
|
||||
def __init__(self, user):
|
||||
Templated.__init__(self)
|
||||
|
||||
self.is_public = user.pref_public_server_seconds
|
||||
self.is_user = c.user == user
|
||||
|
||||
seconds = 0.
|
||||
gold_payments = gold_payments_by_user(user)
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ class Account(Thing):
|
||||
pref_highlight_new_comments = True,
|
||||
pref_monitor_mentions=True,
|
||||
pref_collapse_left_bar=False,
|
||||
pref_public_server_seconds=False,
|
||||
mobile_compress = False,
|
||||
mobile_thumbnail = True,
|
||||
trusted_sponsor = False,
|
||||
|
||||
@@ -6362,6 +6362,24 @@ body:not(.gold) .allminus-link {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.server-seconds-public label {
|
||||
margin: 0 5px;
|
||||
position: relative;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.server-seconds-public.bottom {
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.server-seconds-public .title {
|
||||
float: left;
|
||||
padding-left: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.comment-visits-box .title {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
|
||||
@@ -20,9 +20,28 @@
|
||||
## reddit Inc. All Rights Reserved.
|
||||
###############################################################################
|
||||
|
||||
<%namespace file="utils.html" import="inline_radio_type"/>
|
||||
|
||||
<div class="titlebox">
|
||||
<div class="server-seconds rounded">
|
||||
${thing.message}
|
||||
%if thing.is_user:
|
||||
<div class="server-seconds-public bottom">
|
||||
<div class="title">${_("visible to:")}</div>
|
||||
<form id="seconds_visibility_form">
|
||||
${inline_radio_type("seconds_visibility", "private", _("only me"), checked=not thing.is_public)}
|
||||
${inline_radio_type("seconds_visibility", "public", _("everyone"), checked=thing.is_public)}
|
||||
</form>
|
||||
</div>
|
||||
%endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('[name="seconds_visibility"]').click(
|
||||
function () {
|
||||
var form = $('#seconds_visibility_form');
|
||||
post_form(form, 'server_seconds_visibility');
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user