-
Notifications
You must be signed in to change notification settings - Fork 428
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
Further mod_disco rework #3146
Further mod_disco rework #3146
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3146 +/- ##
==========================================
+ Coverage 79.51% 79.74% +0.22%
==========================================
Files 397 397
Lines 32321 32305 -16
==========================================
+ Hits 25701 25761 +60
+ Misses 6620 6544 -76
Continue to review full report at Codecov.
|
Before: - mod_http_upload registered IQ handler, which called mod_disco - mod_disco called 3 hooks, which called handlers in mod_http_upload - these handlers returned identity, items and features - mod_disco constructed the response Now: - mod_http_upload registers IQ handler, which returns the response
- Identities stored in a map - No duplicate removal, just like before (not necessary now)
- Convert mod_disco - Convert mod_adhoc - add tests - Convert mod pubsub - rework local features as well (should be done already) - add tests for pubsub and pep identity
All modules using the hook are updated. Other changes: - mongoose_hooks: fix a bug (wrong hook name) - mod_adhoc: test sm features, reorganize tests - mod_offline: test sm features - mod_pubsub: test sm features in pubsub (negative) and pep (positive)
All modules using the hook are updated. Other changes: - mod_adhoc: add tests - pubsub: add PEP test, fix a bug discovered by the test
All modules using the hook are updated. Other changes: - mod_adhoc: added test for the command NS - mod_pubsub: updated pep test to check the identity
Improve coverage of mod_disco: - Cover SM discovery for online user resources - Cover the case when a bad node name is specified
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.
added some coomens
disco_iq_handler(_From, _To, Acc, #iq{type = set, sub_el = SubEl} = IQ) -> | ||
{Acc, IQ#iq{type = error, sub_el = [SubEl, mongoose_xmpp_errors:not_allowed()]}}; | ||
disco_iq_handler(_From, To, Acc, #iq{type = get, lang = Lang, sub_el = SubEl} = IQ) -> | ||
LServer = To#jid.lserver, |
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.
could be matched in the function clause.
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.
I'd rather limit the clause head to be less than 100 characters.
{<<"name">>, ItemId}]} | ||
|| #pubsub_item{itemid = {ItemId, _}} <- Items]}; | ||
{result, [disco_item(Host, ItemId) || | ||
#pubsub_item{itemid = {ItemId, _}} <- Items]}; |
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.
should be nice to have [pubsub_to_disco_item(Host, Item) || Item Item <- Items]
. So, we would start crashing, if itemid format changes.
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.
Good idea, but I think I will limit the changes for now. That code might return items that are not matching the pattern and the filtering might be done on purpose - I don't want to dive deeper into pubsub code now, especially that there are virtually no tests or type specs.
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.
LGTM
- Make IQ errors more descriptive - Change IQ handler names - Add tests for the IQ error cases
Further preparation and cleanup of disco-related code.
Some functionality was untested (and even broken). Tests added, bugs fixed. This will help assure that after introducing host types everything is still working.
Planned for the next PR: introduce host types to
mod_disco
and all the hooks to support dynamic domains.Skipped for now: unit tests for
mongoose_disco
. It is a simple module covered by multiple functional tests.Not sure: more pubsub tests. It's a deep rabbit hole, so I needed to stop at some point. A few lines I touched remain untested, just as before.