detached 449502f

Merge pull request #57 from kitpdr/fix/message-display-and-idle-status

fix: message display and idle status validation
commit
449502f39ea88246b536d354a840d0a3d5ce85a1
author
KiT · · 2025-12-15 13:04 UTC
committer
GitHub · · 2025-12-15 13:04 UTC
merge of
82f3e96 + ee35195 · diff against the first parent
signature
GPG UnverifiedB5690EEEBB952194 The key is unknown
2 files · +11 -1
M src/lib/states/chat.svelte.ts +10 -0
@@ -558,6 +558,16 @@ class ChatState {
558558 }
559559
560560 console.debug('Message sent successfully:', data.message);
561+
562+ // Add message to state immediately for instant display (optimistic update)
563+ // SSE deduplication will handle any duplicate when the broadcast arrives
564+ if (data.message) {
565+ this.messages = Array.from(
566+ new Map([...this.messages, data.message].map((m) => [m.id, m])).values()
567+ );
568+ this.messages.sort((a, b) => a.timestamp - b.timestamp);
569+ }
570+
561571 await invalidate('chat:messages');
562572 return data;
563573 } catch (error) {
@@ -558,6 +558,16 @@ class ChatState {
558 }558 }
559 559
560 console.debug('Message sent successfully:', data.message);560 console.debug('Message sent successfully:', data.message);
561+
562+ // Add message to state immediately for instant display (optimistic update)
563+ // SSE deduplication will handle any duplicate when the broadcast arrives
564+ if (data.message) {
565+ this.messages = Array.from(
566+ new Map([...this.messages, data.message].map((m) => [m.id, m])).values()
567+ );
568+ this.messages.sort((a, b) => a.timestamp - b.timestamp);
569+ }
570+
561 await invalidate('chat:messages');571 await invalidate('chat:messages');
562 return data;572 return data;
563 } catch (error) {573 } catch (error) {
M src/routes/api/status/+server.ts +1 -1
@@ -21,7 +21,7 @@ export const POST: RequestHandler = async ({ request, cookies, locals }) => {
2121
2222 try {
2323 const { status } = await request.json();
24- const validStatuses = ['online', 'away', 'busy', 'offline'];
24+ const validStatuses = ['online', 'away', 'busy', 'offline', 'idle'];
2525 if (!validStatuses.includes(status)) {
2626 log.warn('Invalid status received', { status });
2727 return new Response(JSON.stringify({ success: false, error: 'Invalid status' }), {
@@ -21,7 +21,7 @@ export const POST: RequestHandler = async ({ request, cookies, locals }) => {
21 21
22 try {22 try {
23 const { status } = await request.json();23 const { status } = await request.json();
24- const validStatuses = ['online', 'away', 'busy', 'offline'];24+ const validStatuses = ['online', 'away', 'busy', 'offline', 'idle'];
25 if (!validStatuses.includes(status)) {25 if (!validStatuses.includes(status)) {
26 log.warn('Invalid status received', { status });26 log.warn('Invalid status received', { status });
27 return new Response(JSON.stringify({ success: false, error: 'Invalid status' }), {27 return new Response(JSON.stringify({ success: false, error: 'Invalid status' }), {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 3

Tags 8

↑↓ moveenter openesc close