mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-15 01:48:18 -05:00
Remove public uses of "liked" and "disliked"
Replacing with "upvoted" and "downvoted" everywhere respectively. This keeps the /liked and /disliked paths for user pages working for API clients, but does a 301 redirect for non-API clients.
This commit is contained in:
@@ -739,8 +739,8 @@ class UserController(ListingController):
|
||||
'comments': _("comments by %(user)s"),
|
||||
'submitted': _("submitted by %(user)s"),
|
||||
'gilded': _("gilded by %(user)s"),
|
||||
'liked': _("liked by %(user)s"),
|
||||
'disliked': _("disliked by %(user)s"),
|
||||
'upvoted': _("upvoted by %(user)s"),
|
||||
'downvoted': _("downvoted by %(user)s"),
|
||||
'saved': _("saved by %(user)s"),
|
||||
'hidden': _("hidden by %(user)s"),
|
||||
'promoted': _("promoted by %(user)s")}
|
||||
@@ -760,10 +760,10 @@ class UserController(ListingController):
|
||||
return False
|
||||
|
||||
if c.user == self.vuser:
|
||||
if not item.likes and self.where == 'liked':
|
||||
if not item.likes and self.where == 'upvoted':
|
||||
g.stats.simple_event("vote.missing_votes_by_account")
|
||||
return False
|
||||
if item.likes is not False and self.where == 'disliked':
|
||||
if item.likes is not False and self.where == 'downvoted':
|
||||
g.stats.simple_event("vote.missing_votes_by_account")
|
||||
return False
|
||||
if self.where == 'saved' and not item.saved:
|
||||
@@ -810,10 +810,10 @@ class UserController(ListingController):
|
||||
else:
|
||||
q = queries.get_gilded_user(self.vuser)
|
||||
|
||||
elif self.where in ('liked', 'disliked'):
|
||||
elif self.where in ('upvoted', 'downvoted'):
|
||||
sup.set_sup_header(self.vuser, self.where)
|
||||
self.check_modified(self.vuser, self.where)
|
||||
if self.where == 'liked':
|
||||
if self.where == 'upvoted':
|
||||
q = queries.get_liked(self.vuser)
|
||||
else:
|
||||
q = queries.get_disliked(self.vuser)
|
||||
@@ -851,9 +851,22 @@ class UserController(ListingController):
|
||||
@listing_api_doc(section=api_section.users, uri='/user/{username}/{where}',
|
||||
uri_variants=['/user/{username}/' + where for where in [
|
||||
'overview', 'submitted', 'comments',
|
||||
'liked', 'disliked', 'hidden', 'saved',
|
||||
'gilded']])
|
||||
'upvoted', 'downvoted', 'hidden',
|
||||
'saved', 'gilded']])
|
||||
def GET_listing(self, where, vuser, sort, time, show, **env):
|
||||
# continue supporting /liked and /disliked paths for API clients
|
||||
# but 301 redirect non-API users to the new location
|
||||
changed_wheres = {"liked": "upvoted", "disliked": "downvoted"}
|
||||
new_where = changed_wheres.get(where)
|
||||
if new_where:
|
||||
where = new_where
|
||||
if not is_api():
|
||||
path = "/".join(("/user", vuser.name, where))
|
||||
query_string = request.environ.get('QUERY_STRING')
|
||||
if query_string:
|
||||
path += "?" + query_string
|
||||
return self.redirect(path, code=301)
|
||||
|
||||
self.where = where
|
||||
self.sort = sort
|
||||
self.time = time
|
||||
@@ -881,7 +894,7 @@ class UserController(ListingController):
|
||||
c.user_is_sponsor and where == "promoted")):
|
||||
return self.abort404()
|
||||
|
||||
if where in ('liked', 'disliked') and not votes_visible(vuser):
|
||||
if where in ('upvoted', 'downvoted') and not votes_visible(vuser):
|
||||
return self.abort403()
|
||||
|
||||
if ((where in ('saved', 'hidden') or
|
||||
|
||||
@@ -163,8 +163,8 @@ menu = MenuHandler(hot = _('hot'),
|
||||
|
||||
overview = _("overview"),
|
||||
submitted = _("submitted"),
|
||||
liked = _("liked"),
|
||||
disliked = _("disliked"),
|
||||
upvoted = _("upvoted"),
|
||||
downvoted = _("downvoted"),
|
||||
hidden = _("hidden {toolbar}"),
|
||||
deleted = _("deleted"),
|
||||
reported = _("reported"),
|
||||
|
||||
@@ -2086,9 +2086,11 @@ class ProfilePage(Reddit):
|
||||
NamedButton('gilded')]
|
||||
|
||||
if votes_visible(self.user):
|
||||
main_buttons += [NamedButton('liked'),
|
||||
NamedButton('disliked'),
|
||||
NamedButton('hidden')]
|
||||
main_buttons += [
|
||||
NamedButton('upvoted'),
|
||||
NamedButton('downvoted'),
|
||||
NamedButton('hidden'),
|
||||
]
|
||||
|
||||
if c.user_is_loggedin and (c.user._id == self.user._id or
|
||||
c.user_is_admin):
|
||||
|
||||
@@ -178,8 +178,8 @@
|
||||
</%def>
|
||||
|
||||
%if getattr(thing, "votable", True):
|
||||
${arrow("up", thing.upstyle, _("like"))}
|
||||
${arrow("down", thing.downstyle, _("dislike"))}
|
||||
${arrow("up", thing.upstyle, _("upvote"))}
|
||||
${arrow("down", thing.downstyle, _("downvote"))}
|
||||
%endif
|
||||
</span>
|
||||
|
||||
|
||||
@@ -61,11 +61,11 @@ ${unsafe(safemarkdown(_("All feeds are invalidated if you change your password,
|
||||
<tr>
|
||||
<th>private profile pages</th>
|
||||
<td class="prefright">
|
||||
<%self:feedbuttons path="/user/${c.user.name}/liked"></%self:feedbuttons>
|
||||
${_("links you've liked")}
|
||||
<%self:feedbuttons path="/user/${c.user.name}/upvoted"></%self:feedbuttons>
|
||||
${_("links you've upvoted")}
|
||||
<br/>
|
||||
<%self:feedbuttons path="/user/${c.user.name}/disliked"></%self:feedbuttons>
|
||||
${_("links you've disliked")}
|
||||
<%self:feedbuttons path="/user/${c.user.name}/downvoted"></%self:feedbuttons>
|
||||
${_("links you've downvoted")}
|
||||
<br/>
|
||||
<%self:feedbuttons path="/user/${c.user.name}/hidden"></%self:feedbuttons>
|
||||
${_("links you've hidden")}
|
||||
|
||||
@@ -186,11 +186,11 @@
|
||||
${_("(such as the source subreddit or the content author's url/name)")}
|
||||
</span>
|
||||
</p>
|
||||
<p>${checkbox(_("don't show links after I've liked them"), "hide_ups")}
|
||||
<p>${checkbox(_("don't show me submissions after I've upvoted them"), "hide_ups")}
|
||||
 
|
||||
<span class="details">${_("(except my own)")}</span>
|
||||
</p>
|
||||
<p>${checkbox(_("don't show links after I've disliked them"), "hide_downs")}
|
||||
<p>${checkbox(_("don't show me submissions after I've downvoted them"), "hide_downs")}
|
||||
 
|
||||
<span class="details">${_("(except my own)")}</span>
|
||||
</p>
|
||||
@@ -315,8 +315,8 @@
|
||||
 
|
||||
<span class="details">
|
||||
<%
|
||||
link1 = format_html(' <a href="/user/%s/liked">/user/%s/liked</a> ', c.user.name, c.user.name)
|
||||
link2 = format_html(' <a href="/user/%s/disliked">/user/%s/disliked</a>', c.user.name, c.user.name)
|
||||
link1 = format_html(' <a href="/user/%s/upvoted">/user/%s/upvoted</a> ', c.user.name, c.user.name)
|
||||
link2 = format_html(' <a href="/user/%s/downvoted">/user/%s/downvoted</a>', c.user.name, c.user.name)
|
||||
%>
|
||||
(${_wsf("let everyone see %(link1)s and %(link2)s", link1=link1, link2=link2)})
|
||||
</span>
|
||||
|
||||
@@ -135,8 +135,8 @@ function update() {
|
||||
onfocus="this.parentNode.firstChild.checked='checked'">
|
||||
<option value="submitted">${_("submitted by")}</option>
|
||||
<option value="saved">${_("saved by")}</option>
|
||||
<option value="liked">${_("liked by")}</option>
|
||||
<option value="disliked">${_("disliked by")}</option>
|
||||
<option value="liked">${_("upvoted by")}</option>
|
||||
<option value="disliked">${_("downvoted by")}</option>
|
||||
</select>
|
||||
</%def>
|
||||
<%def name="text_input(name)" buffered="True">
|
||||
|
||||
Reference in New Issue
Block a user