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

[Poll] Synchronize polls and message push rules after creation (PSG-1137) #8130

Merged
merged 5 commits into from
Feb 17, 2023

Conversation

Florian14
Copy link
Contributor

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Add an observer on the push rule updates in the account data and realign the push rules with their parent if needed.

Motivation and context

#8114 introduces the new push rules in the notification settings. The new rules should be aligned with their parent rules as described in the following table:

image

The purpose of this PR is to verify and fix if necessary the consistency of the new rules with their parent when changes are detected in the account data.

Screenshots / GIFs

Tests

  • Manually change and break the poll rules in the account data using the devtools on the web interface
  • Verify that the Android client automatically realign the rules with the parent one (by refreshing the account data after an incremental sync)

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@Florian14 Florian14 changed the title [Poll] Synchronise polls and message push rules after creation (PSG-1137) [Poll] Synchronize polls and message push rules after creation (PSG-1137) Feb 14, 2023
@Florian14 Florian14 force-pushed the feature/fre/poll_sync_push_rules_after_creation branch from 014556d to 61c3f55 Compare February 14, 2023 16:28
@Florian14 Florian14 requested review from a team, jmartinesp and jonnyandrew and removed request for a team and jmartinesp February 14, 2023 16:29
@Florian14 Florian14 force-pushed the feature/fre/poll_new_push_rules branch from d55b281 to 0a0ad2d Compare February 14, 2023 16:54
@Florian14 Florian14 force-pushed the feature/fre/poll_sync_push_rules_after_creation branch from 61c3f55 to 529f640 Compare February 14, 2023 16:56
)
else -> emptyList()
}
fun RuleIds.getParentRule(ruleId: String): String? {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be worth adding a comment here to explain what a parent rule is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm also wondering if this should be moved outside of the sdk, this relation between the push rules is mentioned in the MSC but their connection is done at the application side (the clients are not forced to apply this relation, but on the other hand it could also be interesting to share this information at the sdk level... wdyt?)

Copy link
Contributor

Choose a reason for hiding this comment

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

I couldn't find any mention of parent rules in the MSC3930. Is that the right place to look?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The term "parent" is not mentioned, I was talking about these references to m.room.message rule:

In order to have polls behave similar to message events, the following underride push rules are defined. Note that the push rules are mirrored from those available to m.room.message events.

Typically these rules would be kept in sync with the m.room.message rules they are based upon, however there is no requirement to do so. A client's approach might be to only keep them in sync while setting the values, rather than monitoring for changes to push rules.

Copy link
Contributor

@jonnyandrew jonnyandrew Feb 15, 2023

Choose a reason for hiding this comment

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

It sounds like more of a recommendation from the MSC about how the push rules might be related. In a different app, for example one that is based around polls rather than messages, I guess the parent relation might be reversed?

So I'm leaning towards moving this out of the SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're totally right, I moved the extensions to the vector module dcd43d6

Base automatically changed from feature/fre/poll_new_push_rules to develop February 17, 2023 09:03
Copy link
Contributor

@jonnyandrew jonnyandrew left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

@sonarcloud
Copy link

sonarcloud bot commented Feb 17, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

87.6% 87.6% Coverage
0.0% 0.0% Duplication

@Florian14 Florian14 merged commit 7d16c86 into develop Feb 17, 2023
@Florian14 Florian14 deleted the feature/fre/poll_sync_push_rules_after_creation branch February 17, 2023 12:46
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