From ad2d41f7e7bd5d2006bbb0bedebd0333cf66cd1f Mon Sep 17 00:00:00 2001 From: Ricky Ramirez Date: Thu, 8 Aug 2013 14:21:02 -0700 Subject: [PATCH] Allow all employees to distinguish as admin. --- r2/r2/lib/pages/things.py | 5 ++++- r2/r2/lib/validator/validator.py | 6 +++--- r2/r2/templates/printablebuttons.html | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/r2/r2/lib/pages/things.py b/r2/r2/lib/pages/things.py index bf347802b..5efdfd2b8 100644 --- a/r2/r2/lib/pages/things.py +++ b/r2/r2/lib/pages/things.py @@ -96,7 +96,10 @@ class LinkButtons(PrintableButtons): # do we show the distinguish button? among other things, # we never want it to appear on link listings -- only # comments pages - show_distinguish = (is_author and (thing.can_ban or c.user_special_distinguish) + show_distinguish = (is_author and + (thing.can_ban or # Moderator distinguish + c.user.employee or # Admin distinguish + c.user_special_distinguish) and getattr(thing, "expand_children", False)) kw = {} diff --git a/r2/r2/lib/validator/validator.py b/r2/r2/lib/validator/validator.py index 6cb6f60b8..c183f1cf0 100644 --- a/r2/r2/lib/validator/validator.py +++ b/r2/r2/lib/validator/validator.py @@ -934,9 +934,7 @@ class VSrModerator(Validator): class VCanDistinguish(VByName): def run(self, thing_name, how): - if c.user_is_admin: - return True - elif c.user_is_loggedin: + if c.user_is_loggedin: item = VByName.run(self, thing_name) if item.author_id == c.user._id: # will throw a legitimate 500 if this isn't a link or @@ -947,6 +945,8 @@ class VCanDistinguish(VByName): return True elif how in ("special", "no") and c.user_special_distinguish: return True + elif how in ("admin", "no") and c.user.employee: + return True abort(403,'forbidden') diff --git a/r2/r2/templates/printablebuttons.html b/r2/r2/templates/printablebuttons.html index b1ffd02a6..c83360577 100644 --- a/r2/r2/templates/printablebuttons.html +++ b/r2/r2/templates/printablebuttons.html @@ -99,7 +99,7 @@ ${distinguish_setter('no')} - %if c.user_is_admin: + %if c.user.employee: / ${distinguish_setter('admin')}