Fix parent messaging — allow sending to any student, not just those who messaged first
- Replace reply-by-message-ID endpoint with POST /api/admin/messages/:studentId so parent can send without a prior message existing - Switch GET /api/admin/messages to LEFT JOIN so all students appear in the thread list, not just those who have sent messages - Remove guard that blocked sending when no messages existed in the thread Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
556b570b60
commit
3a018a97bb
2 files changed
+9
-11
No files matched your search
+2
-3
@@ -2018,13 +2018,12 @@ async function openAdminThread(studentId, meta) {
|
||||
const input = $('#msg-admin-input');
|
||||
const body = input.value.trim();
|
||||
if (!body) return;
|
||||
const lastMsgId = msgs[msgs.length - 1]?.id;
|
||||
if (!lastMsgId) return;
|
||||
input.value = '';
|
||||
await api(`/api/messages/${lastMsgId}/reply`, { method: 'POST', body: { body } });
|
||||
await api(`/api/admin/messages/${studentId}`, { method: 'POST', body: { body } });
|
||||
const updated = await api(`/api/admin/messages/${studentId}`);
|
||||
msgsEl.innerHTML = renderAdminMsgs(updated);
|
||||
msgsEl.scrollTop = msgsEl.scrollHeight;
|
||||
loadMessages();
|
||||
loadMessagesBadge();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user