diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-05-25 19:06:05 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-05-25 19:06:05 +0100 |
commit | fb2552ab558b227f03a3b092eeb6a5f7bc406900 (patch) | |
tree | b15887f939528d1239e1c5080f93aedcded2f690 /app/models.py | |
parent | 53df124973c15b90e070f9225fcbeccdb0e64e55 (diff) | |
download | cheatdb-fb2552ab558b227f03a3b092eeb6a5f7bc406900.tar.xz |
Finish screenshot approval feature
Diffstat (limited to 'app/models.py')
-rw-r--r-- | app/models.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models.py b/app/models.py index e8b66fb..aa67c6a 100644 --- a/app/models.py +++ b/app/models.py @@ -83,7 +83,8 @@ class Permission(enum.Enum): if self == Permission.APPROVE_NEW or \ self == Permission.APPROVE_CHANGES or \ - self == Permission.APPROVE_RELEASE: + self == Permission.APPROVE_RELEASE or \ + self == Permission.APPROVE_SCREENSHOT: return user.rank.atLeast(UserRank.EDITOR) else: raise Exception("Non-global permission checked globally. Use Package.checkPerm or User.checkPerm instead.") @@ -353,7 +354,7 @@ class Package(db.Model): author=self.author.username, name=self.name) def getMainScreenshotURL(self): - screenshot = self.screenshots.first() + screenshot = self.screenshots.filter_by(approved=True).first() return screenshot.url if screenshot is not None else None def getDownloadRelease(self): |