Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions internal/shared/types/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type TeamInfo struct {
Name string `json:"name"`
}

// IsTeamID returns true if matches the pattern of a workspace (T-prefixed) team ID
// IsWorkspaceTeamID returns true if a string matches the pattern of a workspace (T-prefixed) team ID

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

note: Fixing an incorrect Godoc

// Note: This criteria is an estimate, and not directly related to server-side team_id scheme
func IsWorkspaceTeamID(str string) bool {
return strings.HasPrefix(str, "T") && strings.ToUpper(str) == str
Expand All @@ -51,9 +51,3 @@ func IsWorkspaceTeamID(str string) bool {
func IsEnterpriseTeamID(str string) bool {
return strings.HasPrefix(str, "E") && strings.ToUpper(str) == str
}

// IsTeamID returns true if a string matches the pattern of a team id
// Note: Validation criteria is an estimate, and not directly related to server-side team_id scheme
func IsTeamID(str string) bool {
return IsEnterpriseTeamID(str) || IsWorkspaceTeamID(str)
}
Comment on lines -55 to -59

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

note: I'm surprised that we don't use this helper function. At this point, the CLI broadly supports Standalone Workspace Teams, Enterprise Orgs, and OrgWorkspace (whew, what a mouthful of names). If we haven't used this helper yet, then perhaps we don't need it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed that there's no use for it now.

It was last used in #158.

For the existing code, the org and org-workspace checks need to tell the ID types apart, so they need IsWorkspaceTeamID and IsEnterpriseTeamID.

3 changes: 0 additions & 3 deletions internal/shared/types/team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,4 @@ func Test_SlackTeam_Team_Workspace_Enterprise_Identifiers(t *testing.T) {

require.Equal(t, true, IsWorkspaceTeamID(validWorkspaceTeamID), "Workspace team ID should pass as workspace team ID")
require.Equal(t, false, IsWorkspaceTeamID(validEnterpriseID), "Enterprise ID should NOT pass as workspace team ID")

require.Equal(t, true, IsTeamID(validEnterpriseID), "Enterprise ID should pass as a team ID")
require.Equal(t, true, IsTeamID(validWorkspaceTeamID), "Workspace ID should pass as team ID")
}
Loading