bot settings: Live-update w/owner name (not email).

This fixes the fact that we update the bot table
with the owner's email instead of a name, but as
the TODO indicates, this is not a full fix, since
I don't linkify the owner name.

To do the full fix properly, I want to make it
so that the `list_render` widgets can just be given
an id of a row to update, and that's coming soon,
hopefully.  If I get sidetracked, the ugly ways to
do this are one of the following:

    - just duplicate what the template does in
      jQuery

    - extract a partial to draw the bot owner link

The full solution here should fix ALL the live
update code in `update_user_data`, which is why
I'm hesitant to add any interim complexity.
This commit is contained in:
Steve Howell 2020-05-10 23:04:27 +00:00 committed by Tim Abbott
parent 47f07eeb2e
commit 393551bf81
1 changed files with 8 additions and 3 deletions

View File

@ -332,9 +332,14 @@ exports.update_user_data = function (user_id, new_data) {
user_row.find(".user_name").text(new_data.full_name);
}
if (new_data.owner !== undefined) {
// Update the bot owner in the table
user_row.find(".owner").text(new_data.owner);
if (new_data.owner_id !== undefined) {
// TODO: Linkify the owner name to match the
// formatting of the list. Ideally we can
// make this whole function simpler
// by re-rendering the entire row via
// the list widget.
const owner_name = bot_owner_full_name(new_data.owner_id);
user_row.find(".owner").text(owner_name);
}
if (new_data.is_active !== undefined) {