1
0
Fork 1

Fix identifiers in table PHP.

pull/28/head
gravel 3 years ago
parent 4ba7520856
commit c627407c67
Signed by: gravel
SSH Key Fingerprint: SHA256:p4HP49CCk4YQMkJpWJ09L8peEPQWjERtdCRAFxPfbOY

@ -56,7 +56,7 @@ export function columnIsSortable(column) {
const TRANSFORMATION = {
numeric: (el) => parseInt(el.innerText),
casefold: (el) => el.innerText.toLowerCase().trim(),
tokenData: (el) => el.getAttribute("data-token")
getPubkey: (el) => el.getAttribute("data-pubkey")
}
/**
@ -67,7 +67,7 @@ export const COLUMN_TRANSFORMATION = {
[COLUMN.IDENTIFIER]: TRANSFORMATION.casefold,
[COLUMN.NAME]: TRANSFORMATION.casefold,
[COLUMN.DESCRIPTION]: TRANSFORMATION.casefold,
[COLUMN.SERVER_ICON]: TRANSFORMATION.tokenData
[COLUMN.SERVER_ICON]: TRANSFORMATION.getPubkey
}
/**

@ -21,7 +21,7 @@
['id' => "description", 'name' => "Description"],
['id' => "users", 'name' => "Users"],
['id' => "preview", 'name' => "Preview"],
['id' => "qr", 'name' => "QR"],
['id' => "qr_code", 'name' => "QR"],
['id' => "server_icon", 'name' => "Server"],
['id' => "join_url", 'name' => "Join URL"],
];
@ -45,8 +45,8 @@
// However, the fetching code hides component data
// and this is a low risk use case.
$token = explode("=", $room->join_link)[1];
$icon_hue = hexdec($token[2] . $token[2]);
$pubkey = explode("=", $room->join_link)[1];
$icon_hue = hexdec($pubkey[2] . $pubkey[2]);
$icon_color = "hsl($icon_hue, 80%, 50%)";
$hostname = explode("//", $room->join_link)[1];
@ -79,11 +79,11 @@
>
</td>
<td class="td_server_icon"
data-token="<?=$token?>"
title="<?=$hostname?> (<?=$token?>)"
data-pubkey="<?=$pubkey?>"
title="<?=$hostname?> (<?=$pubkey?>)"
>
<div class="td_server_icon-circle" style="background-color: <?=$icon_color?>">
<span><?=strtoupper($token[0] . $token[1])?></span>
<span><?=strtoupper($pubkey[0] . $pubkey[1])?></span>
</div>
</td>
<td class="td_join_url">