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

refactor(appservice)!: Improve API and cleanup docs #837

Merged
merged 1 commit into from
Jul 13, 2022

Conversation

johannescpk
Copy link
Contributor

@johannescpk johannescpk commented Jul 12, 2022

Since the lib.rs was slowly growing a bit too large and covering multiple contexts it was about time to refactor a bit. Also clarified the implicit behavior which special-cases the sender_localpart user.

  • Clarify why we create a virtual user for the sender_localpart on AppService construction
  • Drop the methods register_event_handler and register_event_handler_context, so the consumer has to be explicit
  • Drop the method get_cached_client as it's already covered by the method virtual_user
  • Move create_session into the VirtualUserBuilder, as it's only used there
  • Rename virtual_user_client* to virtual_user* to make it more concise
  • Make NamespaceCache private since there's no reason to expose it
  • Split out AppServiceRegistration and VirtualUserBuilder into their own files to make the code easier to navigate
  • Clean up docs

Part of #228

@johannescpk johannescpk force-pushed the appservice/refactor-cleanup branch 3 times, most recently from c22b74f to 670d3f9 Compare July 12, 2022 17:47
@codecov
Copy link

codecov bot commented Jul 12, 2022

Codecov Report

Merging #837 (ec00af0) into main (9a45325) will increase coverage by 0.04%.
The diff coverage is 60.78%.

@@            Coverage Diff             @@
##             main     #837      +/-   ##
==========================================
+ Coverage   78.20%   78.24%   +0.04%     
==========================================
  Files         101      103       +2     
  Lines       14223    14214       -9     
==========================================
- Hits        11123    11122       -1     
+ Misses       3100     3092       -8     
Impacted Files Coverage Δ
crates/matrix-sdk-appservice/src/event_handler.rs 0.00% <ø> (ø)
crates/matrix-sdk-appservice/src/virtual_user.rs 50.00% <50.00%> (ø)
crates/matrix-sdk-appservice/src/registration.rs 52.00% <52.00%> (ø)
crates/matrix-sdk-appservice/tests/tests.rs 96.17% <70.00%> (-0.40%) ⬇️
crates/matrix-sdk-appservice/src/lib.rs 86.46% <94.73%> (+15.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a45325...ec00af0. Read the comment docs.

@johannescpk johannescpk changed the title refactor(appservice)!: Reduce API surface and cleanup docs refactor(appservice)!: Improve API and cleanup docs Jul 12, 2022
@johannescpk johannescpk force-pushed the appservice/refactor-cleanup branch 5 times, most recently from 6a2efae to 2917e28 Compare July 13, 2022 07:16
@gnunicorn
Copy link
Contributor

gnunicorn commented Jul 13, 2022

@johannescpk appservice tests still failing.

@johannescpk
Copy link
Contributor Author

@gnunicorn Thanks for the poke, seems like now only an unrelated check is failing.

@gnunicorn gnunicorn merged commit 15e22cb into matrix-org:main Jul 13, 2022
@johannescpk johannescpk deleted the appservice/refactor-cleanup branch July 13, 2022 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants