mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-01 07:35:17 +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
|
# Result is cached 4s for this user
|
||||||
if user.is_anonymous:
|
if user.is_anonymous:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
perm = cache.get("%d_can_view_pictures" % (user.id), 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
|
# 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)):
|
if perm and (self.is_moderated or self.can_be_edited_by(user)):
|
||||||
return perm
|
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)
|
cache.set("%d_can_view_pictures" % (user.id), perm, timeout=4)
|
||||||
|
|
||||||
return perm
|
return perm
|
||||||
|
|
||||||
def get_download_url(self):
|
def get_download_url(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user