Commit 2919f3a1 authored by Skia's avatar Skia
Browse files

Allow former subscribers to see pictures

parent 7be4f004
Pipeline #495 passed with stage
in 2 minutes and 37 seconds
...@@ -195,6 +195,9 @@ class User(AbstractBaseUser): ...@@ -195,6 +195,9 @@ class User(AbstractBaseUser):
def to_dict(self): def to_dict(self):
return self.__dict__ return self.__dict__
def was_subscribed(self):
return self.subscriptions.exists()
def is_subscribed(self): def is_subscribed(self):
s = self.subscriptions.last() s = self.subscriptions.last()
return s.is_valid_now() if s is not None else False return s.is_valid_now() if s is not None else False
......
...@@ -28,7 +28,7 @@ class Picture(SithFile): ...@@ -28,7 +28,7 @@ class Picture(SithFile):
def can_be_viewed_by(self, user): def can_be_viewed_by(self, user):
return self.can_be_edited_by(user) or (self.is_in_sas and self.is_moderated and return self.can_be_edited_by(user) or (self.is_in_sas and self.is_moderated and
user.is_in_group(settings.SITH_MAIN_MEMBERS_GROUP)) user.was_subscribed())
def get_download_url(self): def get_download_url(self):
return reverse('sas:download', kwargs={'picture_id': self.id}) return reverse('sas:download', kwargs={'picture_id': self.id})
...@@ -90,9 +90,8 @@ class Album(SithFile): ...@@ -90,9 +90,8 @@ class Album(SithFile):
return user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) return user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID)
def can_be_viewed_by(self, user): def can_be_viewed_by(self, user):
print(self.is_in_sas)
return self.can_be_edited_by(user) or (self.is_in_sas and self.is_moderated and return self.can_be_edited_by(user) or (self.is_in_sas and self.is_moderated and
user.is_in_group(settings.SITH_MAIN_MEMBERS_GROUP)) user.was_subscribed())
def get_absolute_url(self): def get_absolute_url(self):
return reverse('sas:album', kwargs={'album_id': self.id}) return reverse('sas:album', kwargs={'album_id': self.id})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment