@@ -801,7 +801,7 @@ export const AWARD_EMOJI_GRAPHQL_QUERY = `query($fullPath: ID!, $iid: String!, $
801801 awardEmoji { nodes { name user { username } } }
802802 notes(first: 100, after: $cursor) {
803803 pageInfo { hasNextPage endCursor }
804- nodes { id author { username bot } awardEmoji { nodes { name user { username } } } }
804+ nodes { id author { username bot } lastEditedAt lastEditedBy { username } resolved awardEmoji { nodes { name user { username } } } }
805805 }
806806 }
807807 }
@@ -853,6 +853,15 @@ const RawAwardEmojiPageSchema = Schema.Struct({
853853 Schema . NullOr (
854854 Schema . Struct ( {
855855 id : Schema . optional ( Schema . NullOr ( Schema . String ) ) ,
856+ lastEditedAt : Schema . optional ( Schema . NullOr ( Schema . String ) ) ,
857+ lastEditedBy : Schema . optional (
858+ Schema . NullOr (
859+ Schema . Struct ( {
860+ username : Schema . optional ( Schema . NullOr ( Schema . String ) ) ,
861+ } ) ,
862+ ) ,
863+ ) ,
864+ resolved : Schema . optional ( Schema . NullOr ( Schema . Boolean ) ) ,
856865 // REST note authors carry no bot flag; GraphQL's does.
857866 author : Schema . optional (
858867 Schema . NullOr (
@@ -916,6 +925,7 @@ function noteIdOf(gid: string | null | undefined): string | null {
916925export interface GitLabAwardEmojiPage {
917926 readonly reactions : ReadonlyArray < PullRequestReaction > ;
918927 readonly reactionsByNoteId : ReadonlyMap < string , ReadonlyArray < PullRequestReaction > > ;
928+ readonly editedAtByNoteId : ReadonlyMap < string , string > ;
919929 readonly botLogins : ReadonlySet < string > ;
920930 readonly nextCursor : string | null ;
921931}
@@ -931,6 +941,7 @@ export function decodeAwardEmojiJson(
931941 const viewer = trimmed ( data . currentUser ?. username ) ;
932942 const mergeRequest = data . project ?. mergeRequest ;
933943 const reactionsByNoteId = new Map < string , ReadonlyArray < PullRequestReaction > > ( ) ;
944+ const editedAtByNoteId = new Map < string , string > ( ) ;
934945 const botLogins = new Set < string > ( ) ;
935946 for ( const node of mergeRequest ?. notes ?. nodes ?? [ ] ) {
936947 const author = trimmed ( node ?. author ?. username ) ;
@@ -939,11 +950,22 @@ export function decodeAwardEmojiJson(
939950 if ( id === null ) continue ;
940951 const reactions = toReactions ( node ?. awardEmoji , viewer ) ;
941952 if ( reactions . length > 0 ) reactionsByNoteId . set ( id , reactions ) ;
953+ // Resolving a thread moves lastEditedAt on every note in it; only lastEditedBy marks a
954+ // text edit, and a resolved note's stamp may be the resolve rather than that edit.
955+ const editedAt = trimmed ( node ?. lastEditedAt ) ;
956+ if (
957+ editedAt !== null &&
958+ trimmed ( node ?. lastEditedBy ?. username ) !== null &&
959+ node ?. resolved !== true
960+ ) {
961+ editedAtByNoteId . set ( id , editedAt ) ;
962+ }
942963 }
943964 const pageInfo = mergeRequest ?. notes ?. pageInfo ;
944965 return Result . succeed ( {
945966 reactions : toReactions ( mergeRequest ?. awardEmoji , viewer ) ,
946967 reactionsByNoteId,
968+ editedAtByNoteId,
947969 botLogins,
948970 nextCursor : pageInfo ?. hasNextPage === true ? ( trimmed ( pageInfo . endCursor ) ?? null ) : null ,
949971 } ) ;
0 commit comments