Skip to content

Commit

Permalink
Adapt GraphQL listeners to listeners config rework
Browse files Browse the repository at this point in the history
  • Loading branch information
Premwoik committed Apr 22, 2022
1 parent 1bdf0a0 commit e85c138
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions big_tests/tests/graphql_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ init_admin_handler(Config) ->
end.

get_listener_opts(EpName) ->
#{modules := Modules} = get_listener_config(EpName),
#{handlers := Handlers} = get_listener_config(EpName),
[Opts2] = lists:filtermap(
fun
({_, _Path, mongoose_graphql_cowboy_handler, Args}) ->
{true, Args};
(_) ->
false
end, Modules),
end, Handlers),
Opts2.

-spec get_err_msg(#{errors := [#{message := binary()}]}) -> binary().
Expand Down Expand Up @@ -105,10 +105,10 @@ get_value([Field | Fields], Data) ->
Data2 = maps:get(BinField, Data),
get_value(Fields, Data2).

is_graphql_config(#{module := ejabberd_cowboy, modules := Modules}, EpName) ->
is_graphql_config(#{handlers := Handlers}, EpName) ->
lists:any(fun({_, _Path, mongoose_graphql_cowboy_handler, Args}) ->
atom_to_binary(EpName) == proplists:get_value(schema_endpoint, Args);
(_) -> false
end, Modules);
end, Handlers);
is_graphql_config(_, _EpName) ->
false.
2 changes: 1 addition & 1 deletion big_tests/tests/rest_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ is_roles_config(#{module := ejabberd_cowboy, handlers := Modules}, client) ->
(_) -> []
end, Modules),
lists:any(fun(["mongoose", "client", "api" | _T]) -> true; (_) -> false end, ModulesTokens);
is_roles_config(#{module := ejabberd_cowboy, modules := Modules}, {graphql, SchemaEndpoint}) ->
is_roles_config(#{module := ejabberd_cowboy, handlers := Modules}, {graphql, SchemaEndpoint}) ->
lists:any(fun({_, _Path, Mod, Args}) ->
Mod == mongoose_graphql_cowboy_handler andalso
SchemaEndpoint == proplists:get_value(schema_endpoint, Args);
Expand Down

0 comments on commit e85c138

Please sign in to comment.