-
Notifications
You must be signed in to change notification settings - Fork 426
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
Implement XEP-0004: Data Forms in a separate module #4028
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #4028 +/- ##
==========================================
+ Coverage 82.19% 82.21% +0.02%
==========================================
Files 535 536 +1
Lines 33841 33782 -59
==========================================
- Hits 27814 27774 -40
+ Misses 6027 6008 -19
☔ View full report in Codecov by Sentry. |
8ea30bb
to
71a170c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
71a170c
to
f1c34e2
Compare
This comment was marked as outdated.
This comment was marked as outdated.
f1c34e2
to
e37cc5a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
e37cc5a
to
2e87805
Compare
This comment was marked as outdated.
This comment was marked as outdated.
2e87805
to
986baf4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
46b403d
to
c996159
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c996159
to
1f688d1
Compare
This comment was marked as outdated.
This comment was marked as outdated.
01415a3
to
c9624c1
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
The implementation is divided into two parts: - Parsing of submitted forms into a parsed_form() map - Form construction, which builds XML from a form() map The form should be parsed/constructed only once. Ideally we should minimize the operations on plain XML, i.e.: - Parsing should be done as early as possible. - Construction should be done as late as possible.
814af89
to
4f2bbf2
Compare
The form is now parsed to a map instead of a KV list, because it is later converted to JSON, which is saved to RDBMS. The DB can alter the order of JSON pairs when they are read, which makes pattern-matching for already sent push notifications fail unpredictably, resulting in double notifications, i.e. by using maps we eliminate an elusive bug.
This comment was marked as outdated.
This comment was marked as outdated.
The previous implementation rteated some invalid values as undefined, so the current one does the same. We might replace this with more elaborate errors in the future.
4f2bbf2
to
3c34031
Compare
- Expect map instead of list (internal format has changed) - Remove test repetition
3c34031
to
4ff9d5a
Compare
small_tests_24 / small_tests / 3c34031 small_tests_25_arm64 / small_tests / 3c34031 small_tests_25 / small_tests / 3c34031 ldap_mnesia_24 / ldap_mnesia / 3c34031 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 3c34031 ldap_mnesia_25 / ldap_mnesia / 3c34031 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 3c34031 pgsql_mnesia_24 / pgsql_mnesia / 3c34031 dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 3c34031 dynamic_domains_mysql_redis_25 / mysql_redis / 3c34031 elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 3c34031 internal_mnesia_25 / internal_mnesia / 3c34031 mysql_redis_25 / mysql_redis / 3c34031 mssql_mnesia_25 / odbc_mssql_mnesia / 3c34031 |
small_tests_24 / small_tests / 4ff9d5a small_tests_25_arm64 / small_tests / 4ff9d5a small_tests_25 / small_tests / 4ff9d5a ldap_mnesia_24 / ldap_mnesia / 4ff9d5a dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 4ff9d5a dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 4ff9d5a ldap_mnesia_25 / ldap_mnesia / 4ff9d5a dynamic_domains_mysql_redis_25 / mysql_redis / 4ff9d5a dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 4ff9d5a internal_mnesia_25 / internal_mnesia / 4ff9d5a pgsql_mnesia_24 / pgsql_mnesia / 4ff9d5a elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 4ff9d5a pgsql_mnesia_25 / pgsql_mnesia / 4ff9d5a mysql_redis_25 / mysql_redis / 4ff9d5a mssql_mnesia_25 / odbc_mssql_mnesia / 4ff9d5a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I've added minor formatting comments, but in my opinion they are too minor to be relevant.
jlib:parse_xdata_submit(XEl)) of | ||
-spec is_allowed_log_change([{binary(), [binary()]}], state(), jid:jid()) -> boolean(). | ||
is_allowed_log_change(XData, StateData, From) -> | ||
case lists:keymember(<<"muc#roomconfig_enablelogging">>, 1, XData) of | ||
false -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation, minor
jlib:parse_xdata_submit(XEl)) of | ||
-spec is_allowed_persistent_change([{binary(), [binary()]}], state(), jid:jid()) -> boolean(). | ||
is_allowed_persistent_change(XData, StateData, From) -> | ||
case lists:keymember(<<"muc#roomconfig_persistentroom">>, 1, XData) of | ||
false -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation, minor
The main goal is to have a single module that implements XEP-0004 and XEP-0068 for better separation of concerns, reusability and less
xmlel
manipulation.The implementation is divided into two parts:
parsed_form()
mapform()
mapThe two data structures are different, because they serve different purposes, but they are both maps.
The form should be parsed/constructed only once. Ideally we should minimize the operations on plain XML elements, i.e.:
Other changes:
Excluded from this PR: