Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): watching a pull request again no longer repeats news the thread already got #21155

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/21155/headmerged by juliusmarminge View on GitHub

Showing 6 changed files with 41 additions and 15 deletions (loading 4).

x
0 of 6 viewed, 6 left
27 additions and 5 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -534,8 +534,10 @@
link: ThreadPullRequestLink,
watch: ThreadPullRequestWatch | undefined,
): ThreadPullRequestLink {
- const { watch: _previous, ...rest } = link;
- return watch === undefined ? rest : { ...rest, watch };
+ const { watch: previous, endedWatch, ...rest } = link;
+ if (watch !== undefined) return { ...rest, watch };
+ const ended = previous ?? endedWatch;
+ return ended === undefined ? rest : { ...rest, endedWatch: ended };
​
function legacyPullRequestLink(
@@ -544,6 +546,9 @@
now: DateTime.Utc,
): ThreadPullRequestLink {
const key = legacyThreadPullRequestKey(linked);
+ const existing = threadPullRequestsOf(thread).find((link) =>
+ threadPullRequestKeysEqual(link, key),
+ );
return withPullRequestWatch(
...key,
@@ -552,8 +557,9 @@
linkedAt: DateTime.formatIso(now),
snapshot: null,
stack: null,
+ ...(existing?.endedWatch && { endedWatch: existing.endedWatch }),