Commit c7edbb95 authored by Ted Trask's avatar Ted Trask

Fix listmessages HTML view to use new listusers format to determine forwarding destinations

parent 00b01926
......@@ -7,15 +7,17 @@ html = require("acf.html")
local useroptions = {{value="", label=""}}
if viewlibrary.check_permission("listusers") and (viewlibrary.check_permission("forwardmessage") or viewlibrary.check_permission("forwardmymessage")) then
local users = viewlibrary.dispatch_component("listusers", nil, true)
for i,v in ipairs(users.value) do
v.firstname = v.firstname or ""
v.lastname = v.lastname or ""
v.username = v.username or ""
end
table.sort(users.value, function(a,b) if a.firstname ~= b.firstname then return a.firstname < b.firstname elseif a.lastname ~= b.lastname then return a.lastname < b.lastname else return a.username < b.username end end)
for i,u in ipairs(users.value) do
if u.username ~= session.userinfo.userid then
useroptions[#useroptions+1] = {value=u.username, label=u.firstname..' '..u.lastname..' ('..u.username..')'}
if users.value and users.value.result then
for i,v in ipairs(users.value.result.value) do
v.firstname = v.firstname or ""
v.lastname = v.lastname or ""
v.username = v.username or ""
end
table.sort(users.value.result.value, function(a,b) if a.firstname ~= b.firstname then return a.firstname < b.firstname elseif a.lastname ~= b.lastname then return a.lastname < b.lastname else return a.username < b.username end end)
for i,u in ipairs(users.value.result.value) do
if u.username ~= session.userinfo.userid then
useroptions[#useroptions+1] = {value=u.username, label=u.firstname..' '..u.lastname..' ('..u.username..')'}
end
end
end
end
......
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