matrix-react-sdk icon indicating copy to clipboard operation
matrix-react-sdk copied to clipboard

Mark as Unread

Open dbkr opened this issue 1 year ago • 6 comments

This implements the 'mark as unread' feature, as per https://github.com/matrix-org/matrix-spec-proposals/pull/2867

Needs https://github.com/matrix-org/matrix-analytics-events/pull/90 (plus release of matrix-analytics-events)

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)

Here's what your changelog entry will look like:

✨ Features

dbkr avatar Feb 15 '24 17:02 dbkr

This is now ready, code-wise, just needs a new icon for the mark as unread menu item and whatever testing we want to do before merging.

dbkr avatar Feb 16 '24 14:02 dbkr

Icon now updated

dbkr avatar Feb 16 '24 17:02 dbkr

Slightly concerned about the transition path here, once MSC2867 becomes canon and the account_data type changes to m.marked_unread. I can see potential solutions but I think it would be good to have them spelt out ahead of time.

Indeed: is there any plan to get MSC2867 merged, or is the intention for EW just to use unspecified features forever? The setting should probably be behind a labs flag until MSC2867 lands?

Are you sure it wouldn't be easier to get MSC2867 merged first? There seem to be enough impls out there to justify it and it would save the dance around the account_data entry.

richvdh avatar Feb 27 '24 10:02 richvdh

So it turns out that the rust (mobile) impls will read either prefix but currently only write to the unstable one. We could do the same here, although would that could as 'using' the unstable prefix before the MSC is merged? It would mean it continues working seamlessly (assuming other clients do similar or change to doing so before we start writing the stable prefix).

I don't really see anything blocking the MSC, so it could probably be moved forward.

dbkr avatar Feb 27 '24 11:02 dbkr

although would that count as 'using' the unstable prefix before the MSC is merged?

It would, really. If, as part of the standardisation process of the MSC, we decide that actually m.marked_unread should have a completely different shape/semantics to what is currently proposed, then your implementations which prematurely applied an interpretation on m.marked_unread will be broken. Maybe that's a risk you're willing to take, but "we've already written an implementation which depends on m.marked_unread having a given shape" will cut little ice on the spec side.

richvdh avatar Feb 27 '24 11:02 richvdh

Implementation now updated to read both, with comments on the plan and that we're okay accepting that risk.

dbkr avatar Feb 27 '24 17:02 dbkr

So I didn't add playwright tests as this was not too bad to get good coverage with regular tests, so I was biasing towards only adding them for things we couldn't cover with regular tests (since they are quite heavyweight and often flakey). Happy to write some though.

dbkr avatar Feb 29 '24 11:02 dbkr

There is now a playwright test.

dbkr avatar Feb 29 '24 15:02 dbkr

So I didn't add playwright tests as this was not too bad to get good coverage with regular tests, so I was biasing towards only adding them for things we couldn't cover with regular tests (since they are quite heavyweight and often flakey).

Yeah, the trouble is that the jest tests might be good for hitting our coverage metric, but they're pretty awful at actually testing that the application works. Ideally we could test that our components work together inside a Jest test rather than firing up a full playwright environment, but the architecture of the app doesn't make that easy.

richvdh avatar Mar 01 '24 15:03 richvdh

First split out PR: https://github.com/matrix-org/matrix-react-sdk/pull/12327

dbkr avatar Mar 07 '24 20:03 dbkr

Second split out PR: https://github.com/matrix-org/matrix-react-sdk/pull/12344

dbkr avatar Mar 14 '24 19:03 dbkr

OK, main bits of this now split out & merged separately. The next biggest chunk would be analytics but hopefully this doesn't add a great deal of complexity here.

dbkr avatar Mar 15 '24 15:03 dbkr

Thanks. I believe once I saw it mark a room as unread but then fail to update the UI to put the badge on, but all my attempt to repro it subsequently have failed. I'm not really sure how to proceed here. We could go ahead and merge, filing this as a bug so we're aware of it and can chase it later if we get more data, or otherwise perhaps organise another round of testing to see if anyone else can reproduce it?

dbkr avatar Mar 18 '24 14:03 dbkr