Mercurial > prosody-modules
changeset 4990:d55b10878e43
mod_http_muc_log: Rename variable for improved clarity
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 16 Aug 2022 01:34:27 +0200 |
parents | b74d592df9e2 |
children | b17d63ef5bdf |
files | mod_http_muc_log/mod_http_muc_log.lua mod_http_muc_log/res/http_muc_log.html |
diffstat | 2 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua Tue Aug 16 01:27:59 2022 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Tue Aug 16 01:34:27 2022 +0200 @@ -305,7 +305,7 @@ end local first, last; - for key, item, when in iter do + for archive_id, item, when in iter do local body_tag = item:get_child("body"); local body = body_tag and body_tag:get_text(); local subject = item:get_child_text("subject"); @@ -348,10 +348,10 @@ if edit then local found = false; for n = i-1, 1, -1 do - if logs[n].id == edit and nick == logs[n].nick then + if logs[n].message_id == edit and nick == logs[n].nick then found = true; - logs[n].edited = key; - edit = logs[n].key; + logs[n].edited = archive_id; + edit = logs[n].archive_id; break; end end @@ -367,7 +367,7 @@ -- COMPAT Movim uses an @to attribute instead of the correct @id local target_id = reactions.attr.id or reactions.attr.to; for n = i - 1, 1, -1 do - if logs[n].key == target_id then + if logs[n].archive_id == target_id then local react_map = logs[n].reactions; -- { string : integer } if not react_map then react_map = {}; @@ -389,8 +389,8 @@ if body or verb or oob then local line = { - id = item.attr.id, - key = key; + message_id = item.attr.id; + archive_id = archive_id; datetime = datetime.datetime(when); time = datetime.time(when); verb = verb; @@ -401,6 +401,8 @@ st_type = item.attr.type; edit = edit; reply = reply and reply.attr.id; + -- COMPAT + key = archive_id; }; if oob then line.oob = { @@ -411,8 +413,8 @@ logs[i], i = line, i + 1; end - first = first or key; - last = key; + first = first or archive_id; + last = archive_id; end if i == 1 and not lazy then return end -- No items
--- a/mod_http_muc_log/res/http_muc_log.html Tue Aug 16 01:27:59 2022 +0200 +++ b/mod_http_muc_log/res/http_muc_log.html Tue Aug 16 01:34:27 2022 +0200 @@ -110,8 +110,8 @@ </div> <ol class="chat-logs">{lines# -<li {item.lang&lang="{item.lang}"} class="{item.st_name} {item.st_type?} {item.edited&edited}" id="{item.key}"> -<a class="time" href="#{item.key}"><time id="{item.time}" datetime="{item.datetime}">{item.time}</time></a> +<li {item.lang&lang="{item.lang}"} class="{item.st_name} {item.st_type?} {item.edited&edited}" id="{item.archive_id}"> +<a class="time" href="#{item.archive_id}"><time id="{item.time}" datetime="{item.datetime}">{item.time}</time></a> <b class="nick">{item.nick}</b> <em class="verb">{item.verb?}</em> <q class="body">{item.edited&<del>}{item.body?}{item.edited&</del> <a href="#{item.edited}" title="jump to corrected version">✎</a>}{item.edit& <a href="#{item.edit}" title="jump to previous version">✏</a>}{item.reply& <a href="#{item.reply}" title="jump to message responded to">↺</a>}</q>