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

Fix mark as unread button #3393

Merged
merged 7 commits into from
May 23, 2023
Merged

Fix mark as unread button #3393

merged 7 commits into from
May 23, 2023

Conversation

weeman1337
Copy link
Contributor

@weeman1337 weeman1337 commented May 22, 2023

fixes element-hq/element-web#25411

PSF-2018

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

This change is marked as an internal change (Task), so will not be included in the changelog.

@weeman1337 weeman1337 added the T-Task Tasks for the team like planning label May 22, 2023
@weeman1337 weeman1337 marked this pull request as ready for review May 22, 2023 07:04
@weeman1337 weeman1337 requested a review from a team as a code owner May 22, 2023 07:04
spec/unit/room.spec.ts Outdated Show resolved Hide resolved
@weeman1337 weeman1337 requested a review from richvdh May 22, 2023 11:38
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid I don't understand.

It's not helped by the fact that mkThread is also undocumented (and uses a bunch of additional undocumented methods), but that's not necessarily an issue to solve right now.

Comment on lines 177 to 182
const { rootEvent, thread } = mkThread({
room,
client: new TestClient().client,
authorId: "@bob:example.org",
participantUserIds: ["@bob:example.org"],
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that adding this here means that we are no longer testing the behaviour when there are no thread events? Or is that tested somewhere else?

I'm unclear what exactly addRoomMainAndThreadMessages is supposed to do, and what the semantics of tsMain and tsThread are supposed to do. Given the fact that we need to change this, I'm evidently not alone.

Please could you give the function a proper doc comment describing what it does, and what tsMain and tsThread do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richvdh take a look at the last commit. I threw away the magic setup function. It should (hopefully) be clearer now.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's certainly much clearer now, thanks! Still a couple of questions, I'm afraid

spec/unit/room.spec.ts Outdated Show resolved Hide resolved
spec/unit/room.spec.ts Outdated Show resolved Hide resolved
spec/unit/room.spec.ts Outdated Show resolved Hide resolved
spec/unit/room.spec.ts Outdated Show resolved Hide resolved
spec/unit/room.spec.ts Show resolved Hide resolved
spec/unit/room.spec.ts Outdated Show resolved Hide resolved
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

it seems like there are outstanding questions about why exactly the Room is getting into these logically-inconsistent states, but that is probably a question for another day

@weeman1337 weeman1337 added this pull request to the merge queue May 23, 2023
Merged via the queue into develop with commit 063d69e May 23, 2023
@weeman1337 weeman1337 deleted the weeman1337/fix-mark-unread branch May 23, 2023 20:45
@weeman1337 weeman1337 added the backport staging Label to automatically backport PR to staging branch label May 24, 2023
RiotRobot pushed a commit that referenced this pull request May 24, 2023
* Fix mark as unread button

* Revert to prefer the last event from the main timeline

* Refactor room test

* Fix type

* Improve docs

* Insert events to the end of the timeline

* Improve test doc

(cherry picked from commit 063d69e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport staging Label to automatically backport PR to staging branch T-Task Tasks for the team like planning X-Release-Blocker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot mark room as read.
4 participants