2023-03-12 18:00:57 +03:00
// GoToSocial
// Copyright (C) GoToSocial Authors admin@gotosocial.org
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
2021-08-10 14:32:39 +03:00
package dereferencing
import (
"context"
"errors"
"fmt"
"net/url"
2021-08-29 13:03:08 +03:00
"strings"
2021-08-10 14:32:39 +03:00
"github.com/superseriousbusiness/gotosocial/internal/ap"
2022-11-29 12:24:55 +03:00
"github.com/superseriousbusiness/gotosocial/internal/config"
2022-09-12 14:03:23 +03:00
"github.com/superseriousbusiness/gotosocial/internal/db"
2021-08-10 14:32:39 +03:00
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id"
2022-07-19 11:47:55 +03:00
"github.com/superseriousbusiness/gotosocial/internal/log"
2022-01-09 20:41:22 +03:00
"github.com/superseriousbusiness/gotosocial/internal/media"
2023-03-01 20:52:44 +03:00
"github.com/superseriousbusiness/gotosocial/internal/transport"
2021-08-10 14:32:39 +03:00
)
2022-11-29 12:24:55 +03:00
// EnrichRemoteStatus takes a remote status that's already been inserted into the database in a minimal form,
2021-08-10 14:32:39 +03:00
// and populates it with additional fields, media, etc.
//
// EnrichRemoteStatus is mostly useful for calling after a status has been initially created by
// the federatingDB's Create function, but additional dereferencing is needed on it.
2021-09-14 13:23:56 +03:00
func ( d * deref ) EnrichRemoteStatus ( ctx context . Context , username string , status * gtsmodel . Status , includeParent bool ) ( * gtsmodel . Status , error ) {
if err := d . populateStatusFields ( ctx , status , username , includeParent ) ; err != nil {
2021-08-10 14:32:39 +03:00
return nil , err
}
2022-11-15 21:45:15 +03:00
if err := d . db . UpdateStatus ( ctx , status ) ; err != nil {
return nil , err
}
return status , nil
2021-08-10 14:32:39 +03:00
}
2022-11-29 12:24:55 +03:00
// GetStatus completely dereferences a status, converts it to a GtS model status,
2022-05-23 18:40:03 +03:00
// puts it in the database, and returns it to a caller.
2021-08-10 14:32:39 +03:00
//
2022-05-23 18:40:03 +03:00
// If refetch is true, then regardless of whether we have the original status in the database or not,
// the ap.Statusable representation of the status will be dereferenced and returned.
2021-08-10 14:32:39 +03:00
//
2022-05-23 18:40:03 +03:00
// If refetch is false, the ap.Statusable will only be returned if this is a new status, so callers
// should check whether or not this is nil.
2021-08-10 14:32:39 +03:00
//
2022-11-29 12:24:55 +03:00
// GetAccount will guard against trying to do http calls to fetch a status that belongs to this instance.
// Instead of making calls, it will just return the status early if it finds it, or return an error.
func ( d * deref ) GetStatus ( ctx context . Context , username string , statusURI * url . URL , refetch , includeParent bool ) ( * gtsmodel . Status , ap . Statusable , error ) {
uriString := statusURI . String ( )
// try to get by URI first
status , dbErr := d . db . GetStatusByURI ( ctx , uriString )
if dbErr != nil {
if ! errors . Is ( dbErr , db . ErrNoEntries ) {
// real error
return nil , nil , newErrDB ( fmt . Errorf ( "GetRemoteStatus: error during GetStatusByURI for %s: %w" , uriString , dbErr ) )
}
// no problem, just press on
} else if ! refetch {
2022-05-23 18:40:03 +03:00
// we already had the status and we aren't being asked to refetch the AP representation
2022-11-29 12:24:55 +03:00
return status , nil , nil
2021-08-10 14:32:39 +03:00
}
2022-11-29 12:24:55 +03:00
// try to get by URL if we couldn't get by URI now
if status == nil {
status , dbErr = d . db . GetStatusByURL ( ctx , uriString )
if dbErr != nil {
if ! errors . Is ( dbErr , db . ErrNoEntries ) {
// real error
return nil , nil , newErrDB ( fmt . Errorf ( "GetRemoteStatus: error during GetStatusByURI for %s: %w" , uriString , dbErr ) )
}
// no problem, just press on
} else if ! refetch {
// we already had the status and we aren't being asked to refetch the AP representation
return status , nil , nil
}
2022-05-23 18:40:03 +03:00
}
2022-11-29 12:24:55 +03:00
// guard against having our own statuses passed in
if host := statusURI . Host ; host == config . GetHost ( ) || host == config . GetAccountDomain ( ) {
// this is our status, definitely don't search for it
if status != nil {
return status , nil , nil
}
2023-02-03 23:03:05 +03:00
return nil , nil , NewErrNotRetrievable ( fmt . Errorf ( "GetRemoteStatus: uri %s is apparently ours, but we have nothing in the db for it, will not proceed to dereference our own status" , uriString ) )
2022-11-29 12:24:55 +03:00
}
// if we got here, either we didn't have the status
// in the db, or we had it but need to refetch it
2023-03-01 20:52:44 +03:00
tsport , err := d . transportController . NewTransportForUsername ( ctx , username )
if err != nil {
return nil , nil , newErrTransportError ( fmt . Errorf ( "GetRemoteStatus: error creating transport for %s: %w" , username , err ) )
}
statusable , derefErr := d . dereferenceStatusable ( ctx , tsport , statusURI )
2022-11-29 12:24:55 +03:00
if derefErr != nil {
return nil , nil , wrapDerefError ( derefErr , "GetRemoteStatus: error dereferencing statusable" )
}
if status != nil && refetch {
// we already had the status in the db, and we've also
// now fetched the AP representation as requested
return status , statusable , nil
2021-08-10 14:32:39 +03:00
}
2022-05-23 18:40:03 +03:00
// from here on out we can consider this to be a 'new' status because we didn't have the status in the db already
2021-08-10 14:32:39 +03:00
accountURI , err := ap . ExtractAttributedTo ( statusable )
if err != nil {
2022-11-29 12:24:55 +03:00
return nil , nil , newErrOther ( fmt . Errorf ( "GetRemoteStatus: error extracting attributedTo: %w" , err ) )
2021-08-10 14:32:39 +03:00
}
2022-11-29 12:24:55 +03:00
// we need to get the author of the status else we can't serialize it properly
2023-05-09 13:16:10 +03:00
if _ , err = d . GetAccountByURI ( ctx , username , accountURI ) ; err != nil {
2022-11-29 12:24:55 +03:00
return nil , nil , newErrOther ( fmt . Errorf ( "GetRemoteStatus: couldn't get status author: %s" , err ) )
2021-08-10 14:32:39 +03:00
}
2022-11-29 12:24:55 +03:00
status , err = d . typeConverter . ASStatusToStatus ( ctx , statusable )
2021-08-10 14:32:39 +03:00
if err != nil {
2022-11-29 12:24:55 +03:00
return nil , nil , newErrOther ( fmt . Errorf ( "GetRemoteStatus: error converting statusable to status: %s" , err ) )
2021-08-10 14:32:39 +03:00
}
2022-11-29 12:24:55 +03:00
ulid , err := id . NewULIDFromTime ( status . CreatedAt )
2022-05-23 18:40:03 +03:00
if err != nil {
2022-11-29 12:24:55 +03:00
return nil , nil , newErrOther ( fmt . Errorf ( "GetRemoteStatus: error generating new id for status: %s" , err ) )
2022-05-23 18:40:03 +03:00
}
2022-11-29 12:24:55 +03:00
status . ID = ulid
2021-08-10 14:32:39 +03:00
2022-11-29 12:24:55 +03:00
if err := d . populateStatusFields ( ctx , status , username , includeParent ) ; err != nil {
return nil , nil , newErrOther ( fmt . Errorf ( "GetRemoteStatus: error populating status fields: %s" , err ) )
2022-05-23 18:40:03 +03:00
}
2021-08-10 14:32:39 +03:00
2022-11-29 12:24:55 +03:00
if err := d . db . PutStatus ( ctx , status ) ; err != nil && ! errors . Is ( err , db . ErrAlreadyExists ) {
return nil , nil , newErrDB ( fmt . Errorf ( "GetRemoteStatus: error putting new status: %s" , err ) )
2021-08-10 14:32:39 +03:00
}
2022-11-29 12:24:55 +03:00
return status , statusable , nil
2021-08-10 14:32:39 +03:00
}
2023-03-01 20:52:44 +03:00
func ( d * deref ) dereferenceStatusable ( ctx context . Context , tsport transport . Transport , remoteStatusID * url . URL ) ( ap . Statusable , error ) {
2021-08-25 16:34:33 +03:00
if blocked , err := d . db . IsDomainBlocked ( ctx , remoteStatusID . Host ) ; blocked || err != nil {
2021-08-10 14:32:39 +03:00
return nil , fmt . Errorf ( "DereferenceStatusable: domain %s is blocked" , remoteStatusID . Host )
}
2023-03-01 20:52:44 +03:00
b , err := tsport . Dereference ( ctx , remoteStatusID )
2021-08-10 14:32:39 +03:00
if err != nil {
2023-04-06 14:19:55 +03:00
return nil , fmt . Errorf ( "dereferenceStatusable: error deferencing %s: %w" , remoteStatusID . String ( ) , err )
2021-08-10 14:32:39 +03:00
}
2023-04-06 14:19:55 +03:00
return ap . ResolveStatusable ( ctx , b )
2021-08-10 14:32:39 +03:00
}
// populateStatusFields fetches all the information we temporarily pinned to an incoming
// federated status, back in the federating db's Create function.
//
// When a status comes in from the federation API, there are certain fields that
// haven't been dereferenced yet, because we needed to provide a snappy synchronous
// response to the caller. By the time it reaches this function though, it's being
// processed asynchronously, so we have all the time in the world to fetch the various
// bits and bobs that are attached to the status, and properly flesh it out, before we
// send the status to any timelines and notify people.
//
// Things to dereference and fetch here:
//
// 1. Media attachments.
// 2. Hashtags.
// 3. Emojis.
// 4. Mentions.
2021-08-29 13:03:08 +03:00
// 5. Replied-to-status.
2021-08-10 14:32:39 +03:00
//
// SIDE EFFECTS:
// This function will deference all of the above, insert them in the database as necessary,
// and attach them to the status. The status itself will not be added to the database yet,
// that's up the caller to do.
2021-09-14 13:23:56 +03:00
func ( d * deref ) populateStatusFields ( ctx context . Context , status * gtsmodel . Status , requestingUsername string , includeParent bool ) error {
2021-08-29 13:03:08 +03:00
statusIRI , err := url . Parse ( status . URI )
2021-08-10 14:32:39 +03:00
if err != nil {
2021-08-29 13:03:08 +03:00
return fmt . Errorf ( "populateStatusFields: couldn't parse status URI %s: %s" , status . URI , err )
2021-08-10 14:32:39 +03:00
}
2021-08-29 13:03:08 +03:00
blocked , err := d . db . IsURIBlocked ( ctx , statusIRI )
2021-08-10 14:32:39 +03:00
if err != nil {
2021-08-29 13:03:08 +03:00
return fmt . Errorf ( "populateStatusFields: error checking blocked status of %s: %s" , statusIRI , err )
}
if blocked {
return fmt . Errorf ( "populateStatusFields: domain %s is blocked" , statusIRI )
2021-08-10 14:32:39 +03:00
}
// in case the status doesn't have an id yet (ie., it hasn't entered the database yet), then create one
if status . ID == "" {
newID , err := id . NewULIDFromTime ( status . CreatedAt )
if err != nil {
2021-08-29 13:03:08 +03:00
return fmt . Errorf ( "populateStatusFields: error creating ulid for status: %s" , err )
2021-08-10 14:32:39 +03:00
}
status . ID = newID
}
// 1. Media attachments.
2021-08-29 13:03:08 +03:00
if err := d . populateStatusAttachments ( ctx , status , requestingUsername ) ; err != nil {
return fmt . Errorf ( "populateStatusFields: error populating status attachments: %s" , err )
2021-08-10 14:32:39 +03:00
}
// 2. Hashtags
2021-08-29 13:03:08 +03:00
// TODO
2021-08-10 14:32:39 +03:00
// 3. Emojis
2022-09-12 14:03:23 +03:00
if err := d . populateStatusEmojis ( ctx , status , requestingUsername ) ; err != nil {
return fmt . Errorf ( "populateStatusFields: error populating status emojis: %s" , err )
}
2021-08-10 14:32:39 +03:00
2021-09-14 13:23:56 +03:00
// 4. Mentions
2021-09-01 12:08:21 +03:00
// TODO: do we need to handle removing empty mention objects and just using mention IDs slice?
2021-09-14 13:23:56 +03:00
if err := d . populateStatusMentions ( ctx , status , requestingUsername ) ; err != nil {
return fmt . Errorf ( "populateStatusFields: error populating status mentions: %s" , err )
2021-08-29 13:03:08 +03:00
}
2021-09-01 12:08:21 +03:00
// 5. Replied-to-status (only if requested)
if includeParent {
if err := d . populateStatusRepliedTo ( ctx , status , requestingUsername ) ; err != nil {
return fmt . Errorf ( "populateStatusFields: error populating status repliedTo: %s" , err )
}
2021-08-29 13:03:08 +03:00
}
return nil
}
func ( d * deref ) populateStatusMentions ( ctx context . Context , status * gtsmodel . Status , requestingUsername string ) error {
2021-08-10 14:32:39 +03:00
// At this point, mentions should have the namestring and mentionedAccountURI set on them.
2021-08-29 13:03:08 +03:00
// We can use these to find the accounts.
2021-08-20 13:26:56 +03:00
mentionIDs := [ ] string { }
2021-08-29 13:03:08 +03:00
newMentions := [ ] * gtsmodel . Mention { }
2021-08-20 13:26:56 +03:00
for _ , m := range status . Mentions {
2021-08-10 14:32:39 +03:00
if m . ID != "" {
// we've already populated this mention, since it has an ID
2023-02-17 14:02:29 +03:00
log . Debug ( ctx , "mention already populated" )
2021-08-29 13:03:08 +03:00
mentionIDs = append ( mentionIDs , m . ID )
newMentions = append ( newMentions , m )
2021-08-20 13:26:56 +03:00
continue
2021-08-10 14:32:39 +03:00
}
2021-08-20 13:26:56 +03:00
if m . TargetAccountURI == "" {
2023-02-17 14:02:29 +03:00
log . Debug ( ctx , "target URI not set on mention" )
2021-08-20 13:26:56 +03:00
continue
2021-08-10 14:32:39 +03:00
}
2021-08-20 13:26:56 +03:00
targetAccountURI , err := url . Parse ( m . TargetAccountURI )
2021-08-10 14:32:39 +03:00
if err != nil {
2023-02-17 14:02:29 +03:00
log . Debugf ( ctx , "error parsing mentioned account uri %s: %s" , m . TargetAccountURI , err )
2021-08-10 14:32:39 +03:00
continue
}
2021-08-20 13:26:56 +03:00
var targetAccount * gtsmodel . Account
2021-08-29 13:03:08 +03:00
errs := [ ] string { }
// check if account is in the db already
2021-09-14 13:23:56 +03:00
if a , err := d . db . GetAccountByURI ( ctx , targetAccountURI . String ( ) ) ; err != nil {
2021-08-29 13:03:08 +03:00
errs = append ( errs , err . Error ( ) )
2021-08-20 13:26:56 +03:00
} else {
2023-02-17 14:02:29 +03:00
log . Debugf ( ctx , "got target account %s with id %s through GetAccountByURI" , targetAccountURI , a . ID )
2021-08-29 13:03:08 +03:00
targetAccount = a
}
if targetAccount == nil {
// we didn't find the account in our database already
// check if we can get the account remotely (dereference it)
2023-05-09 13:16:10 +03:00
if a , err := d . GetAccountByURI ( ctx , requestingUsername , targetAccountURI ) ; err != nil {
2021-08-29 13:03:08 +03:00
errs = append ( errs , err . Error ( ) )
} else {
2023-02-17 14:02:29 +03:00
log . Debugf ( ctx , "got target account %s with id %s through GetRemoteAccount" , targetAccountURI , a . ID )
2021-08-29 13:03:08 +03:00
targetAccount = a
}
}
if targetAccount == nil {
2023-02-17 14:02:29 +03:00
log . Debugf ( ctx , "couldn't get target account %s: %s" , m . TargetAccountURI , strings . Join ( errs , " : " ) )
2021-08-20 13:26:56 +03:00
continue
}
2021-08-10 14:32:39 +03:00
2021-08-20 13:26:56 +03:00
mID , err := id . NewRandomULID ( )
2021-08-10 14:32:39 +03:00
if err != nil {
2021-08-29 13:03:08 +03:00
return fmt . Errorf ( "populateStatusMentions: error generating ulid: %s" , err )
2021-08-20 13:26:56 +03:00
}
2021-08-29 13:03:08 +03:00
newMention := & gtsmodel . Mention {
2021-08-20 13:26:56 +03:00
ID : mID ,
StatusID : status . ID ,
Status : m . Status ,
CreatedAt : status . CreatedAt ,
UpdatedAt : status . UpdatedAt ,
2021-09-14 13:23:56 +03:00
OriginAccountID : status . AccountID ,
2021-08-20 13:26:56 +03:00
OriginAccountURI : status . AccountURI ,
OriginAccount : status . Account ,
TargetAccountID : targetAccount . ID ,
TargetAccount : targetAccount ,
NameString : m . NameString ,
TargetAccountURI : targetAccount . URI ,
TargetAccountURL : targetAccount . URL ,
2021-08-10 14:32:39 +03:00
}
[performance] refactoring + add fave / follow / request / visibility caching (#1607)
* refactor visibility checking, add caching for visibility
* invalidate visibility cache items on account / status deletes
* fix requester ID passed to visibility cache nil ptr
* de-interface caches, fix home / public timeline caching + visibility
* finish adding code comments for visibility filter
* fix angry goconst linter warnings
* actually finish adding filter visibility code comments for timeline functions
* move home timeline status author check to after visibility
* remove now-unused code
* add more code comments
* add TODO code comment, update printed cache start names
* update printed cache names on stop
* start adding separate follow(request) delete db functions, add specific visibility cache tests
* add relationship type caching
* fix getting local account follows / followed-bys, other small codebase improvements
* simplify invalidation using cache hooks, add more GetAccountBy___() functions
* fix boosting to return 404 if not boostable but no error (to not leak status ID)
* remove dead code
* improved placement of cache invalidation
* update license headers
* add example follow, follow-request config entries
* add example visibility cache configuration to config file
* use specific PutFollowRequest() instead of just Put()
* add tests for all GetAccountBy()
* add GetBlockBy() tests
* update block to check primitive fields
* update and finish adding Get{Account,Block,Follow,FollowRequest}By() tests
* fix copy-pasted code
* update envparsing test
* whitespace
* fix bun struct tag
* add license header to gtscontext
* fix old license header
* improved error creation to not use fmt.Errorf() when not needed
* fix various rebase conflicts, fix account test
* remove commented-out code, fix-up mention caching
* fix mention select bun statement
* ensure mention target account populated, pass in context to customrenderer logging
* remove more uncommented code, fix typeutil test
* add statusfave database model caching
* add status fave cache configuration
* add status fave cache example config
* woops, catch missed error. nice catch linter!
* add back testrig panic on nil db
* update example configuration to match defaults, slight tweak to cache configuration defaults
* update envparsing test with new defaults
* fetch followingget to use the follow target account
* use accounnt.IsLocal() instead of empty domain check
* use constants for the cache visibility type check
* use bun.In() for notification type restriction in db query
* include replies when fetching PublicTimeline() (to account for single-author threads in Visibility{}.StatusPublicTimelineable())
* use bun query building for nested select statements to ensure working with postgres
* update public timeline future status checks to match visibility filter
* same as previous, for home timeline
* update public timeline tests to dynamically check for appropriate statuses
* migrate accounts to allow unique constraint on public_key
* provide minimal account with publicKey
---------
Signed-off-by: kim <grufwub@gmail.com>
Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
2023-03-28 16:03:14 +03:00
if err := d . db . PutMention ( ctx , newMention ) ; err != nil {
2021-08-29 13:03:08 +03:00
return fmt . Errorf ( "populateStatusMentions: error creating mention: %s" , err )
2021-08-10 14:32:39 +03:00
}
2021-08-29 13:03:08 +03:00
mentionIDs = append ( mentionIDs , newMention . ID )
newMentions = append ( newMentions , newMention )
2021-08-10 14:32:39 +03:00
}
2021-08-29 13:03:08 +03:00
2021-08-20 13:26:56 +03:00
status . MentionIDs = mentionIDs
2021-08-29 13:03:08 +03:00
status . Mentions = newMentions
2021-08-10 14:32:39 +03:00
2021-08-29 13:03:08 +03:00
return nil
}
func ( d * deref ) populateStatusAttachments ( ctx context . Context , status * gtsmodel . Status , requestingUsername string ) error {
// At this point we should know:
// * the media type of the file we're looking for (a.File.ContentType)
// * the file type (a.Type)
// * the remote URL (a.RemoteURL)
// This should be enough to dereference the piece of media.
attachmentIDs := [ ] string { }
attachments := [ ] * gtsmodel . MediaAttachment { }
for _ , a := range status . Attachments {
2021-09-04 15:02:01 +03:00
a . AccountID = status . AccountID
a . StatusID = status . ID
2021-08-29 13:03:08 +03:00
2022-01-24 15:12:17 +03:00
processingMedia , err := d . GetRemoteMedia ( ctx , requestingUsername , a . AccountID , a . RemoteURL , & media . AdditionalMediaInfo {
2022-01-09 20:41:22 +03:00
CreatedAt : & a . CreatedAt ,
StatusID : & a . StatusID ,
RemoteURL : & a . RemoteURL ,
Description : & a . Description ,
Blurhash : & a . Blurhash ,
} )
2021-08-29 13:03:08 +03:00
if err != nil {
2023-02-17 14:02:29 +03:00
log . Errorf ( ctx , "couldn't get remote media %s: %s" , a . RemoteURL , err )
2022-01-08 19:17:01 +03:00
continue
}
2022-01-24 15:12:17 +03:00
attachment , err := processingMedia . LoadAttachment ( ctx )
2022-01-08 19:17:01 +03:00
if err != nil {
2023-02-17 14:02:29 +03:00
log . Errorf ( ctx , "couldn't load remote attachment %s: %s" , a . RemoteURL , err )
2021-09-01 12:08:21 +03:00
continue
2021-08-29 13:03:08 +03:00
}
attachmentIDs = append ( attachmentIDs , attachment . ID )
attachments = append ( attachments , attachment )
}
status . AttachmentIDs = attachmentIDs
status . Attachments = attachments
return nil
}
2022-09-12 14:03:23 +03:00
func ( d * deref ) populateStatusEmojis ( ctx context . Context , status * gtsmodel . Status , requestingUsername string ) error {
2022-09-26 12:56:01 +03:00
emojis , err := d . populateEmojis ( ctx , status . Emojis , requestingUsername )
if err != nil {
return err
}
2022-09-12 14:03:23 +03:00
2022-09-26 12:56:01 +03:00
emojiIDs := make ( [ ] string , 0 , len ( emojis ) )
for _ , e := range emojis {
emojiIDs = append ( emojiIDs , e . ID )
2022-09-12 14:03:23 +03:00
}
2022-09-26 12:56:01 +03:00
status . Emojis = emojis
2022-09-12 14:03:23 +03:00
status . EmojiIDs = emojiIDs
return nil
}
2021-08-29 13:03:08 +03:00
func ( d * deref ) populateStatusRepliedTo ( ctx context . Context , status * gtsmodel . Status , requestingUsername string ) error {
2021-08-10 14:32:39 +03:00
if status . InReplyToURI != "" && status . InReplyToID == "" {
2021-08-20 13:26:56 +03:00
statusURI , err := url . Parse ( status . InReplyToURI )
if err != nil {
return err
}
2021-08-29 13:03:08 +03:00
2022-11-29 12:24:55 +03:00
replyToStatus , _ , err := d . GetStatus ( ctx , requestingUsername , statusURI , false , false )
2021-09-01 12:08:21 +03:00
if err != nil {
2022-05-23 18:40:03 +03:00
return fmt . Errorf ( "populateStatusRepliedTo: couldn't get reply to status with uri %s: %s" , status . InReplyToURI , err )
2021-08-10 14:32:39 +03:00
}
2021-08-29 13:03:08 +03:00
// we have the status
status . InReplyToID = replyToStatus . ID
status . InReplyTo = replyToStatus
status . InReplyToAccountID = replyToStatus . AccountID
status . InReplyToAccount = replyToStatus . Account
2021-08-10 14:32:39 +03:00
}
2021-08-29 13:03:08 +03:00
2021-08-10 14:32:39 +03:00
return nil
}