getRemoteUserFromHandle retrieves the profile page of a remote user from the @user@server.tld handle
(app *App, handle string)
| 968 | // getRemoteUserFromHandle retrieves the profile page of a remote user |
| 969 | // from the @user@server.tld handle |
| 970 | func getRemoteUserFromHandle(app *App, handle string) (*RemoteUser, error) { |
| 971 | u := RemoteUser{Handle: handle} |
| 972 | var urlVal sql.NullString |
| 973 | err := app.db.QueryRow("SELECT id, actor_id, inbox, shared_inbox, url FROM remoteusers WHERE handle = ?", handle).Scan(&u.ID, &u.ActorID, &u.Inbox, &u.SharedInbox, &urlVal) |
| 974 | switch { |
| 975 | case err == sql.ErrNoRows: |
| 976 | return nil, ErrRemoteUserNotFound |
| 977 | case err != nil: |
| 978 | log.Error("Couldn't get remote user %s: %v", handle, err) |
| 979 | return nil, err |
| 980 | } |
| 981 | u.URL = urlVal.String |
| 982 | return &u, nil |
| 983 | } |
| 984 | |
| 985 | // getRemoteUserFromURL retrieves a RemoteUser from their public profile URL. |
| 986 | func getRemoteUserFromURL(app *App, urlStr string) (*RemoteUser, error) { |
no outgoing calls
no test coverage detected