@@ -36,6 +36,16 @@ export const getAvailableGroupIds = async (
3636 return ( data || [ ] ) . map ( ( g ) => g . group_id ) ;
3737} ;
3838
39+ type publishedNode = {
40+ source_local_id : string ;
41+ space_id : number ;
42+ text : string ;
43+ createdAt : number ;
44+ modifiedAt : number ;
45+ filePath : string | undefined ;
46+ authorName : string | undefined ;
47+ } ;
48+
3949export const getPublishedNodesForGroups = async ( {
4050 client,
4151 groupIds,
@@ -44,16 +54,7 @@ export const getPublishedNodesForGroups = async ({
4454 client : DGSupabaseClient ;
4555 groupIds : string [ ] ;
4656 currentSpaceId : number ;
47- } ) : Promise <
48- Array < {
49- source_local_id : string ;
50- space_id : number ;
51- text : string ;
52- createdAt : number ;
53- modifiedAt : number ;
54- filePath : string | undefined ;
55- } >
56- > => {
57+ } ) : Promise < Array < publishedNode > > => {
5758 if ( groupIds . length === 0 ) {
5859 return [ ] ;
5960 }
@@ -63,7 +64,7 @@ export const getPublishedNodesForGroups = async ({
6364 const { data, error } = await client
6465 . from ( "my_contents" )
6566 . select (
66- "source_local_id, space_id, text, created, last_modified, variant, metadata" ,
67+ "source_local_id, space_id, text, created, last_modified, variant, metadata, author:my_accounts!author_id(name) " ,
6768 )
6869 . neq ( "space_id" , currentSpaceId ) ;
6970
@@ -83,6 +84,7 @@ export const getPublishedNodesForGroups = async ({
8384 created : string | null ;
8485 last_modified : string | null ;
8586 variant : string | null ;
87+ author : { name : string } | null ;
8688 metadata : Json ;
8789 } ;
8890
@@ -95,14 +97,7 @@ export const getPublishedNodesForGroups = async ({
9597 groups . get ( k ) ! . push ( row ) ;
9698 }
9799
98- const nodes : Array < {
99- source_local_id : string ;
100- space_id : number ;
101- text : string ;
102- createdAt : number ;
103- modifiedAt : number ;
104- filePath : string | undefined ;
105- } > = [ ] ;
100+ const nodes : Array < publishedNode > = [ ] ;
106101
107102 for ( const rows of groups . values ( ) ) {
108103 const withDate = rows . filter (
@@ -133,6 +128,7 @@ export const getPublishedNodesForGroups = async ({
133128 createdAt,
134129 modifiedAt,
135130 filePath,
131+ authorName : latest . author ? latest . author . name : undefined ,
136132 } ) ;
137133 }
138134
@@ -975,6 +971,7 @@ type ParsedFrontmatter = {
975971 nodeTypeId ?: string ;
976972 nodeInstanceId ?: string ;
977973 publishedToGroups ?: string [ ] ;
974+ authorName ?: string ;
978975 [ key : string ] : unknown ;
979976} ;
980977
@@ -1105,6 +1102,7 @@ const processFileContent = async ({
11051102 filePath,
11061103 importedCreatedAt,
11071104 importedModifiedAt,
1105+ authorName,
11081106} : {
11091107 plugin : DiscourseGraphPlugin ;
11101108 client : DGSupabaseClient ;
@@ -1115,6 +1113,7 @@ const processFileContent = async ({
11151113 filePath : string ;
11161114 importedCreatedAt ?: number ;
11171115 importedModifiedAt ?: number ;
1116+ authorName ?: string ;
11181117} ) : Promise <
11191118 { file : TFile ; error ?: never } | { file ?: never ; error : string }
11201119> => {
@@ -1173,6 +1172,7 @@ const processFileContent = async ({
11731172 "note" ,
11741173 ) ;
11751174 record . lastModified = importedModifiedAt ;
1175+ if ( authorName ) record . authorName = authorName ;
11761176 } ,
11771177 stat ,
11781178 ) ;
@@ -1322,6 +1322,7 @@ export const importSelectedNodes = async ({
13221322 filePath : finalFilePath ,
13231323 importedCreatedAt : createdAt ,
13241324 importedModifiedAt : modifiedAt ,
1325+ authorName : node . authorName ,
13251326 } ) ;
13261327
13271328 if ( result . error ) {
0 commit comments