mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 07:52:24 -05:00
[bugfix] relax missing preferred_username, instead using webfingered username (#3189)
* support no preferred_username, instead using webfingered username * add tests for the new preferred_username behaviour
This commit is contained in:
parent
4cb3e4d3e6
commit
5212a1057e
7 changed files with 148 additions and 77 deletions
|
|
@ -195,17 +195,12 @@ func ExtractPollOptionables(arr []TypeOrIRI) ([]PollOptionable, []TypeOrIRI) {
|
|||
// ExtractPreferredUsername returns a string representation of
|
||||
// an interface's preferredUsername property. Will return an
|
||||
// error if preferredUsername is nil, not a string, or empty.
|
||||
func ExtractPreferredUsername(i WithPreferredUsername) (string, error) {
|
||||
func ExtractPreferredUsername(i WithPreferredUsername) string {
|
||||
u := i.GetActivityStreamsPreferredUsername()
|
||||
if u == nil || !u.IsXMLSchemaString() {
|
||||
return "", gtserror.New("preferredUsername nil or not a string")
|
||||
return ""
|
||||
}
|
||||
|
||||
if u.GetXMLSchemaString() == "" {
|
||||
return "", gtserror.New("preferredUsername was empty")
|
||||
}
|
||||
|
||||
return u.GetXMLSchemaString(), nil
|
||||
return u.GetXMLSchemaString()
|
||||
}
|
||||
|
||||
// ExtractName returns the first string representation it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue