mirror of
https://github.com/ae-utbm/sith3.git
synced 2024-06-14 02:31:58 +00:00
black
This commit is contained in:
parent
f8903cbdca
commit
2126b1aef3
|
@ -78,16 +78,20 @@ class Picture(SithFile):
|
|||
# Result is cached 4s for this user
|
||||
if user.is_anonymous:
|
||||
return False
|
||||
|
||||
|
||||
perm = cache.get("%d_can_view_pictures" % (user.id), False)
|
||||
|
||||
|
||||
# use cache only when user is in SAS Admins or when picture is moderated
|
||||
if perm and (self.is_moderated or self.can_be_edited_by(user)):
|
||||
return perm
|
||||
|
||||
perm = self.is_in_sas and (self.is_moderated or self.can_be_edited_by(user)) and user.was_subscribed
|
||||
|
||||
perm = (
|
||||
self.is_in_sas
|
||||
and (self.is_moderated or self.can_be_edited_by(user))
|
||||
and user.was_subscribed
|
||||
)
|
||||
cache.set("%d_can_view_pictures" % (user.id), perm, timeout=4)
|
||||
|
||||
|
||||
return perm
|
||||
|
||||
def get_download_url(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user