Only send a formatted_body if it's truly needed
This commit is contained in:
		
							
								
								
									
										5
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								TODO.md
									
									
									
									
									
								
							@@ -11,17 +11,19 @@
 | 
			
		||||
  - Room Sidepane
 | 
			
		||||
  - When qml syntax highlighting supports string interpolation, use them
 | 
			
		||||
 | 
			
		||||
- Bug fixes
 | 
			
		||||
- Fixes
 | 
			
		||||
  - Past events loading (limit 100) freezes the GUI - need to move upsert func
 | 
			
		||||
    to a WorkerScript
 | 
			
		||||
  - `MessageDelegate.qml:63: TypeError: 'reloadPreviousItem' not a function`
 | 
			
		||||
  - Horrible performance for big rooms
 | 
			
		||||
 | 
			
		||||
- UI
 | 
			
		||||
  - Show error box if uploading avatar fails
 | 
			
		||||
  - EditAccount page:
 | 
			
		||||
    - Device settings
 | 
			
		||||
    - Multiaccount aliases:
 | 
			
		||||
      - Warn when overwriting another alias
 | 
			
		||||
      - Forbid spaces?
 | 
			
		||||
      - Add an explanation tooltip
 | 
			
		||||
  - Improve avatar tooltips position, add stuff to room tooltips (last msg?)
 | 
			
		||||
  - Accept drag and dropping a picture in account settings to set avatar
 | 
			
		||||
@@ -77,7 +79,6 @@
 | 
			
		||||
 | 
			
		||||
- Client improvements
 | 
			
		||||
  - Set Qt.application.* stuff from C++
 | 
			
		||||
  - Don't send a formatted_text if it's just `<p>plaintext</p>`
 | 
			
		||||
  - [debug mode](https://docs.python.org/3/library/asyncio-dev.html)
 | 
			
		||||
  - Initial sync filter and lazy load, see weechat-matrix `_handle_login()`
 | 
			
		||||
    - See also `handle_response()`'s `keys_query` request
 | 
			
		||||
 
 | 
			
		||||
@@ -155,12 +155,12 @@ class MatrixClient(nio.AsyncClient):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    async def send_markdown(self, room_id: str, text: str) -> None:
 | 
			
		||||
        content = {
 | 
			
		||||
            "body":           text,
 | 
			
		||||
            "formatted_body": HTML_FILTER.from_markdown(text),
 | 
			
		||||
            "format":         "org.matrix.custom.html",
 | 
			
		||||
            "msgtype":        "m.text",
 | 
			
		||||
        }
 | 
			
		||||
        content = {"body": text, "msgtype": "m.text"}
 | 
			
		||||
        to_html = HTML_FILTER.from_markdown(text)
 | 
			
		||||
 | 
			
		||||
        if to_html not in (text, f"<p>{text}</p>"):
 | 
			
		||||
            content["format"]         = "org.matrix.custom.html"
 | 
			
		||||
            content["formatted_body"] = to_html
 | 
			
		||||
 | 
			
		||||
        TimelineMessageReceived(
 | 
			
		||||
            event_type    = nio.RoomMessageText,
 | 
			
		||||
@@ -168,7 +168,7 @@ class MatrixClient(nio.AsyncClient):
 | 
			
		||||
            event_id      = f"local_echo.{uuid4()}",
 | 
			
		||||
            sender_id     = self.user_id,
 | 
			
		||||
            date          = datetime.now(),
 | 
			
		||||
            content       = content["formatted_body"],
 | 
			
		||||
            content       = to_html,
 | 
			
		||||
            is_local_echo = True,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user