inactive users

This commit is contained in:
metamuffin 2024-11-13 21:10:29 +01:00
parent 940e177437
commit 771646a2b3
No known key found for this signature in database
GPG key ID: 718F9749DCDBD654
2 changed files with 14 additions and 3 deletions

View file

@ -544,9 +544,10 @@ local function r_users(show_special)
end end
print([[<div class="userlist"></div>]]) -- for printing print([[<div class="userlist"></div>]]) -- for printing
print([[<ul class="userlist">]]) print([[<ul class="userlist">]])
for _, user in ipairs(get_active_users()) do local show_user = function(user)
local is_spu = user.name:sub(1, 1) == "@" local is_spu = user.name:sub(1, 1) == "@"
if is_spu == show_special then local filter_out = query.prefix ~= nil and user.name:sub(1,1) ~= query.prefix
if is_spu == show_special and not filter_out then
print(format([[<li> print(format([[<li>
<a href="/{username_url}"> <a href="/{username_url}">
<span class="name">{!username}</span> <span class="name">{!username}</span>
@ -559,7 +560,16 @@ local function r_users(show_special)
})) }))
end end
end end
local inactive_cutoff = os.time() - (tonumber(config.inactive_cutoff) or (30 * 24 * 60 * 60))
for _, user in ipairs(get_active_users()) do
if user.time > inactive_cutoff then show_user(user) end
end
print("</ul>") print("</ul>")
print(format([[<details><summary>{+users.inactive_list}</summary><ul class="userlist">]]))
for _, user in ipairs(get_active_users()) do
if user.time <= inactive_cutoff then show_user(user) end
end
print([[</ul></details>]])
end) end)
end end

View file

@ -66,3 +66,4 @@ error.invalid_price=Price invalid
error.invalid_name=Name invalid error.invalid_name=Name invalid
error.open_products=Failed to open products file error.open_products=Failed to open products file
error.no_path=No path error.no_path=No path
users.inactive_list=Inactive Users