clay-server 2.18.0-beta.6 → 2.18.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/public/app.js +14 -0
- package/package.json +1 -1
package/lib/public/app.js
CHANGED
|
@@ -62,6 +62,7 @@ import { initMention, handleMentionStart, handleMentionStream, handleMentionDone
|
|
|
62
62
|
|
|
63
63
|
// --- DM Mode ---
|
|
64
64
|
var dmMode = false;
|
|
65
|
+
var pendingMateDmRestore = false; // suppress regular history while restoring mate DM
|
|
65
66
|
var dmKey = null;
|
|
66
67
|
var dmTargetUser = null;
|
|
67
68
|
var dmUnread = {}; // { otherUserId: count }
|
|
@@ -741,6 +742,7 @@ import { initMention, handleMentionStart, handleMentionStream, handleMentionDone
|
|
|
741
742
|
function exitDmMode() {
|
|
742
743
|
if (!dmMode) return;
|
|
743
744
|
dmMode = false;
|
|
745
|
+
pendingMateDmRestore = false;
|
|
744
746
|
dmKey = null;
|
|
745
747
|
dmTargetUser = null;
|
|
746
748
|
setCurrentDmUser(null);
|
|
@@ -3686,6 +3688,8 @@ import { initMention, handleMentionStart, handleMentionStream, handleMentionDone
|
|
|
3686
3688
|
try {
|
|
3687
3689
|
var savedMateDm = localStorage.getItem("clay_active_mate_dm");
|
|
3688
3690
|
if (savedMateDm && !dmMode) {
|
|
3691
|
+
pendingMateDmRestore = true;
|
|
3692
|
+
messagesEl.innerHTML = ""; // prevent regular history flash
|
|
3689
3693
|
openDm(savedMateDm);
|
|
3690
3694
|
}
|
|
3691
3695
|
} catch(e) {}
|
|
@@ -3743,6 +3747,15 @@ import { initMention, handleMentionStart, handleMentionStream, handleMentionDone
|
|
|
3743
3747
|
}
|
|
3744
3748
|
|
|
3745
3749
|
function processMessage(msg) {
|
|
3750
|
+
// Suppress regular project messages while restoring mate DM
|
|
3751
|
+
if (pendingMateDmRestore) {
|
|
3752
|
+
if (msg.type === "dm_history" || msg.type === "dm_list" || msg.type === "mate_list" || msg.type === "mate_created" || msg.type === "info") {
|
|
3753
|
+
// Let these through
|
|
3754
|
+
} else {
|
|
3755
|
+
return; // skip regular session messages
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3746
3759
|
switch (msg.type) {
|
|
3747
3760
|
case "history_meta":
|
|
3748
3761
|
historyFrom = msg.from;
|
|
@@ -4507,6 +4520,7 @@ import { initMention, handleMentionStart, handleMentionStream, handleMentionDone
|
|
|
4507
4520
|
|
|
4508
4521
|
// --- DM ---
|
|
4509
4522
|
case "dm_history":
|
|
4523
|
+
pendingMateDmRestore = false; // DM data arrived, resume normal processing
|
|
4510
4524
|
// Attach projectSlug to targetUser for mate DMs
|
|
4511
4525
|
if (msg.projectSlug && msg.targetUser) {
|
|
4512
4526
|
msg.targetUser.projectSlug = msg.projectSlug;
|