Commit Graph

14 Commits

Author SHA1 Message Date
sahil839 569ef48699 popovers: Rename data-owner-id and data-bot-owner-id to data-user-id.
We rename data-bot-owner-id and data-owner-id, used to open user
profile of bot owners, to data-user-id such that we can make a
global click handler for all of them by making a separate class
in next commit.
2020-09-22 15:42:53 -07:00
sahil839 dbd64c4362 settings_users: Only owner can deactivate other owners.
This commit adds the restriction of deactivating owners for admins
by disabling the deactivating button in the UI. Only owners are
allowed to deactivate other owners. The backend part of this is
already implemented in 86b52ef.
2020-06-14 21:20:30 -07:00
sahil839 c7a68d60f3 realm owner: Add frontend implementation of owner role.
This commit adds the option of owner role in user role dropdown
and also takes care of the restrictions while adding/removing
owner status of the user.
This commit also handles the places where we dispaly role of
the user in UI.
2020-06-14 21:20:30 -07:00
Steve Howell 2df183142c user settings: Flatten template data.
We now no longer have to remember that
`is_guest` is on `user` but `is_current_user`
is in `..`.

And we no longer have to remember that
`full_name` is on `user` but `display_email`
is in `..`.
2020-05-09 10:41:14 -07:00
Tim Abbott 09b5f053ea settings: Fix i18n tagging of `(you)` to be consistent.
We use this elsewhere in the frontend codebase with the parents
included in the i18n, so we should stick with that.

Fixes `check-capitalization` failing as a side effect.
2020-04-23 17:28:34 -07:00
Jagan c69dc720ff admin user list: Replace the buttons with icons.
1. Replaced the deactivate and reactivate buttons with icons.
2. Added (you) near the current user name to denote his/her account in
the entire user list.

Tweaked by tabbott to reuse the (you) formatting from the right
sidebar here for readability and consistency.

Fixes #6313.
2020-04-23 16:49:57 -07:00
Steve Howell c9d0c6852e admin users: Use plain HTML and static dates.
We want to avoid creating jQuery objects that just
get turned right back into strings by the list
widget, so we now have our template just include
`last_active_date` instead of kludging it in
after the fact, and we return the template
string in `modifier` rather than wrapping it.

To deal with plain HTML we switch to using
`render_now`.

Calling `render_now` leads to a more simple
codepath than `render_date`, beyond just dealing
with text.

The `render_date` function has special-case logic
that only applies to our time dividers in our
message view, which is why we were passing the
strange `undefined` parameter to it before this
fix.

The `render_date` function was also putting
the dates into `update_list` for once-a-day
updates, which is overkill for an admin screen.
We don't use this logic for drafts or attachments
either.  I'm not sure how well tested that logic
is, and it's prone to slow leaks.

This commit sets us up to simplify the list
widget not to have bit-rot-prone code related
to jQuery objects.
2020-04-15 15:13:26 -07:00
Steve Howell ca79648dd7 admin user: Remove obsolete data-email markup.
We mostly needed this for Casper tests, and that
usage was eliminated in the prior commit.

There was also some strange defensive code from
ecc42bc9f8 that
is really ancient and which I am eliminating:

    const email = row.attr("data-email");

    if ($("#deactivation_user_modal .email").html() !== email) {
        blueslip.error("User deactivation canceled due to non-matching fields.");
        ui_report.message(i18n.t("Deactivation encountered an error. Please reload and try again."),
                          $("#home-error"), 'alert-error');
    }

If the code was there to protect against live
updates for email changes, then we no longer
have to worry about that, since we use user_ids
now as keys.

Or it might have to do with some ancient bug
where you could pop open two modals at once
or something.  You can actually change users while
the modal is open (which is kinda strange, but ok),
and it works fine.

When testing this, I ran into the glitch that we
don't open redraw the Deactivated Users panel after
going into the User panel and deactivating a user.
2020-01-29 17:01:19 -08:00
Steve Howell 3e4326afda refactor: Extract email_for_user_settings.
We want to be able to unit test this value,
since it's conditional on several factors:

    - am I an admin?
    - can non-admins view emails?
    - do we have delivery_email for the user?

I'm mocking show_email in the tests, since the
show_email code is in `settings_org` and
kind of hard to unit test.  It's not impossible,
but it's too much for this commit.  (Either
we need to extract it out to a nice file or
deal with mocking jQuery.  That module is
mostly data-oriented, so it would be nice
to have something like `settings_config` that
is actually pure data.)
2019-12-28 11:22:24 -08:00
Gaurav Thapar 2346dc84df bots: Render bot owner name in bots settings as link to show owner profile.
If owner exists, show owner name as link in org. settings which on click
trigger owner profile popup.

Fixes: #13388.
2019-12-06 12:00:07 -08:00
Tim Abbott 44f9ce92e9 bots: Fix rendering of bot owner fields in admin settings.
This fixes two regressions in 1946692f9a.

The first bug was actually introduced much earlier, namely that we
were not sending a `bot_owner_id` field at all for bot users without
an owner.  The correct behavior would have been send `None` for the
owner field.

The second bug was simply that we needed to update the webapp to look
for the `bot_owner_id` field, rather than an old email-address format
`bot_owner` field.

Thanks to Vinit Singh for reporting this bug.
2019-11-08 15:09:44 -08:00
Thomas Ip d86299309a org settings: Reduce the width occupied by the actions column in tables. 2019-08-22 13:13:24 -07:00
Pragati Agrawal 5b324e50ca users: Apply email_address_visibility policy on the users list.
In the emails-hidden case, for non-admins, we should remove the email
field from "Users" list in the organization settings page.

Tweaked by tabbott to correctly handle the bots and deactivated users pages.
2019-08-02 15:28:36 -07:00
Anders Kaseorg 3c3471b720 templates: Rename *.handlebars ↦ *.hbs and - ↦ _.
Tweaked by tabbott to avoid accidentally disabling the linter for
handlebars templates.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:03 -07:00