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

GraphQL - Implement more commands for MUC #3627

Merged
merged 16 commits into from
Apr 27, 2022

Conversation

Premwoik
Copy link
Contributor

@Premwoik Premwoik commented Apr 11, 2022

This PR refers to MIM-1629 and extends the GraphQL MUC category about new commands.

Extended commands

Command inviteUser

When the room is password secured, then this command attaches the password to the invitation.

The new commands

Command setAffiliation

  • grant member aff,
  • grant admin aff,
  • grant owner aff,
  • ban user (set outcast aff)
  • revoke aff

Command setRole

  • grant voice (participant role),
  • revoke voice (visitant role),
  • grant moderator role

Command listUserAffiliations

Allows listing all users with given affiliation or list all room affiliations.

Commands enterRoom and exitRoom

Allows entering/exiting room per user session with the given nickname.
It is possible to enter the password-secured room.

Command sendPrivateMesssage

The user can send a private message to the other room occupant. The message is sent to the given nickname.

Small GraphQL Bug

When working on this PR I found a bug in graphql_erlang causing a crash when the user passes the wrong type value, and that value is present in more than one enum. The PR with a fix Premwoik/graphql-erlang#1

@Premwoik Premwoik changed the base branch from master to feature/graphql April 11, 2022 13:25
@mongoose-im

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Apr 11, 2022

Codecov Report

Merging #3627 (0d0e86d) into feature/graphql (e85c138) will increase coverage by 0.09%.
The diff coverage is 96.36%.

@@                 Coverage Diff                 @@
##           feature/graphql    #3627      +/-   ##
===================================================
+ Coverage            81.64%   81.74%   +0.09%     
===================================================
  Files                  478      478              
  Lines                33126    33248     +122     
===================================================
+ Hits                 27047    27177     +130     
+ Misses                6079     6071       -8     
Impacted Files Coverage Δ
src/mod_muc_commands.erl 78.12% <71.42%> (-16.71%) ⬇️
src/mod_muc_room.erl 78.70% <94.73%> (+1.09%) ⬆️
...raphql/user/mongoose_graphql_muc_user_mutation.erl 97.95% <95.83%> (-2.05%) ⬇️
...phql/admin/mongoose_graphql_muc_admin_mutation.erl 100.00% <100.00%> (ø)
...graphql/admin/mongoose_graphql_muc_admin_query.erl 100.00% <100.00%> (ø)
src/graphql/mongoose_graphql_enum.erl 80.00% <100.00%> (+16.66%) ⬆️
src/graphql/mongoose_graphql_muc_helper.erl 100.00% <100.00%> (ø)
src/graphql/mongoose_graphql_scalar.erl 71.42% <100.00%> (+4.76%) ⬆️
...c/graphql/user/mongoose_graphql_muc_user_query.erl 100.00% <100.00%> (ø)
src/mod_muc_api.erl 99.45% <100.00%> (+0.31%) ⬆️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e85c138...0d0e86d. Read the comment docs.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@Premwoik Premwoik marked this pull request as ready for review April 12, 2022 08:08
@mongoose-im
Copy link
Collaborator

mongoose-im commented Apr 12, 2022

small_tests_24 / small_tests / 8427ad6
Reports root / small


small_tests_23 / small_tests / 8427ad6
Reports root / small


dynamic_domains_mysql_redis_24 / mysql_redis / 8427ad6
Reports root/ big
OK: 3009 / Failed: 0 / User-skipped: 150 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 8427ad6
Reports root/ big
OK: 3026 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 8427ad6
Reports root/ big
OK: 3026 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 8427ad6
Reports root/ big
OK: 3026 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 8427ad6
Reports root/ big
OK: 1679 / Failed: 0 / User-skipped: 429 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 8427ad6
Reports root/ big
OK: 1679 / Failed: 0 / User-skipped: 429 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 8427ad6
Reports root/ big
OK: 1725 / Failed: 0 / User-skipped: 383 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 8427ad6
Reports root/ big
OK: 3400 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 8427ad6
Reports root/ big
OK: 3400 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 8427ad6
Reports root/ big
OK: 3395 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 8427ad6
Reports root/ big
OK: 3400 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 8427ad6
Reports root/ big
OK: 1886 / Failed: 0 / User-skipped: 379 / Auto-skipped: 0

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

It looks good in general, I added a few comments.

big_tests/tests/graphql_muc_SUITE.erl Outdated Show resolved Hide resolved
big_tests/tests/graphql_muc_SUITE.erl Show resolved Hide resolved
big_tests/tests/graphql_muc_SUITE.erl Show resolved Hide resolved
big_tests/tests/graphql_muc_SUITE.erl Outdated Show resolved Hide resolved
big_tests/tests/graphql_muc_SUITE.erl Outdated Show resolved Hide resolved
priv/graphql/schemas/admin/muc.gql Outdated Show resolved Hide resolved
priv/graphql/schemas/user/muc.gql Outdated Show resolved Hide resolved
priv/graphql/schemas/user/muc.gql Outdated Show resolved Hide resolved
src/mod_muc_api.erl Outdated Show resolved Hide resolved
src/mod_muc_api.erl Outdated Show resolved Hide resolved
@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Looks good 👍

admin_try_invite_user_to_nonexistent_room,
admin_kick_user,
admin_try_kick_user_from_nonexistent_room,
admin_try_kick_user_in_room_without_moderators,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
admin_try_kick_user_in_room_without_moderators,
admin_try_kick_user_from_room_without_moderators,

@@ -24,8 +34,10 @@ type MUCUserQuery @protected{
listRooms(mucDomain: String!, limit: Int, index: Int): MUCRoomsPayload!
"Get configuration of the MUC room"
getRoomConfig(room: JID!): MUCRoomConfig
"Get user list of a given MUC room"
"Get users list of a given MUC room"
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be "user list". Alternatively, "the list of users".

@mongoose-im
Copy link
Collaborator

mongoose-im commented Apr 26, 2022

small_tests_24 / small_tests / 0d0e86d
Reports root / small


small_tests_23 / small_tests / 0d0e86d
Reports root / small


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 0d0e86d
Reports root/ big
OK: 3072 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 0d0e86d
Reports root/ big
OK: 3072 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / 0d0e86d
Reports root/ big
OK: 3055 / Failed: 0 / User-skipped: 150 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 0d0e86d
Reports root/ big
OK: 1688 / Failed: 0 / User-skipped: 431 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 0d0e86d
Reports root/ big
OK: 1688 / Failed: 0 / User-skipped: 431 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 0d0e86d
Reports root/ big
OK: 3072 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 0d0e86d
Reports root/ big
OK: 1734 / Failed: 0 / User-skipped: 385 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 0d0e86d
Reports root/ big
OK: 3446 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 0d0e86d
Reports root/ big
OK: 2048 / Failed: 0 / User-skipped: 386 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 0d0e86d
Reports root/ big
OK: 3441 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 0d0e86d
Reports root/ big
OK: 3446 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 0d0e86d
Reports root/ big
OK: 3446 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 0d0e86d
Reports root/ big
OK: 1895 / Failed: 0 / User-skipped: 381 / Auto-skipped: 0

@Premwoik Premwoik requested a review from chrzaszcz April 26, 2022 15:21
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Looks good :)

@chrzaszcz chrzaszcz merged commit 46c6bc1 into feature/graphql Apr 27, 2022
@chrzaszcz chrzaszcz deleted the graphql/muc-api-cont branch April 27, 2022 05:46
@chrzaszcz chrzaszcz added this to the 6.0.0 milestone Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants