fixing lazy deletion check

This commit is contained in:
Luke Miller 2021-05-09 17:43:24 -04:00
parent 23f6455a89
commit ac8bb432e0

View File

@ -58,10 +58,12 @@ end
function modpol.orgs:list_request()
local str
for id, req in ipairs(self.requests) do
if str then
str = str .. '\n' .. req.type .. ' (' .. req.user .. ') '
else
str = req.type .. ' (' .. req.user .. ') '
if req ~= "deleted" then
if str then
str = str .. '\n' .. req.type .. ' (' .. req.user .. ') '
else
str = req.type .. ' (' .. req.user .. ') '
end
end
end
return str
@ -74,15 +76,20 @@ function modpol.orgs:resolve_request(request_id, approve)
local request = self.requests[request_id]
local p = request.params
if request.type == "add_org" then
self:add_org(p[1])
elseif request.type == "delete" then
self:delete()
elseif request.type == "add_member" then
self:add_member(p[1])
elseif request.type == "remove_member" then
self:remove_member(p[1])
end
-- there's probably a way to clean this up, the issue is the varying number of commands
-- ex: self['add_member'](self, 'member_name')
-- not sure if this is safe, more testing to do
self[request.type](self, p[1], p[2], p[3])
-- if request.type == "add_org" then
-- self:add_org(p[1])
-- elseif request.type == "delete" then
-- self:delete()
-- elseif request.type == "add_member" then
-- self:add_member(p[1])
-- elseif request.type == "remove_member" then
-- self:remove_member(p[1])
-- end
end
@ -124,7 +131,7 @@ function modpol.orgs:make_request(request)
-- tries to use org's policy table, defers to parent otherwise
if not requested_policy then
modpol.ocutil.log(request.type .. 'policy not found, deferring to parent org')
modpol.ocutil.log(request.type .. ' policy not found, deferring to parent org')
requested_policy = parent_policy
if not parent_policy then