-
Notifications
You must be signed in to change notification settings - Fork 0
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
Upload files in threads #20
Conversation
See https://api.slack.com/events/message/file_comment: > This event is no longer served. File comments have been phased out in favor of regular messages and threads.
So it uses the slack urls instead of the matrix urls. We'll replace these with the matrix urls in next commits.
Could you for now include (code) comments of which functionality should be actually in https://github.com/matrix-org/matrix-appservice-bridge/ We also discussed to update the README.md with the differences to upstream but this can be done in an upcoming PR. |
20363af
to
edfca1b
Compare
edfca1b
to
189ce44
Compare
@akirk, since the topic of which logic should be in matrix-appservice-bridge is a more generic one (not just relating to files), I will address it together with the other topic of documenting differences between this fork and the upstream bridge, in a separate PR. |
Sounds good to me, I just thought it would be good to note it down whenever you encounter it, not restricted to this PR. |
I tested quite a bit locally, merging. |
This PR implements file uploads in threads. Previously, files uploaded in a thread on Slack, would render on the main timeline on Matrix. With this PR, the files is correctly uploaded to the Matrix thread.
The upstream issue is: matrix-org#671
This PR is the culmination of refactoring the Slack message parsing logic into a
SlackMessageParser
which exposes a single method:Since one Slack message might result in multiple Matrix events (each file referenced by the message is a separate event on Matrix), the
parse()
method returns an array of Matrix events. The array might be empty if the parser failed to parse the message.For matrix events that are files, the parser does not upload them to Matrix. Instead, it sets the Slack URL to the file in the Matrix event, with an appended access token:
Consumers of the parser then need to actually upload the file, and replace the URL in the Matrix event.