Skip to content
This repository was archived by the owner on May 25, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions src/global_changes_httpd.erl
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,17 @@ transform_change(Username, _Resp, {Props}) ->
{id, Id} = lists:keyfind(id, 1, Props),
{seq, Seq} = lists:keyfind(seq, 1, Props),
Info = case binary:split(Id, <<":">>) of
[Event0, DbNameAndUsername] ->
case binary:split(DbNameAndUsername, <<"/">>) of
[AccountName0, DbName0] ->
{Event0, AccountName0, DbName0};
[DbName0] ->
{Event0, '_admin', DbName0}
end;
[Event0, DbName0] ->
{Event0, DbName0};
_ ->
skip
end,
case Info of
% Matches the client's username
{Event, Username, DbName} when Username /= admin ->
{[
{dbname, DbName},
{type, Event},
{seq, Seq}
]};
% Client is an admin, show them everything.
{Event, AccountName, DbName} when Username == admin ->
{Event, DbName} when Username == admin ->
{[
{dbname, DbName},
{db_name, DbName},
{type, Event},
{account, AccountName},
{seq, Seq}
]};
_ ->
Expand Down Expand Up @@ -230,7 +217,7 @@ parse_global_changes_query(Req) ->
{"heartbeat", "true"} ->
[{heartbeat, true} | Args];
{"heartbeat", "false"} ->
Args;
Args;
{"heartbeat", _} ->
[{heartbeat, to_non_neg_int(Value)} | Args];
{"timeout", _} ->
Expand Down