Skip to content

Commit

Permalink
better comment docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmcorvidae committed Oct 18, 2024
1 parent b6cc325 commit 54c2cc1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion instantlaunches/mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
"github.com/labstack/echo/v4"
)

// suffixUsername takes a possibly-already-suffixed username, strips any suffix, and adds the provided one, to ensure proper suffixing
func suffixUsername(username, suffix string) string {
re, _ := regexp.Compile(`@.*$`)
return fmt.Sprintf("%s@%s", re.ReplaceAllString(username, ""), strings.Trim(suffix, "@"))
}

// checkUserMatches ensures that `first` and `second` match when both suffixed the same.
func checkUserMatches(first, second, suffix string) bool {
// Just make sure both usernames match when properly suffixed
return (suffixUsername(first, suffix) == suffixUsername(second, suffix))
}

Expand Down

0 comments on commit 54c2cc1

Please sign in to comment.