summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-08-05 16:01:12 +0500
committerilotterytea <iltsu@alright.party>2025-08-05 16:01:12 +0500
commit928d59e3083a276989a7e79f5e1cd926906e2c41 (patch)
tree246f6256284e30659d94dc16784665f53fc5636c
parent1a7db44117f906cd549706761d8b40e12be18985 (diff)
feat: show the room where the message was sent
-rw-r--r--web/index.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/web/index.php b/web/index.php
index 7e28e06..3f4a87f 100644
--- a/web/index.php
+++ b/web/index.php
@@ -38,8 +38,9 @@ if (isset($room)) {
if (isset($date)) {
$user_id = $user ? $user['id'] : "m.user_id";
$room_id = $room ? $room['id'] : "m.room_id";
+ $room_column = !$room ? ", r.name AS room" : "";
- $stmt = $db->prepare("SELECT m.id, u.nick, m.command, m.params, m.tags, m.sent_at
+ $stmt = $db->prepare("SELECT m.id, u.nick, m.command, m.params, m.tags, m.sent_at $room_column
FROM messages m
JOIN rooms r ON r.id = m.room_id
JOIN users u ON u.id = m.user_id
@@ -123,6 +124,9 @@ if (!isset($user) && !isset($room)) {
<table>
<tr>
<th>Time</th>
+ <?php if (array_key_exists('room', $messages[0])): ?>
+ <th>Room</th>
+ <?php endif; ?>
<th>Nick</th>
<th>Message</th>
</tr>
@@ -131,6 +135,9 @@ if (!isset($user) && !isset($room)) {
<td class="datetime"><a
href="/?<?= $link ?>&d=<?= urlencode($date) ?>#msgid=<?= $m['id'] ?>"><?= date('H:i', strtotime($m['sent_at'])) ?></a>
</td>
+ <?php if (array_key_exists('room', $m)): ?>
+ <td class="room"><a href="/?r=<?= urlencode($m['room']) ?>"><?= $m['room'] ?></a></td>
+ <?php endif; ?>
<td class="nick">
<?= (!isset($prev_msg_nick) || $prev_msg_nick != $m['nick']) ? $m['nick'] : '' ?>
</td>