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

sdk: create new users_with_power_levels fn #3182

Merged
merged 4 commits into from
Mar 4, 2024

Conversation

jmartinesp
Copy link
Contributor

It maps user ids to users' power levels.

Also, make sure it just returns an empty map if this info is not available, instead of crashing.

Then use it in the FFI side to output updated data for the RoomInfo.

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@jmartinesp jmartinesp requested a review from a team as a code owner March 4, 2024 11:55
@jmartinesp jmartinesp requested review from Hywan and removed request for a team March 4, 2024 11:55
@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.81%. Comparing base (4b56ca1) to head (49830c8).
Report is 1381 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3182      +/-   ##
==========================================
+ Coverage   83.78%   83.81%   +0.02%     
==========================================
  Files         232      232              
  Lines       23958    23965       +7     
==========================================
+ Hits        20074    20086      +12     
+ Misses       3884     3879       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmartinesp jmartinesp force-pushed the jme/fix-ffi-crash-with-no-power-level-info branch from 8c75d2f to 43b1621 Compare March 4, 2024 12:14
…sers' power levels

Also, make sure it just returns an empty map if this info is not available, instead of crashing.
@jmartinesp jmartinesp force-pushed the jme/fix-ffi-crash-with-no-power-level-info branch from 43b1621 to b9671d8 Compare March 4, 2024 12:22
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Thanks! Tiny comments here :-)

crates/matrix-sdk/src/room/mod.rs Outdated Show resolved Hide resolved
Comment on lines 802 to 803
assert_eq!(users_with_power_levels.len(), 1);
assert_eq!(users_with_power_levels[user_id!("@example:localhost")], 100);
Copy link
Member

Choose a reason for hiding this comment

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

Can you make it so that the test data contains power levels for two different users?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I can change the DEFAULT_SYNC contents, but I'm afraid that might break some other tests.

Copy link
Member

@bnjbvr bnjbvr Mar 4, 2024

Choose a reason for hiding this comment

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

Without changing the contents of DEFAULT_SYNC, could we return our own content from a json!() macro invoke instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created a new ADMIN_AND_MOD_SYNC with only the needed data for the test.

@bnjbvr bnjbvr removed the request for review from Hywan March 4, 2024 13:32
@jmartinesp jmartinesp force-pushed the jme/fix-ffi-crash-with-no-power-level-info branch from d76ee98 to 49830c8 Compare March 4, 2024 15:09
@jmartinesp jmartinesp requested a review from bnjbvr March 4, 2024 15:10
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Thanks!

@jmartinesp
Copy link
Contributor Author

codecov/project Expected — Waiting for status to be reported

🥲

@bnjbvr bnjbvr merged commit 0c98e26 into main Mar 4, 2024
32 checks passed
@bnjbvr bnjbvr deleted the jme/fix-ffi-crash-with-no-power-level-info branch March 4, 2024 15:37
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