Skip to content

Conversation

@sahil839
Copy link
Collaborator

@sahil839 sahil839 commented Dec 11, 2025

  • First commit is a preparatory commit.
  • Second commit is to duplicate bots panel for "Personal" tab to fix keyboard navigation.

Fixes:

Screenshots and screen captures:

Screencast.from.2025-12-11.15-45-32.webm
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

@timabbott timabbott added the maintainer review PR is ready for review by Zulip maintainers. label Dec 17, 2025
@timabbott
Copy link
Member

@shubham-padia can you do maintainer review on this one?

@shubham-padia
Copy link
Member

The settings header is now Settings / BotsBots since we have two elements with data-section=bots.

Copy link
Member

@shubham-padia shubham-padia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great in testing! Only behavioural thing I could notice was the BotsBots thing mentioned in another comment.

Left some comments mostly focusing on deduplication.

#admin-user-list,
#admin-bot-list {
#admin-bot-list,
#personal-bot-list {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's worth the extra effort on a less-touched part of the codebase, but I think it would be better to have a prefix agnostic selector here instead of duplicating it.

Copy link
Collaborator Author

@sahil839 sahil839 Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to refactor the classes and ID names later mainly because admin-bot-list does not seem correct since it is actionable for non-admins as well. So, I think we can handle this then.

$(".personal-bot-settings-switcher"),
);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can also deduplicate b/w show_personal_bot_settings_toggler and show_org_bot_settings_toggler by accepting a prefix and a toggler instance?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added show_bot_settings_toggler function for this.

}
$(`[data-bot-settings-section="${CSS.escape(key)}"]`).show();
},
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be deduplicating the toggle creating logic. We could accept a prefix and a function to set the settings_tab e.g. set_bot_personal_settings_tab. Another comment of mine also proposes changing that function such that it accepts a prefix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added function to deduplicate creating logic as well.

this.current_tab = this.$curr_li.attr("data-section")!;
this.current_user_settings_tab = "active";
this.current_bot_settings_tab = "all-bots";
this.current_bot_personal_settings_tab = "your-bots";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking whether we could have

this.current_bot_settings_tab = {
"personal": "your-bots",
"org": "all-bots"
}

Then we can change the set settings tab to pass prefix as well and we won't need two set settings tab functions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't end up doing this, we should look at renaming instances of bot_settings which actually mean org_bot_settings e.g. current_bot_settings_tab

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this change of current_bot_settings_tab being an object.

}
if (personal_your_bots_section.list_widget) {
personal_your_bots_section.list_widget.replace_list_data(bot_user_ids_for_current_owner);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we end up redrawing personal bots section when redrawing org your bots section always?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, we have four separate ListWidget, two ("Your bots" and "All bots") each for "Personal" and "Organization" and we redraw them only if they have been set up once previously.

@shubham-padia
Copy link
Member

shubham-padia commented Dec 22, 2025

last commit has typo in maintaing

@sahil839 sahil839 force-pushed the bots-panel branch 2 times, most recently from 2abd46e to fc237d1 Compare December 23, 2025 11:09
@sahil839
Copy link
Collaborator Author

Made the changes as per feedback. Posted replies to the comments as well. I also remember to update the lock-icon behavior in the left panel, will push update for that soon.

@sahil839
Copy link
Collaborator Author

sahil839 commented Dec 23, 2025

Added a commit to fix lock icon to not be shown when user can either create bots or can manage any bot as discussed on CZO. Also updated the tooltip for the lock icon to be You do not have permission to create or manage bots..

Copy link
Member

@shubham-padia shubham-padia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just need to clarify one question, rest should be fine.

drafts.initialize(); // Must happen before reload_setup.initialize()
reload_setup.initialize();
unread.initialize(state_data.unread);
bot_data.initialize(state_data.bot); // Must happen after people.initialize()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we move this up?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to call this before settings.initialize so that lock icon can be shown for a non-admin correctly based on if they own any bot to manage or not. I will add a comment on that.

We always pass a string value to set_bot_settings_tab in
settings_panel_menu.ts, so we can update the type of
variable to "string" from "string | undefined".
We previously showed lock icon for "Bots" panel in left sidebar
when user was not allowed to create new bots even when user
could manage other bots. This commit updates that to not show
lock icon when the user can manage bots as the panel is still
useful to that user.

Also updated the tooltip to be more clear about what permission
the user doesn't have.
This commit does some preparatory work for duplicating bots panel
in "Personal" tab, i.e. we do not redirect to the "Organization"
tab bots panel when clicking on bots panel in "Personal" tab.

The changes done are -
- Updated IDs in templates to have a prefix so that the same
template can be reused without duplicate IDs.
- Added classes to some elements so that it is easy to query
them using class selectors instead of ID.
- Updated JS code to rename variables and function declarations
to accept container elements and/or section so that same JS code
can be used for both bot panels.
- Did some changes in settings_panel_menu.ts to support same
"section" value for sections in "Personal" and "Organization"
tabs.
- Updated tab related code in settings_panel_menu.ts to support
two bot panels. And also updated the toggler related code so
that we can avoid code duplication when using togglers for two
bot panels.
Previously, clicking on "Bots" in "Personal" tab redirected
to bots panel in "Organization" tab. This commit changes this
behavior to not redirect and instead show the same content
shown in bots panel in "Organization" tab in the "Personal"
tab and opening "Your bots" section by default instead of
"All bots".

Now "Bots" in both "Personal" and "Organization" opens
different sections independent of each other maintaining
their individual filter and search value selected.

This helps in maintaining the keyboard navigation using
up/down keys in the settings sidebar which was broken
due to redirecting.

We also now show lock icon for the personal bots panel
if user does not have permission to create or manage
bots like we do for organization bots panel.
@shubham-padia
Copy link
Member

Looks good!

@shubham-padia shubham-padia added integration review Added by maintainers when a PR may be ready for integration. and removed integration review Added by maintainers when a PR may be ready for integration. labels Dec 24, 2025
@shubham-padia shubham-padia removed their assignment Dec 24, 2025
@sahil839 sahil839 added integration review Added by maintainers when a PR may be ready for integration. and removed maintainer review PR is ready for review by Zulip maintainers. labels Dec 24, 2025
@alya
Copy link
Contributor

alya commented Dec 25, 2025

Works for me in manual testing!

By the way, since I was playing with keyboard nav, I noticed that pressing "Enter" on "All bots" or "Your bots" tabs doesn't work -- the focus just bounces to the "Add a new bot" button without switching panels. Not sure if this is known?

@sahil839
Copy link
Collaborator Author

It is same for the users panel as well where focus bounces on the role dropdown. Will investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration review Added by maintainers when a PR may be ready for integration. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants