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 {
177
177
// Handle regular entity changes
178
178
const data = this . entityToPlain ( entity ) ;
179
179
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
+ }
180
193
181
194
try {
182
195
setTimeout ( async ( ) => {
Original file line number Diff line number Diff line change @@ -303,15 +303,23 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
303
303
console . log ( data , entity )
304
304
if ( ! data . id ) return ;
305
305
306
- // Special logging for Message entities to track group and admin data
306
+ // For Message entities, only process if they are system messages
307
307
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:" , {
309
317
id : data . id ,
310
318
hasGroup : ! ! data . group ,
311
319
groupId : data . group ?. id ,
312
320
hasAdmins : ! ! data . group ?. admins ,
313
321
adminCount : data . group ?. admins ?. length || 0 ,
314
- isSystemMessage : data . isSystemMessage
322
+ isSystemMessage : true
315
323
} ) ;
316
324
}
317
325
You can’t perform that action at this time.
0 commit comments