diff --git a/r2/r2/lib/template_helpers.py b/r2/r2/lib/template_helpers.py index 8f68e21c6..cde44e0a8 100755 --- a/r2/r2/lib/template_helpers.py +++ b/r2/r2/lib/template_helpers.py @@ -22,7 +22,7 @@ from r2.models import * from filters import unsafe, websafe, _force_unicode, _force_utf8 -from r2.lib.utils import vote_hash, UrlParser, timesince, is_subdomain +from r2.lib.utils import UrlParser, timesince, is_subdomain from r2.lib import hooks from r2.lib.static import static_mtime @@ -162,6 +162,7 @@ def js_config(extra_config=None): "uitracker_url": g.uitracker_url, "static_root": static(''), "over_18": bool(c.over18), + "vote_hash": c.vote_hash, } if extra_config: @@ -280,10 +281,6 @@ def replace_render(listing, item, render_func): replacements["midcolmargin"] = mid_margin - #$votehash is only present when voting arrows are present - if c.user_is_loggedin: - replacements['votehash'] = vote_hash(c.user, item, - listing.vote_hash_type) if hasattr(item, "num_comments"): com_label, com_cls = comment_label(item.num_comments) if style == "compact": diff --git a/r2/r2/models/listing.py b/r2/r2/models/listing.py index 752bf555e..137cbffb3 100644 --- a/r2/r2/models/listing.py +++ b/r2/r2/models/listing.py @@ -39,7 +39,7 @@ class Listing(object): _js_cls = "Listing" def __init__(self, builder, nextprev = True, next_link = True, - prev_link = True, vote_hash_type = 'valid', **kw): + prev_link = True, **kw): self.builder = builder self.nextprev = nextprev self.next_link = True @@ -47,7 +47,6 @@ class Listing(object): self.next = None self.prev = None self._max_num = 1 - self.vote_hash_type = vote_hash_type @property def max_score(self): @@ -138,7 +137,6 @@ class SpotlightListing(Listing): _js_cls = "OrganicListing" def __init__(self, *a, **kw): - self.vote_hash_type = kw.get('vote_hash_type', 'organic') self.nextprev = False self.show_nums = True self._parent_max_num = kw.get('max_num', 0) diff --git a/r2/r2/models/printable.py b/r2/r2/models/printable.py index b134be959..7e6770623 100755 --- a/r2/r2/models/printable.py +++ b/r2/r2/models/printable.py @@ -46,7 +46,7 @@ class Printable(object): 'downvotes', '_downs', 'subreddit_slow', '_deleted', '_spam', 'cachable', 'make_permalink', 'permalink', - 'timesince', 'votehash' + 'timesince', ]) @classmethod @@ -57,7 +57,6 @@ class Printable(object): # caching of thing templates item.display = CachedVariable("display") item.timesince = CachedVariable("timesince") - item.votehash = CachedVariable("votehash") item.childlisting = CachedVariable("childlisting") score_fmt = getattr(item, "score_fmt", Score.number_only) diff --git a/r2/r2/templates/frametoolbar.compact b/r2/r2/templates/frametoolbar.compact index 3f2e39523..7dfe00f86 100644 --- a/r2/r2/templates/frametoolbar.compact +++ b/r2/r2/templates/frametoolbar.compact @@ -31,7 +31,7 @@ title="${_('vote %(direction)s') % dict(direction=direction)}" %if thing.user_is_loggedin: href="javascript:void(0);" - onclick="$(this).vote('${thing.votehash}', null, event)" + onclick="$(this).vote(r.config.vote_hash, null, event)" %else: href="${thing.loginurl}" target="_top" diff --git a/r2/r2/templates/frametoolbar.html b/r2/r2/templates/frametoolbar.html index 20f5e0a67..e5211441a 100644 --- a/r2/r2/templates/frametoolbar.html +++ b/r2/r2/templates/frametoolbar.html @@ -170,7 +170,7 @@ title="${_('vote %(direction)s') % dict(direction=direction)}" %if thing.user_is_loggedin: href="javascript:void(0);" - onclick="$(this).vote('${thing.votehash}', null, event)" + onclick="$(this).vote(r.config.vote_hash, null, event)" %else: href="${thing.loginurl}" target="_top" diff --git a/r2/r2/templates/printable.html b/r2/r2/templates/printable.html index 1c371377a..e2e4dbd19 100644 --- a/r2/r2/templates/printable.html +++ b/r2/r2/templates/printable.html @@ -153,7 +153,7 @@ ${self.RenderPrintable()} %>