settings: Hide invite users link in settings overlay based on settings.

There was a bug where invite users link is shown in the Invitations
section of settings overlay, irrespective if the user is allowed to
invite or not based on the realm settings. So here we just use the
'can_invite_others_to_realm' field of page_params, that was added in
previous commit itself to hide the link accordingly.

Also added the code in server_events_dispatch.js for this field.
Though it doesn't do live update when the overlay is opened similar
to other policies like create_stream_policy, but it ensures that the
visibility of link is correct if the overlay is opened after the
settings has changed.

We should probably do the complete live update in future of the
elements related to such realm settings.
This commit is contained in:
sahil839
2021-04-04 19:17:33 +05:30
committed by Tim Abbott
parent 86f7b6af60
commit c6e553427a
5 changed files with 18 additions and 0 deletions

View File

@@ -348,6 +348,9 @@ run_test("realm settings", (override) => {
event = event_fixtures.realm__update__invite_required;
test_realm_boolean(event, "realm_invite_required");
event = event_fixtures.realm__update__invite_to_realm_policy;
test_realm_integer(event, "realm_invite_to_realm_policy");
event = event_fixtures.realm__update__name;
test_electron_dispatch(event, (key, val) => {