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 last category #3651

Merged
merged 16 commits into from
May 25, 2022
Merged

Conversation

Premwoik
Copy link
Contributor

@Premwoik Premwoik commented May 17, 2022

This PR addresses MIM-1647 and adds the last category to the GraphQL API. Moreover, all the commends from the account category that need mod_last to work were moved to the last category.

The commands list_old_users, remove_old_users and count_active_users take now a timestamp in ISO date-time format. All users with activity older than the given timestamp are considered old.

Change in granting domain permissions

Domain admin shouldn't be able to execute a query containing fields with optional domain arguments without providing them. null domain argument means that the command should affect the global scope. Thus only global admin should be allowed to do it.

@Premwoik Premwoik changed the title GraphQL - Implement last activity category GraphQL - Implement last category May 17, 2022
@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #3651 (61a918c) into feature/graphql (f403c83) will increase coverage by 0.10%.
The diff coverage is 98.16%.

@@                 Coverage Diff                 @@
##           feature/graphql    #3651      +/-   ##
===================================================
+ Coverage            81.88%   81.99%   +0.10%     
===================================================
  Files                  491      497       +6     
  Lines                33520    33548      +28     
===================================================
+ Hits                 27448    27507      +59     
+ Misses                6072     6041      -31     
Impacted Files Coverage Δ
.../admin/mongoose_graphql_account_admin_mutation.erl 94.73% <ø> (-1.42%) ⬇️
...hql/admin/mongoose_graphql_account_admin_query.erl 100.00% <ø> (ø)
src/graphql/mongoose_graphql.erl 91.30% <ø> (ø)
src/graphql/mongoose_graphql_permissions.erl 91.57% <ø> (+0.95%) ⬆️
src/mod_last.erl 86.56% <ø> (ø)
src/mongoose_account_api.erl 97.26% <ø> (-0.14%) ⬇️
src/admin_extra/service_admin_extra_last.erl 80.00% <66.66%> (+5.00%) ⬆️
src/admin_extra/service_admin_extra_accounts.erl 90.00% <91.66%> (-2.31%) ⬇️
.../graphql/admin/mongoose_graphql_admin_mutation.erl 100.00% <100.00%> (ø)
src/graphql/admin/mongoose_graphql_admin_query.erl 100.00% <100.00%> (ø)
... and 25 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 f403c83...61a918c. Read the comment docs.

@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.

@mongoose-im

This comment was marked as outdated.

@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 May 19, 2022 13:49
Copy link
Contributor

@arcusfelis arcusfelis left a comment

Choose a reason for hiding this comment

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

ok

src/mod_last_api.erl Outdated Show resolved Hide resolved
src/mod_last_api.erl Outdated Show resolved Hide resolved

format_deleted_users(Users) ->
Users2 = [jid:to_binary(JID) || {JID, _} <- Users],
io_lib:format("Deleted ~p users: ~p", [length(Users), Users2]).
Copy link
Contributor

Choose a reason for hiding this comment

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

this will print users with the ugly <<>>.

big_tests/tests/graphql_last_SUITE.erl Outdated Show resolved Hide resolved
@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

Remove old users from the account admin resolver
Remove all tests using mod_last from the graphql_account_SUITE.
…guments

Domain admin shouldn't be able to execute a query containing fields with optional
domain arguments without providing them. Null domain argument means that the command
should affect the global scope. Thus only global admin should be allowed to do it.
@mongoose-im
Copy link
Collaborator

mongoose-im commented May 25, 2022

small_tests_24 / small_tests / 61a918c
Reports root / small


small_tests_23 / small_tests / 61a918c
Reports root / small


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 61a918c
Reports root/ big
OK: 3118 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 61a918c
Reports root/ big
OK: 3118 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / 61a918c
Reports root/ big
OK: 3113 / Failed: 1 / User-skipped: 150 / Auto-skipped: 0

muc_SUITE:hibernation:hibernated_room_can_be_queried_for_archive
{error,{{assertion_failed,assert,is_groupchat_message,
              [<<"Restorable message">>],
              undefined,"undefined"},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {muc_SUITE,wait_for_mam_result,3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4383}]},
     {muc_SUITE,'-hibernated_room_can_be_queried_for_archive/1-fun-0-',3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4124}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {muc_SUITE,hibernated_room_can_be_queried_for_archive,1,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4120}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1292}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1224}]}]}}

Report log


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 61a918c
Reports root/ big
OK: 3118 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 61a918c
Reports root/ big
OK: 1705 / Failed: 0 / User-skipped: 460 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 61a918c
Reports root/ big
OK: 1767 / Failed: 0 / User-skipped: 398 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 61a918c
Reports root/ big
OK: 1705 / Failed: 0 / User-skipped: 460 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 61a918c
Reports root/ big
OK: 2081 / Failed: 0 / User-skipped: 399 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 61a918c
Reports root/ big
OK: 3492 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 61a918c
Reports root/ big
OK: 3492 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 61a918c
Reports root/ big
OK: 3487 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 61a918c
Reports root/ big
OK: 3514 / Failed: 2 / User-skipped: 142 / Auto-skipped: 0

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_unsubscribe_after_presence_unsubscription_2084@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2084@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"q61Mq2tNkoes7jIf80BNpw==">>}],
            [{xmlel,<<"item">>,
               [{<<"id">>,<<"salmon">>}],
               [{xmlel,<<"entry">>,
                  [{<<"xmlns">>,
                  <<"http://www.w3.org/2005/Atom">>}],
                  []}]}]}]},
         {xmlel,<<"headers">>,
           [{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
           []}]}]},
   [{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
       {line,384}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_unsubscribe_after_presence_unsubscription_2098@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2098@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"SRCa/ATfc9d7PM2L2eBFIQ==">>}],
            [{xmlel,<<"item">>,
               [{<<"id">>,<<"salmon">>}],
               [{xmlel,<<"entry">>,
                  [{<<"xmlns">>,
                  <<"http://www.w3.org/2005/Atom">>}],
                  []}]}]}]},
         {xmlel,<<"headers">>,
           [{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
           []}]}]},
   [{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
       {line,384}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log


riak_mnesia_24 / riak_mnesia / 61a918c
Reports root/ big
OK: 1928 / Failed: 0 / User-skipped: 394 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 61a918c
Reports root/ big
OK: 3492 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0

@arcusfelis arcusfelis merged commit d3cc423 into feature/graphql May 25, 2022
@arcusfelis arcusfelis deleted the graphql/last-api branch May 25, 2022 10:34
@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants