Fix some compose panel bugs and reload workers when changed
This commit is contained in:
@@ -1033,7 +1033,7 @@ class XMPPComponent(ComponentXMPP):
|
||||
sender="XMPP",
|
||||
text=body,
|
||||
ts=int(now().timestamp() * 1000),
|
||||
# outgoing=detail.is_outgoing_message, ????????? TODO:
|
||||
outgoing=True,
|
||||
)
|
||||
self.log.info("Stored a message sent from XMPP in the history.")
|
||||
|
||||
|
||||
@@ -284,6 +284,17 @@
|
||||
{% endif %}
|
||||
<p class="compose-msg-meta">
|
||||
{{ msg.display_ts }}{% if msg.author %} · {{ msg.author }}{% endif %}
|
||||
{% if msg.read_ts %}
|
||||
<span class="compose-ticks" title="Read at {{ msg.read_display }}">
|
||||
<span class="icon is-small"><i class="fa-solid fa-check-double has-text-info"></i></span>
|
||||
<span class="compose-tick-time">{{ msg.read_display }}</span>
|
||||
</span>
|
||||
{% elif msg.delivered_ts %}
|
||||
<span class="compose-ticks" title="Delivered at {{ msg.delivered_display }}">
|
||||
<span class="icon is-small"><i class="fa-solid fa-check-double has-text-grey"></i></span>
|
||||
<span class="compose-tick-time">{{ msg.delivered_display }}</span>
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
@@ -538,6 +549,18 @@
|
||||
#{{ panel_id }} .compose-msg-meta {
|
||||
margin: 0;
|
||||
}
|
||||
#{{ panel_id }} .compose-ticks {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.22rem;
|
||||
margin-left: 0.4rem;
|
||||
color: #6b7787;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
#{{ panel_id }} .compose-tick-time {
|
||||
font-size: 0.66rem;
|
||||
color: #616161;
|
||||
}
|
||||
#{{ panel_id }} .compose-platform-switch {
|
||||
margin-top: 0.32rem;
|
||||
}
|
||||
@@ -1736,7 +1759,41 @@
|
||||
if (msg.author) {
|
||||
metaText += " · " + String(msg.author);
|
||||
}
|
||||
meta.textContent = metaText;
|
||||
meta.textContent = metaText;
|
||||
// Render delivery/read ticks and a small time label when available.
|
||||
if (msg.read_ts) {
|
||||
const tickWrap = document.createElement("span");
|
||||
tickWrap.className = "compose-ticks";
|
||||
tickWrap.title = "Read at " + String(msg.read_display || msg.read_ts || "");
|
||||
const icon = document.createElement("span");
|
||||
icon.className = "icon is-small";
|
||||
const i = document.createElement("i");
|
||||
i.className = "fa-solid fa-check-double has-text-info";
|
||||
icon.appendChild(i);
|
||||
const timeSpan = document.createElement("span");
|
||||
timeSpan.className = "compose-tick-time";
|
||||
timeSpan.textContent = String(msg.read_display || "");
|
||||
tickWrap.appendChild(icon);
|
||||
tickWrap.appendChild(timeSpan);
|
||||
meta.appendChild(document.createTextNode(" "));
|
||||
meta.appendChild(tickWrap);
|
||||
} else if (msg.delivered_ts) {
|
||||
const tickWrap = document.createElement("span");
|
||||
tickWrap.className = "compose-ticks";
|
||||
tickWrap.title = "Delivered at " + String(msg.delivered_display || msg.delivered_ts || "");
|
||||
const icon = document.createElement("span");
|
||||
icon.className = "icon is-small";
|
||||
const i = document.createElement("i");
|
||||
i.className = "fa-solid fa-check-double has-text-grey";
|
||||
icon.appendChild(i);
|
||||
const timeSpan = document.createElement("span");
|
||||
timeSpan.className = "compose-tick-time";
|
||||
timeSpan.textContent = String(msg.delivered_display || "");
|
||||
tickWrap.appendChild(icon);
|
||||
tickWrap.appendChild(timeSpan);
|
||||
meta.appendChild(document.createTextNode(" "));
|
||||
meta.appendChild(tickWrap);
|
||||
}
|
||||
bubble.appendChild(meta);
|
||||
|
||||
row.appendChild(bubble);
|
||||
|
||||
@@ -324,6 +324,14 @@ def _serialize_message(msg: Message) -> dict:
|
||||
)
|
||||
display_text = text_value if text_value.strip() else ("(no text)" if not image_url else "")
|
||||
author = str(msg.custom_author or "").strip()
|
||||
delivered_ts = int(msg.delivered_ts or 0)
|
||||
read_ts = int(msg.read_ts or 0)
|
||||
delivered_display = _format_ts_label(int(delivered_ts)) if delivered_ts else ""
|
||||
read_display = _format_ts_label(int(read_ts)) if read_ts else ""
|
||||
ts_val = int(msg.ts or 0)
|
||||
delivered_delta = int(delivered_ts - ts_val) if delivered_ts and ts_val else None
|
||||
read_delta = int(read_ts - ts_val) if read_ts and ts_val else None
|
||||
|
||||
return {
|
||||
"id": str(msg.id),
|
||||
"ts": int(msg.ts or 0),
|
||||
@@ -335,6 +343,12 @@ def _serialize_message(msg: Message) -> dict:
|
||||
"hide_text": hide_text,
|
||||
"author": author,
|
||||
"outgoing": _is_outgoing(msg),
|
||||
"delivered_ts": delivered_ts,
|
||||
"read_ts": read_ts,
|
||||
"delivered_display": delivered_display,
|
||||
"read_display": read_display,
|
||||
"delivered_delta": delivered_delta,
|
||||
"read_delta": read_delta,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user