Skip to content

Conversation

@stuartcampbell
Copy link
Collaborator

@stuartcampbell stuartcampbell commented May 1, 2025

For users that need to be invited in the NSLS2 workspace, they will not appear as a member of the channel that they are invited into until they accept the invite, but for any additional channels that we add the user to they will appear instantly. In order to avoid confusion this PR intends to, once the new user is invited to the workspace, we then also add it to the channel at the same time.

@stuartcampbell stuartcampbell requested a review from Copilot May 2, 2025 15:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to make the invitation of Slack users more robust by enhancing error handling and improving the invitation flow.

  • Added handling for ultra-restricted users in conversation_invite.
  • Introduced a new helper function get_userid_by_username and updated invite_newuser_to_channel to return a user_id.
  • Updated proposal channel logic to store managers and bots while processing user invitations.

stuartcampbell and others added 3 commits May 2, 2025 11:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@stuartcampbell stuartcampbell requested a review from Copilot May 2, 2025 15:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances the Slack invitation flow by inviting new workspace users directly into the channel upon invitation and handling edge cases with restricted users more gracefully.

  • Force-invokes channel invites by using the force parameter.
  • Introduces error handling for ultra-restricted users.
  • Refactors the invitation process to look up new users immediately after inviting.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@stuartcampbell stuartcampbell requested a review from Copilot May 2, 2025 15:57
@stuartcampbell stuartcampbell self-assigned this May 2, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the Slack invitation flow by ensuring that new workspace invites and channel additions are robust and clear to users. Key changes include adding a force parameter to the conversations_invite API call, introducing error handling for ultra-restricted users, and refactoring the invitation logic (including adding a new function to retrieve user IDs by username) to ensure consistency and clarity.

Comments suppressed due to low confidence (1)

src/nsls2api/services/slack_service.py:363

  • [nitpick] Add a comment to clarify that if lookup_user_by_email returns None after a successful invite, the function will return None, ensuring clarity on how failures in user retrieval post-invitation are handled.
if response.get("ok"):

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@stuartcampbell stuartcampbell merged commit c9881bc into NSLS2:main May 2, 2025
4 checks passed
@stuartcampbell stuartcampbell deleted the slack_invite_users branch May 2, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants