2021-06-09 08:54:30 +02:00
|
|
|
<div id="bot-edit-form" data-user-id="{{user_id}}">
|
2022-01-08 08:28:40 +01:00
|
|
|
<form class="new-style edit_bot_form form-horizontal name-setting">
|
2022-03-31 09:04:36 +02:00
|
|
|
<div class="input-group name_change_container">
|
|
|
|
<label for="full_name">{{t "Full name" }}</label>
|
|
|
|
<input type="text" autocomplete="off" name="full_name" value="{{ full_name }}" />
|
|
|
|
</div>
|
2021-06-09 08:54:30 +02:00
|
|
|
<input type="hidden" name="is_full_name" value="true" />
|
2022-03-31 09:04:36 +02:00
|
|
|
<div class="input-group email_change_container">
|
|
|
|
<label for="email">{{t "Email" }}</label>
|
|
|
|
<input type="text" autocomplete="off" name="email" value="{{ email }}" readonly/>
|
|
|
|
</div>
|
|
|
|
<div class="input-group user_id_container">
|
|
|
|
<label for="user_id">{{t "User ID" }}</label>
|
|
|
|
<input type="text" autocomplete="off" name="user_id" value="{{ user_id }}" readonly/>
|
|
|
|
</div>
|
2022-03-31 09:09:12 +02:00
|
|
|
<div class="input-group">
|
|
|
|
<label class="input-label" for="bot-role-select">{{t 'Role' }}
|
|
|
|
{{> ../help_link_widget link="/help/roles-and-permissions" }}
|
|
|
|
</label>
|
|
|
|
<select name="bot-role-select" id="bot-role-select" data-setting-widget-type="number" {{#if disable_role_dropdown}}disabled{{/if}}>
|
|
|
|
{{> dropdown_options_widget option_values=user_role_values}}
|
|
|
|
</select>
|
|
|
|
</div>
|
2021-06-09 08:54:30 +02:00
|
|
|
<div class="input-group edit_bot_owner_container">
|
|
|
|
<label for="bot_owner_select">{{t "Owner" }}</label>
|
|
|
|
{{> dropdown_list_widget
|
|
|
|
widget_name="edit_bot_owner"
|
2022-02-15 08:41:18 +01:00
|
|
|
list_placeholder=(t 'Filter users')}}
|
user settings: Separate code for bot form.
When editing a bot, there are only two fields
that are similar to humans--full name and
email--which are trivial.
Before this commit we used a single codepath
to build the human form and the bot form.
Now we have two simple codepaths.
The tricky nature of the code had already led
to ugly things for the bot codepath that
fortunately weren't user facing, but which
were distracting:
- For bots we would needlessly set things
like is_admin, is_guest in the template
data.
- For bots we would needlessly try to update
custom profile fields.
The code that differs between bots and humans
is nontrivial, and the code was both hard to read
and hard to improve:
- Humans don't have bot owners.
- Bots don't have custom profile fields.
The bot-owner code is nontrivial for performance
reasons. In a big realm there are tens of thousands
of potential bot owners. We avoid the most egregious
performance problems (i.e we don't have multiple
copies of the dropdown), but we may still want
to refine that (at least adding a spinner).
The custom-profile-fields code is nontrivial due
to the dynamic nature of custom profile fields,
which can bring in specialized widgets like
pill fields.
Now each form corresponds to a single endpoint:
* human -> /json/users
* bot -> /json/bots
Before we had a lot of conditional logic in
the template, the code to build to views, and
the code to submit the data. Now everything is
much flatter.
The human code is still a bit messy (more work
coming on that), but the bot code is fairly
pristine. All three components of the bot code
fit on a page, and there are no conditionals:
- admin_bot_form.hbs
- open_bot_form
- handle_bot_form
We may want to grow out the bot code a bit
to allow admins to do more things, such as
adding services, and this will be easier now.
It would also be easier for us now to share
widgets with the per-user bot settings.
Note that the form for editing human data will
continue to be invoked from two panels:
- Users
- Deactivated users
There are some minor differences between
users and deactivated users, but the shape of
the data is the same for both, so that's still
all one codepath.
We eliminate `reset_edit_user` here, since
it was never used.
One nice thing about these forms was that they
had very little custom CSS attached to them
(at form-level specificity), and it turned out
all the custom CSS was for the human-specific
form.
2020-05-09 12:13:03 +02:00
|
|
|
</div>
|
2022-07-22 21:51:10 +02:00
|
|
|
<div class="input-group new-style">
|
|
|
|
<button class="button rounded btn-danger deactivate_bot_button">
|
|
|
|
{{t 'Deactivate bot' }}
|
|
|
|
</button>
|
|
|
|
</div>
|
2021-06-09 08:54:30 +02:00
|
|
|
</form>
|
user settings: Separate code for bot form.
When editing a bot, there are only two fields
that are similar to humans--full name and
email--which are trivial.
Before this commit we used a single codepath
to build the human form and the bot form.
Now we have two simple codepaths.
The tricky nature of the code had already led
to ugly things for the bot codepath that
fortunately weren't user facing, but which
were distracting:
- For bots we would needlessly set things
like is_admin, is_guest in the template
data.
- For bots we would needlessly try to update
custom profile fields.
The code that differs between bots and humans
is nontrivial, and the code was both hard to read
and hard to improve:
- Humans don't have bot owners.
- Bots don't have custom profile fields.
The bot-owner code is nontrivial for performance
reasons. In a big realm there are tens of thousands
of potential bot owners. We avoid the most egregious
performance problems (i.e we don't have multiple
copies of the dropdown), but we may still want
to refine that (at least adding a spinner).
The custom-profile-fields code is nontrivial due
to the dynamic nature of custom profile fields,
which can bring in specialized widgets like
pill fields.
Now each form corresponds to a single endpoint:
* human -> /json/users
* bot -> /json/bots
Before we had a lot of conditional logic in
the template, the code to build to views, and
the code to submit the data. Now everything is
much flatter.
The human code is still a bit messy (more work
coming on that), but the bot code is fairly
pristine. All three components of the bot code
fit on a page, and there are no conditionals:
- admin_bot_form.hbs
- open_bot_form
- handle_bot_form
We may want to grow out the bot code a bit
to allow admins to do more things, such as
adding services, and this will be easier now.
It would also be easier for us now to share
widgets with the per-user bot settings.
Note that the form for editing human data will
continue to be invoked from two panels:
- Users
- Deactivated users
There are some minor differences between
users and deactivated users, but the shape of
the data is the same for both, so that's still
all one codepath.
We eliminate `reset_edit_user` here, since
it was never used.
One nice thing about these forms was that they
had very little custom CSS attached to them
(at form-level specificity), and it turned out
all the custom CSS was for the human-specific
form.
2020-05-09 12:13:03 +02:00
|
|
|
</div>
|