forked from cadence/out-of-your-element
		
	Consistently add @ to m->d matrix mentions
This commit is contained in:
		
							parent
							
								
									f9eb043c10
								
							
						
					
					
						commit
						2c3b653b54
					
				
					 2 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -129,7 +129,7 @@ turndownService.addRule("inlineLink", {
 | 
			
		|||
		const href = node.getAttribute("href")
 | 
			
		||||
		content = content.replace(/ @.*/, "")
 | 
			
		||||
		if (href === content) return href
 | 
			
		||||
		if (href.startsWith("https://matrix.to/#/@") && content[0] !== "@") content = "@" + content
 | 
			
		||||
		if (decodeURIComponent(href).startsWith("https://matrix.to/#/@") && content[0] !== "@") content = "@" + content
 | 
			
		||||
		return "[" + content + "](" + href + ")"
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -292,7 +292,7 @@ test("event2message: markdown in link text does not attempt to be escaped becaus
 | 
			
		|||
			messagesToEdit: [],
 | 
			
		||||
			messagesToSend: [{
 | 
			
		||||
				username: "cadence [they]",
 | 
			
		||||
				content: "hey [mario sports mix [she/her]](<https://matrix.to/#/%40cadence%3Acadence.moe>), is it possible to listen on a unix socket?",
 | 
			
		||||
				content: "hey [@mario sports mix [she/her]](<https://matrix.to/#/%40cadence%3Acadence.moe>), is it possible to listen on a unix socket?",
 | 
			
		||||
				avatar_url: undefined,
 | 
			
		||||
				allowed_mentions: {
 | 
			
		||||
					parse: ["users", "roles"]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue