WIP: feature: Thread improvements, round 1 #74

Draft
Guzio wants to merge 7 commits from Guzio/out-of-your-element:mergable-fr-fr into main
First-time contributor
  • /thread command is more responsive to context such as replies
  • /thread prints usage if used without commands
  • All threads started are noted as Matrix threads so they can be accessed from the threads menu of supporting clients (but you still have to click the link to go to a thread room)
  • Nags users if they create Matrix threads
- /thread command is more responsive to context such as replies - /thread prints usage if used without commands - All threads started are noted as Matrix threads so they can be accessed from the threads menu of supporting clients (but you still have to click the link to go to a thread room) - Nags users if they create Matrix threads
Guzio added 7 commits 2026-03-02 15:43:29 +00:00
* The guard() function in m2d/event-dispatcher.js no longer takes (any, any), but a string and a function.

* m2d/send-event.js no longer complains that res.body has some missing fields. It would appear as though those missing fields weren't revelant to the fromWeb() function (into which res.body is passed), given that this code worked before and still contunes to work, so I just @ts-ignore'd res.body

This commit's developer's off-topic personal comment, related to this commit: This has nothing to do with improving thread UX, even tho this is what I was supposed to work on. However, in my attempts to discover in what file should I start, I stumbled upon those errors from m2d/send-event.js, so I fixed them. And after establishing that m2d/event-dispatcher.js is the file that I'm looking for, I also noticed that guard()'s @parm definitions could be improved, so I did that. Now - back to thread work...
* To better reflect reality ("m.in_reply_to" will not always be present - it's not (always?) found on "rel_type":"m.replace" relation-events)

* To support "rel_type":"m.replace" relation-events (added "m.replace" option to existing key "rel_type" and a new "is_falling_back" key)

AFFECTED TYPES: M_Room_Message, M_Room_Message_File, M_Room_Message_Encrypted_File

BREAKS: Nothing, as .d.ts files don't affect buisness logic. In terms of lint errors: Marking "m.in_reply_to" as optional is indeed technically a "breaking change" (TypeScript may complain about „is probably undefined” in places where it didn't before), but from early "testing" (ie. looking at VSCode's errors tab), it doesn't seem like anything broke, as no file that imports any of those 3 types (Or their Outer_ counterparts) has „lit up” with errors (unless I missed something). There was one type error found in m2d/converters/event-to-message.js, at line 1009, but that seemed unrelated to types.d.ts - nevertheless, that error was also corrected in this commit, by adding proper type annotations somewhere else in the affected file.
/This is a squash-commit - the following is a rough summary of all sub-commits, written in style of commit messages (not necessarily those commits themselves), ie. short and in present tense./

* Document design choice to not bridge Discord threads as Matrix threads [by directly quoting Cadence]
* Alter thread-to-announcement, so that it replies in-thread [with this, Matrix users will get a list of almost all (exl. those that don't branch from anything) open threads on a given channel, whereas before it wasn't possible. Also features slight alterations to the text]
* Notify the user, whenever an in-thread message on Matrix is sent, that this isn't how they're supposed to do threads on OOYE
* Detect /thread being ran as a reply or in-thread to branch the thread from the relevant message
* Handle various /thread errors [notably being ran without args (infer the title if ran in the context above, simply show help if not)]
*  Whenever possible, direct the user to an already-existing thread-room [if /thread was ran as a reply or in-thread, or as part of the notification mentioned in point 3 (feat. a new utility method)]

AUXILIARY TYPE CHANGES (not always relevant to UX-improvement-related changes):
* Fix „boolean” being referred to as „bool” in types.d.ts
* Rename execute(event) in matrix-command-handler is now parseAndExecute(event) [and it is no longer of type CommandExecute, but has its own custom definition, because a) it has a different return now (returns what command was ran (needed for point 3 in section above) instead of always undefined and b) other params from CommandExecute (like ctx or words) weren't being used - quite the contrary, their values were only being created at that stage (as part of command parsing - hence the rename, too), so telling that they're values you pass into execute() was at least somewhat confusing]
* Further narrow-down the type of guard() in m2d event-dispatcher

TEST CHANGES:
* Create 7 new tests, all pass
* Update 4 existing threads, all pass
* Pass all other relevant tests [and almost all other tests, too - there are some issues with event2message for stickers, but given the fact that this commit does not touch the stickers subsystem in any way at all,  it does not seem like they are any way related to my changes and they must've been failing before]
* Do extensive manual testing and debugging
Co-authored-by: Guzio <guzekk@protonmail.com>
Co-committed-by: Guzio <guzekk@protonmail.com>
Contributor

@Guzio you can add the WIP: prefix to the PR which auto-flags it as work in progress :)

@Guzio you can add the `WIP: ` prefix to the PR which auto-flags it as work in progress :)
Guzio changed title from feat.: Thread improvements, round 1 to WIP: feat.: Thread improvements, round 1 2026-03-03 00:12:55 +00:00
Author
First-time contributor

