Move makeUserID into userutil and prevent code duplication (#475)
* Move makeUserID into userutil and prevent code duplication * Correct ungraceful merge
This commit is contained in:
parent
7ac1efc4b3
commit
05be8d1c99
3 changed files with 14 additions and 16 deletions
|
|
@ -14,6 +14,7 @@ package userutil
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
|
@ -41,3 +42,8 @@ func ParseUsernameParam(usernameParam string, expectedServerName *gomatrixserver
|
|||
}
|
||||
return localpart, nil
|
||||
}
|
||||
|
||||
// MakeUserID generates user ID from localpart & server name
|
||||
func MakeUserID(localpart string, server gomatrixserverlib.ServerName) string {
|
||||
return fmt.Sprintf("@%s:%s", localpart, string(server))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue