Browse Source

Added failsafes to interactions against 'deleted' processes

Nathan Schneider 2 years ago
parent
commit
65bb1aa532

+ 7 - 5
modpol_core/interactions/interactions.lua

@@ -175,13 +175,15 @@ function modpol.interactions.org_dashboard(user, org_string)
       local processes = {}
       print("All processes: (* indicates pending)")
       for i,v in ipairs(org.processes) do
-         local active = ''
-         if org.pending[user] then
-            if org.pending[user][v.id] then
-               active = '*'
+         if v ~= "deleted" then
+            local active = ''
+            if org.pending[user] then
+               if org.pending[user][v.id] then
+                  active = '*'
+               end
             end
+            print("["..v.id.."] "..v.slug..active)
          end
-         print("["..v.id.."] "..v.slug..active)
       end
       print()
       print("Interact with which one (use [id] number)?")

+ 6 - 4
modpol_minetest/overrides/interactions.lua

@@ -161,10 +161,12 @@ function modpol.interactions.org_dashboard(user, org_string)
    local num_pending = 0
    if org.pending[user] then
       for k,v in pairs(org.pending[user]) do
-         local pending_string = org.processes[k].name
-            .." ["..k.."]"
-         table.insert(pending, pending_string)
-         num_pending = num_pending + 1
+         if org.processes[k] ~= "deleted" then
+            local pending_string = org.processes[k].name
+               .." ["..k.."]"
+            table.insert(pending, pending_string)
+            num_pending = num_pending + 1
+         end
       end
    end
    table.sort(pending)