Add TODOs for improving GetProfilePageFromHandle()

This commit is contained in:
Matt Baer 2020-02-08 13:05:54 -05:00
parent ca4b0acf60
commit 9589612d0e
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2018-2019 A Bunch Tell LLC.
* Copyright © 2018-2020 A Bunch Tell LLC.
*
* This file is part of WriteFreely.
*
@ -715,7 +715,7 @@ func getRemoteUserFromHandle(app *App, handle string) (*RemoteUser, error) {
err := app.db.QueryRow("SELECT id, actor_id, inbox, shared_inbox FROM remoteusers WHERE handle = ?", handle).Scan(&u.ID, &u.ActorID, &u.Inbox, &u.SharedInbox)
switch {
case err == sql.ErrNoRows:
return nil, impart.HTTPError{http.StatusNotFound, "No remote user with that handle."}
return nil, ErrRemoteUserNotFound
case err != nil:
log.Error("Couldn't get remote user %s: %v", handle, err)
return nil, err

View File

@ -2563,6 +2563,7 @@ func (db *datastore) GetProfilePageFromHandle(app *App, handle string) (string,
if err != nil {
// can't find using handle in the table but the table may already have this user without
// handle from a previous version
// TODO: Make this determination. We should know whether a user exists without a handle, or doesn't exist at all
actorIRI = RemoteLookup(handle)
_, errRemoteUser := getRemoteUser(app, actorIRI)
// if it exists then we need to update the handle