Skip to content

Commit

Permalink
links in admin logs
Browse files Browse the repository at this point in the history
  • Loading branch information
trinkey committed Oct 13, 2024
1 parent f810a4b commit e5419f1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion smiggins/backend/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def logs(request) -> tuple | dict:
"target": i.uname_for or (i.u_for and i.u_for.username),
"info": i.info,
"timestamp": i.timestamp
} for i in AdminLog.objects.all()]
} for i in AdminLog.objects.all()][::-1]
}

return 400, {
Expand Down
4 changes: 2 additions & 2 deletions smiggins/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@
"action": "Action",
"who": "Who",
"more_info": "More Info",
"who_format": "Done by @%1, at @%2",
"who_format_single": "Done by @%1"
"who_format": "Done by %1, at %2",
"who_format_single": "Done by %1"
}
},

Expand Down
2 changes: 1 addition & 1 deletion smiggins/static/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ testMask(Mask.ReadLogs) && dom("debug-button").addEventListener("click", functio
output += `<tr>
<td class="nowrap">${timeSince(+line.timestamp)}</td>
<td class="nowrap">${line.type}</td>
<td>${(lang.admin.logs[line.target ? "who_format" : "who_format_single"].replaceAll("%1", line.by).replaceAll("%2", line.target)).replaceAll(" ", "&nbsp;").replaceAll(",&nbsp;", ", ")}</td>
<td>${lang.admin.logs[line.target ? "who_format" : "who_format_single"].replaceAll(" ", "&nbsp;").replaceAll(",&nbsp;", ", ").replaceAll("%1", `<a href="/u/${line.by}">@${line.by}</a>`).replaceAll("%2", `<a href="/u/${line.target}">@${line.target}</a>`)}</td>
<td>${escapeHTML(line.info)}</td>
</tr>`;
}
Expand Down
2 changes: 1 addition & 1 deletion smiggins/static/ts/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ testMask(Mask.ReadLogs) && dom("debug-button").addEventListener("click", functio
output += `<tr>
<td class="nowrap">${timeSince(+line.timestamp)}</td>
<td class="nowrap">${line.type}</td>
<td>${(lang.admin.logs[line.target ? "who_format" : "who_format_single"].replaceAll("%1", line.by).replaceAll("%2", line.target)).replaceAll(" ", "&nbsp;").replaceAll(",&nbsp;", ", ")}</td>
<td>${lang.admin.logs[line.target ? "who_format" : "who_format_single"].replaceAll(" ", "&nbsp;").replaceAll(",&nbsp;", ", ").replaceAll("%1", `<a href="/u/${line.by}">@${line.by}</a>`).replaceAll("%2", `<a href="/u/${line.target}">@${line.target}</a>`)}</td>
<td>${escapeHTML(line.info)}</td>
</tr>`;
} catch(err) {
Expand Down

0 comments on commit e5419f1

Please sign in to comment.