Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement attachment captioning #1719

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 1, 2024

  1. Implement attachment captioning

    Starting with Client-Server API v1.10 [0], the `body` field in messages of type `m.image`,
    `m.audio`, `m.video` and `m.file` can be used as the caption of the attachment. This is fact the way
    that Nheko rends captions on images, for example.
    
    This commit introduces a field in the `UploadHandle`s awaiting upload on the timeline's `InputBar`
    which holds a caption taken from the input text area. The decision is as follows:
     - If text bar is empty or full of blanks, send all media with no caption
     - If the text is an incomplete command, fail
     - If there are no pending uploads, proceed as done previously (if there is no command recognized
       send the text, or try and execute the command and if it fails send the text)
     - If there are pending uploads, only accept uploads if nothing resembling a command name is in the
       text area. That text becomes the caption for all pending media. Otherwise, try and execute the
       command, and, if it fails, send it as text.
    
    While this workflow for captioning so far is a bit jank, it is the least effort implementation.
    
    Links:
    [0]: https://spec.matrix.org/v1.10/client-server-api/#mimage
    
    Signed-off-by: lymkwi <[email protected]>
    Lymkwi committed May 1, 2024
    Configuration menu
    Copy the full SHA
    50cdcc0 View commit details
    Browse the repository at this point in the history