mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-11 07:27:36 +01:00
Fix broken release auto-approval due to permissions check
This commit is contained in:
parent
c1b4256d44
commit
99a8f3d5d6
@ -686,7 +686,10 @@ class Package(db.Model):
|
|||||||
return user.rank.atLeast(UserRank.EDITOR)
|
return user.rank.atLeast(UserRank.EDITOR)
|
||||||
|
|
||||||
elif perm == Permission.APPROVE_SCREENSHOT:
|
elif perm == Permission.APPROVE_SCREENSHOT:
|
||||||
return user.rank.atLeast(UserRank.TRUSTED_MEMBER if isOwner else UserRank.EDITOR)
|
if isOwner:
|
||||||
|
return user.rank.atLeast(UserRank.TRUSTED_MEMBER if self.approved else UserRank.NEW_MEMBER)
|
||||||
|
else:
|
||||||
|
return user.rank.atLeast(UserRank.EDITOR)
|
||||||
|
|
||||||
# Moderators can delete packages
|
# Moderators can delete packages
|
||||||
elif perm == Permission.DELETE_PACKAGE or perm == Permission.UNAPPROVE_PACKAGE \
|
elif perm == Permission.DELETE_PACKAGE or perm == Permission.UNAPPROVE_PACKAGE \
|
||||||
@ -848,8 +851,7 @@ class PackageRelease(db.Model):
|
|||||||
self.releaseDate = datetime.datetime.now()
|
self.releaseDate = datetime.datetime.now()
|
||||||
|
|
||||||
def approve(self, user):
|
def approve(self, user):
|
||||||
if self.package.approved or \
|
if not self.package.checkPerm(user, Permission.APPROVE_RELEASE):
|
||||||
not self.package.checkPerm(user, Permission.APPROVE_RELEASE):
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
assert self.task_id is None and self.url is not None and self.url != ""
|
assert self.task_id is None and self.url is not None and self.url != ""
|
||||||
|
Loading…
Reference in New Issue
Block a user