File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
cerberus/src/web3adapter/watchers
evoting-api/src/web3adapter/watchers Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,19 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
177177 // Handle regular entity changes
178178 const data = this . entityToPlain ( entity ) ;
179179 if ( ! data . id ) return ;
180+
181+ // For Message entities, only process if they are system messages
182+ if ( tableName === "messages" ) {
183+ // Check if this is a system message (starts with $$system-message$$)
184+ const isSystemMessage = data . content && typeof data . content === 'string' && data . content . startsWith ( '$$system-message$$' ) ;
185+
186+ if ( ! isSystemMessage ) {
187+ console . log ( "📝 Skipping non-system message:" , data . id ) ;
188+ return ;
189+ }
190+
191+ console . log ( "📝 Processing system message:" , data . id ) ;
192+ }
180193
181194 try {
182195 setTimeout ( async ( ) => {
Original file line number Diff line number Diff line change @@ -303,15 +303,23 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
303303 console . log ( data , entity )
304304 if ( ! data . id ) return ;
305305
306- // Special logging for Message entities to track group and admin data
306+ // For Message entities, only process if they are system messages
307307 if ( tableName === "messages" ) {
308- console . log ( "📝 Processing Message change:" , {
308+ // Check if this is a system message (starts with $$system-message$$)
309+ const isSystemMessage = data . content && typeof data . content === 'string' && data . content . startsWith ( '$$system-message$$' ) ;
310+
311+ if ( ! isSystemMessage ) {
312+ console . log ( "📝 Skipping non-system message:" , data . id ) ;
313+ return ;
314+ }
315+
316+ console . log ( "📝 Processing system message:" , {
309317 id : data . id ,
310318 hasGroup : ! ! data . group ,
311319 groupId : data . group ?. id ,
312320 hasAdmins : ! ! data . group ?. admins ,
313321 adminCount : data . group ?. admins ?. length || 0 ,
314- isSystemMessage : data . isSystemMessage
322+ isSystemMessage : true
315323 } ) ;
316324 }
317325
You can’t perform that action at this time.
0 commit comments