@beanie wrote in #74 (comment):

@Guzio you can add the WIP: prefix to the PR which auto-flags it as work in progress :)

I know - GitDab told me. I just decided it wouldn't be necessary because „surely, I'll finish that message in a few minutes; noone will ever even notice that this was WIP for a short while”.

...Cue-in me returning from uni, taking multiple-hour-long nap, and also taking much longer then anticipated to write the message. 😅

Marked this as WIP for now, will hopefully un-mark it over the course of the next 15 minutes.

@beanie wrote in https://gitdab.com/cadence/out-of-your-element/pulls/74#issuecomment-9082: > @Guzio you can add the `WIP: ` prefix to the PR which auto-flags it as work in progress :) I know - GitDab told me. I just decided it wouldn't be necessary because „surely, I'll finish that message in a few minutes; noone will ever even notice that this was WIP for a short while”. ...Cue-in me returning from uni, taking multiple-hour-long nap, and also taking much longer then anticipated to write the message. 😅 Marked this as WIP for now, will *hopefully* un-mark it over the course of the next 15 minutes.
Guzio changed title from WIP: feat.: Thread improvements, round 1 to feature: Thread improvements, round 1 2026-03-03 12:12:11 +00:00
Author
First-time contributor

over the course of the next 15 minutes

took a tiny-bit longer than anticipated lol

But I'm done here, yaaayyy! Now awaiting feedback...

> over the course of the next 15 minutes took a tiny-bit longer than anticipated lol But I'm done here, yaaayyy! Now awaiting feedback...
Contributor

I might test this in the next few days, need a solution to bridge a few threads to rooms before Discord accounts expire

I might test this in the next few days, need a solution to bridge a few threads to rooms before Discord accounts expire
Guzio changed title from feature: Thread improvements, round 1 to WIP: feature: Thread improvements, round 1 2026-03-11 10:48:36 +00:00
Author
First-time contributor

Marked the PR as WIP again, to work on changes proposed in the Matrix discussion.

Marked the PR as WIP again, to work on changes proposed in the Matrix discussion.
This pull request has changes conflicting with the target branch.
  • src/m2d/converters/event-to-message.js
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u mergable-fr-fr:Guzio-mergable-fr-fr
git checkout Guzio-mergable-fr-fr

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout main
git merge --no-ff Guzio-mergable-fr-fr
git checkout Guzio-mergable-fr-fr
git rebase main
git checkout main
git merge --ff-only Guzio-mergable-fr-fr
git checkout Guzio-mergable-fr-fr
git rebase main
git checkout main
git merge --no-ff Guzio-mergable-fr-fr
git checkout main
git merge --squash Guzio-mergable-fr-fr
git checkout main
git merge --ff-only Guzio-mergable-fr-fr
git checkout main
git merge Guzio-mergable-fr-fr
git push origin main
Sign in to join this conversation.
No description provided.