fix(mattermost): detect reply target divergence correctly (ID=2965349638)
resolveMattermostReplyRootId always returns threadRootId when it is set, so comparing finalReplyToId against effectiveReplyToId was always false when the streaming preview was created in a thread. Explicit reply directives like [[reply_to:...]] could therefore never trigger the divergent-target path. Fix: compare payload.replyToId directly against effectiveReplyToId instead of going through the resolver. The resolver is still used to compute finalReplyToId for the actual delivery call.
This commit is contained in:
parent
75b79f6f59
commit
5aa16edfbb
@ -1549,12 +1549,21 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
|
||||
|
||||
// Compute reply target divergence before flushing, so we don't
|
||||
// accidentally create a preview post in the wrong thread on flush.
|
||||
// Compute the reply target for this payload. When payload.replyToId is set
|
||||
// and resolves to a different thread than the one the streaming preview was
|
||||
// created in (effectiveReplyToId), we must not patch the preview in-place.
|
||||
// We compare the raw payload.replyToId against effectiveReplyToId directly
|
||||
// instead of going through resolveMattermostReplyRootId(), because that
|
||||
// helper always returns threadRootId when set, making the comparison always
|
||||
// false when effectiveReplyToId is non-empty (ID=2965349638).
|
||||
const finalReplyToId = resolveMattermostReplyRootId({
|
||||
threadRootId: effectiveReplyToId,
|
||||
replyToId: payload.replyToId,
|
||||
});
|
||||
const replyTargetDiverged =
|
||||
finalReplyToId !== effectiveReplyToId && payload.replyToId != null;
|
||||
payload.replyToId != null &&
|
||||
payload.replyToId.trim() !== "" &&
|
||||
payload.replyToId.trim() !== effectiveReplyToId;
|
||||
|
||||
if (isFinal && blockStreamingClient) {
|
||||
if (replyTargetDiverged) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user