Fix corrupted member_cache entries on invite
This commit is contained in:
		
							parent
							
								
									dc92dc0b69
								
							
						
					
					
						commit
						166ac447a8
					
				
					 2 changed files with 7 additions and 2 deletions
				
			
		
							
								
								
									
										5
									
								
								db/migrations/0005-clear-member-cache.sql
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								db/migrations/0005-clear-member-cache.sql
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					BEGIN TRANSACTION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DELETE FROM member_cache;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COMMIT;
 | 
				
			||||||
| 
						 | 
					@ -147,6 +147,6 @@ sync.addTemporaryListener(as, "type:m.room.member", guard("m.room.member",
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
async event => {
 | 
					async event => {
 | 
				
			||||||
	if (event.state_key[0] !== "@") return
 | 
						if (event.state_key[0] !== "@") return
 | 
				
			||||||
	if (utils.eventSenderIsFromDiscord(event.sender)) return
 | 
						if (utils.eventSenderIsFromDiscord(event.state_key)) return
 | 
				
			||||||
	db.prepare("REPLACE INTO member_cache (room_id, mxid, displayname, avatar_url) VALUES (?, ?, ?, ?)").run(event.room_id, event.sender, event.content.displayname || null, event.content.avatar_url || null)
 | 
						db.prepare("REPLACE INTO member_cache (room_id, mxid, displayname, avatar_url) VALUES (?, ?, ?, ?)").run(event.room_id, event.state_key, event.content.displayname || null, event.content.avatar_url || null)
 | 
				
			||||||
}))
 | 
					}))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue