POC: Add detailed membership change summaries à la element-web #4221
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proof-of-concept for replacing the generic "x membership changes" messages with detailed summaries analogous to element-web.
The implementation utilizes the JavaScript code used in element-web and executes it in a
JSContext
. I'm interested to hear thoughts on whether this would be considered a viable approach.Before
After
(Note that the "... 1 times" suffixes result from the matrix-react-sdk translations not being used in this POC.)
The native code needed to enable this turned out to be rather minimal. In fact, most of the code in this PR is infrastructure code, that could be reused when integrating further pieces of matrix-react-sdk. If this type of reuse was employed at larger scale, it might make it more easy for element-ios to catch up with element-web features.
The biggest downside is that the JavaScript code is a bit of a black box from the native perspective and rather hard to debug. This is mitigated, however, by having test coverage in matrix-react-sdk and could be further alleviated by adding tests on the native side as well.
Things left to do for making the POC production-ready
This involves programmatically extracting the strings used in the extracted JavaScript code and converting the respective pieces of the localization JSONs to string dicts.
For the POC, I compiled all of matrix-react-sdk with
yarn build
and then combined the needed.js
files with Browserify. For frequent usage, this should be optimized (to only compile the needed JavaScript sources) and automated (e.g. via a script).Depends on: matrix-org/matrix-react-sdk#5867
Closes: #4102
Signed-off-by: Johannes Marbach n0-0ne+github@mailbox.org
Pull Request Checklist