@@ -12,7 +12,6 @@ export class GetUserWikiActivitiesService {
1212 timeFrameSeconds ?: number ,
1313 ) {
1414 try {
15- // biome-ignore lint/suspicious/noExplicitAny: the type UserWikiResponse is not exposing created
1615 const response : any = await client . request ( USER_ACTIVITIES_QUERY , {
1716 id,
1817 limit : 50 , // Increase limit to get more activities
@@ -32,7 +31,6 @@ export class GetUserWikiActivitiesService {
3231 // Filter by activity type if specified
3332 if ( activityType ) {
3433 activities = activities . filter (
35- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
3634 ( activity : any ) => activity . type === activityType ,
3735 ) ;
3836
@@ -49,7 +47,6 @@ export class GetUserWikiActivitiesService {
4947 const timeLimit = new Date ( now . getTime ( ) - timeFrameSeconds * 1000 ) ;
5048
5149 // Filter activities by datetime
52- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
5350 activities = activities . filter ( ( activity : any ) => {
5451 if ( ! activity . datetime ) return false ;
5552 const activityDate = new Date ( activity . datetime ) ;
@@ -74,32 +71,27 @@ export class GetUserWikiActivitiesService {
7471 // Fetch additional metadata for edited wikis if needed
7572 if (
7673 activityType === "UPDATED" ||
77- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
7874 ( ! activityType && activities . some ( ( a : any ) => a . type === "UPDATED" ) )
7975 ) {
8076 await this . enrichWithWikiMetadata (
81- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
8277 activities . filter ( ( a : any ) => a . type === "UPDATED" ) ,
8378 ) ;
8479 }
8580
8681 return activities ;
87- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
8882 } catch ( error : any ) {
8983 throw new Error ( error . message ) ;
9084 }
9185 }
9286
9387 // Fetch additional metadata for edited wikis
94- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
9588 private async enrichWithWikiMetadata ( activities : any ) {
9689 for ( const activity of activities ) {
9790 if ( ! activity . content ?. [ 0 ] ) continue ;
9891
9992 try {
10093 // Get the full wiki details to access metadata
10194 const wikiId = activity . content [ 0 ] . id ;
102- // biome-ignore lint/suspicious/noExplicitAny: GraphQL response type
10395 const wikiResponse : any = await client . request ( WIKI_QUERY , {
10496 id : wikiId ,
10597 } ) ;
@@ -136,17 +128,14 @@ export class GetUserWikiActivitiesService {
136128 }
137129 }
138130
139- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
140131 formatCreated ( activities : any ) {
141- return (
142- activities
143- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
144- . map ( ( activity : any ) => {
145- const wiki = activity . content [ 0 ] ;
146- const date = new Date ( activity . datetime ) ;
147- const formattedDate = date . toLocaleString ( ) ;
148-
149- return dedent `
132+ return activities
133+ . map ( ( activity : any ) => {
134+ const wiki = activity . content [ 0 ] ;
135+ const date = new Date ( activity . datetime ) ;
136+ const formattedDate = date . toLocaleString ( ) ;
137+
138+ return dedent `
150139 📜 Created Wiki Details
151140 - Title: ${ wiki . title }
152141 - Summary: ${ wiki . summary }
@@ -155,42 +144,38 @@ export class GetUserWikiActivitiesService {
155144 🔗 Source: ${ IQ_BASE_URL } /${ wiki . id }
156145 🔗 Transaction: https://polygonscan.com/tx/${ wiki . transactionHash }
157146 ` ;
158- } )
159- . join ( "\n\n" )
160- ) ;
147+ } )
148+ . join ( "\n\n" ) ;
161149 }
162150
163- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
164151 formatEdited ( activities : any ) {
165- return (
166- activities
167- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
168- . map ( ( activity : any ) => {
169- const wiki = activity . content [ 0 ] ;
170- const date = new Date ( activity . datetime ) ;
171- const formattedDate = date . toLocaleString ( ) ;
172-
173- // Check if we have enriched metadata
174- let editDetails = "" ;
175- if ( activity . enrichedMetadata ) {
176- if (
177- activity . enrichedMetadata . wordsChanged !== "Unknown" &&
178- activity . enrichedMetadata . percentChanged !== "Unknown"
179- ) {
180- editDetails += `- Changes: ${ activity . enrichedMetadata . wordsChanged } words (${ activity . enrichedMetadata . percentChanged } %)\n` ;
181- }
182-
183- if ( activity . enrichedMetadata . blocksChanged !== "Unknown" ) {
184- editDetails += `- Modified sections: ${ activity . enrichedMetadata . blocksChanged } \n` ;
185- }
152+ return activities
153+ . map ( ( activity : any ) => {
154+ const wiki = activity . content [ 0 ] ;
155+ const date = new Date ( activity . datetime ) ;
156+ const formattedDate = date . toLocaleString ( ) ;
157+
158+ // Check if we have enriched metadata
159+ let editDetails = "" ;
160+ if ( activity . enrichedMetadata ) {
161+ if (
162+ activity . enrichedMetadata . wordsChanged !== "Unknown" &&
163+ activity . enrichedMetadata . percentChanged !== "Unknown"
164+ ) {
165+ editDetails += `- Changes: ${ activity . enrichedMetadata . wordsChanged } words (${ activity . enrichedMetadata . percentChanged } %)\n` ;
186166 }
187167
188- // If we couldn't get metadata, use a simpler format
189- if ( ! editDetails ) {
190- editDetails = "- Edit details not available\n" ;
168+ if ( activity . enrichedMetadata . blocksChanged !== "Unknown" ) {
169+ editDetails += `- Modified sections: ${ activity . enrichedMetadata . blocksChanged } \n` ;
191170 }
171+ }
172+
173+ // If we couldn't get metadata, use a simpler format
174+ if ( ! editDetails ) {
175+ editDetails = "- Edit details not available\n" ;
176+ }
192177
193- return dedent `
178+ return dedent `
194179 📜 Edited Wiki Details
195180 - Title: ${ wiki . title }
196181 - Summary: ${ wiki . summary }
@@ -199,44 +184,40 @@ export class GetUserWikiActivitiesService {
199184 🔗 Source: ${ IQ_REVISION_URL } /${ activity . id }
200185 🔗 Transaction: https://polygonscan.com/tx/${ wiki . transactionHash }
201186 ` ;
202- } )
203- . join ( "\n\n" )
204- ) ;
187+ } )
188+ . join ( "\n\n" ) ;
205189 }
206190
207- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
208191 format ( activities : any ) {
209- return (
210- activities
211- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
212- . map ( ( activity : any ) => {
213- const wiki = activity . content [ 0 ] ;
214- const date = new Date ( activity . datetime ) ;
215- const formattedDate = date . toLocaleString ( ) ;
216- const actionType = activity . type === "CREATED" ? "Created" : "Edited" ;
217-
218- // Add edit details for edited wikis
219- let editDetails = "" ;
220- if ( activity . type === "UPDATED" && activity . enrichedMetadata ) {
221- if (
222- activity . enrichedMetadata . wordsChanged !== "Unknown" &&
223- activity . enrichedMetadata . percentChanged !== "Unknown"
224- ) {
225- editDetails += `- Changes: ${ activity . enrichedMetadata . wordsChanged } words (${ activity . enrichedMetadata . percentChanged } %)\n` ;
226- }
227-
228- if ( activity . enrichedMetadata . blocksChanged !== "Unknown" ) {
229- editDetails += `- Modified sections: ${ activity . enrichedMetadata . blocksChanged } \n` ;
230- }
192+ return activities
193+ . map ( ( activity : any ) => {
194+ const wiki = activity . content [ 0 ] ;
195+ const date = new Date ( activity . datetime ) ;
196+ const formattedDate = date . toLocaleString ( ) ;
197+ const actionType = activity . type === "CREATED" ? "Created" : "Edited" ;
198+
199+ // Add edit details for edited wikis
200+ let editDetails = "" ;
201+ if ( activity . type === "UPDATED" && activity . enrichedMetadata ) {
202+ if (
203+ activity . enrichedMetadata . wordsChanged !== "Unknown" &&
204+ activity . enrichedMetadata . percentChanged !== "Unknown"
205+ ) {
206+ editDetails += `- Changes: ${ activity . enrichedMetadata . wordsChanged } words (${ activity . enrichedMetadata . percentChanged } %)\n` ;
231207 }
232208
233- // Determine source URL based on activity type
234- const sourceUrl =
235- activity . type === "UPDATED"
236- ? `${ IQ_REVISION_URL } /${ activity . id } `
237- : `${ IQ_BASE_URL } /${ wiki . id } ` ;
209+ if ( activity . enrichedMetadata . blocksChanged !== "Unknown" ) {
210+ editDetails += `- Modified sections: ${ activity . enrichedMetadata . blocksChanged } \n` ;
211+ }
212+ }
213+
214+ // Determine source URL based on activity type
215+ const sourceUrl =
216+ activity . type === "UPDATED"
217+ ? `${ IQ_REVISION_URL } /${ activity . id } `
218+ : `${ IQ_BASE_URL } /${ wiki . id } ` ;
238219
239- return dedent `
220+ return dedent `
240221 📜 Wiki ${ actionType }
241222 - Title: ${ wiki . title }
242223 - Summary: ${ wiki . summary }
@@ -245,8 +226,7 @@ export class GetUserWikiActivitiesService {
245226 🔗 Source: ${ sourceUrl }
246227 🔗 Transaction: https://polygonscan.com/tx/${ wiki . transactionHash }
247228 ` ;
248- } )
249- . join ( "\n\n" )
250- ) ;
229+ } )
230+ . join ( "\n\n" ) ;
251231 }
252232}
0 commit comments