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

ffi: add previous power levels to OtherState::RoomPowerLevels #3199

Merged

Conversation

jmartinesp
Copy link
Contributor

This is needed to be able to diff between increases and decreases of power levels ("user Alice was promoted Admin", etc.).

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@jmartinesp jmartinesp requested a review from a team as a code owner March 8, 2024 10:54
@jmartinesp jmartinesp requested review from andybalaam and removed request for a team March 8, 2024 10:54
@jmartinesp jmartinesp force-pushed the jme/add-previous-power-levels-data-to-ffi-power-level-content branch from 8083402 to 40f5fa3 Compare March 8, 2024 10:55
Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.83%. Comparing base (b7d6fd0) to head (05f6b42).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3199   +/-   ##
=======================================
  Coverage   83.83%   83.83%           
=======================================
  Files         232      232           
  Lines       23985    23985           
=======================================
  Hits        20109    20109           
  Misses       3876     3876           

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

This is needed to be able to diff between increases and decreases of power levels.
@jmartinesp jmartinesp force-pushed the jme/add-previous-power-levels-data-to-ffi-power-level-content branch from 40f5fa3 to ead2e14 Compare March 8, 2024 11:08
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.

lgtm!

FullContent::Original { content, prev_content } => {
power_level_user_changes(content, prev_content)
previous = prev_content.as_ref().map(|prev_content| {
Copy link
Member

Choose a reason for hiding this comment

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

style nit: can you have each branch return a Self::RoomPowerLevels immediately, instead of having two temporary variables? it would read slightly more straightforward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I just did it this way to not repeat too much code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in ff911e4

@bnjbvr bnjbvr removed the request for review from andybalaam March 8, 2024 14:37
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.

Oops, sorry I meant the opposite: have each arm return a Self::RoomPowerLevels. I'll make the change.

@bnjbvr bnjbvr enabled auto-merge (squash) March 8, 2024 14:51
@bnjbvr bnjbvr merged commit cb6b420 into main Mar 8, 2024
34 checks passed
@bnjbvr bnjbvr deleted the jme/add-previous-power-levels-data-to-ffi-power-level-content branch March 8, 2024 15:03
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.

2 participants