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:
Anant Prakash 2018-05-31 19:51:13 +05:30 committed by Andrew Morgan
parent 7ac1efc4b3
commit 05be8d1c99
3 changed files with 14 additions and 16 deletions

View file

@ -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))
}