diff options
author | 2021-05-23 18:07:04 +0200 | |
---|---|---|
committer | 2021-05-23 18:07:04 +0200 | |
commit | ee65d19ff343134c55ca968114dcbfe4b7b4431d (patch) | |
tree | 778141fb4dc2ff17c78594663b0c0cd2a47f79fc /internal/message/fromfederatorprocess.go | |
parent | small fiddling to allow whalebird to work (a bit) (diff) | |
download | gotosocial-ee65d19ff343134c55ca968114dcbfe4b7b4431d.tar.xz |
status deletes, profile updates (#30)
1. Proper DELETE of federated statuses (not yet deleting all the media and stuff -- i still have to implement this -- but the actual status is toast).
2. Proper UPDATE of profiles. When you change your profile picture on your remote instance, that will now register properly in GoToSocial.
3. Scrolling down the home timeline - it no longer just sort of ends, and will keep loading older statuses as you scroll.
4. Little bugfixes -- still had some nil pointer errors when dereferencing remote accounts.
Diffstat (limited to 'internal/message/fromfederatorprocess.go')
-rw-r--r-- | internal/message/fromfederatorprocess.go | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/internal/message/fromfederatorprocess.go b/internal/message/fromfederatorprocess.go index ffaa1b93b..d3ebce400 100644 --- a/internal/message/fromfederatorprocess.go +++ b/internal/message/fromfederatorprocess.go @@ -68,7 +68,7 @@ func (p *processor) processFromFederator(federatorMsg gtsmodel.FromFederator) er } l.Debug("will now derefence incoming account") - if err := p.dereferenceAccountFields(incomingAccount, ""); err != nil { + if err := p.dereferenceAccountFields(incomingAccount, "", false); err != nil { return fmt.Errorf("error dereferencing account from federator: %s", err) } if err := p.db.UpdateByID(incomingAccount.ID, incomingAccount); err != nil { @@ -86,13 +86,26 @@ func (p *processor) processFromFederator(federatorMsg gtsmodel.FromFederator) er } l.Debug("will now derefence incoming account") - if err := p.dereferenceAccountFields(incomingAccount, ""); err != nil { + if err := p.dereferenceAccountFields(incomingAccount, federatorMsg.ReceivingAccount.Username, true); err != nil { return fmt.Errorf("error dereferencing account from federator: %s", err) } if err := p.db.UpdateByID(incomingAccount.ID, incomingAccount); err != nil { return fmt.Errorf("error updating dereferenced account in the db: %s", err) } } + case gtsmodel.ActivityStreamsDelete: + // DELETE + switch federatorMsg.APObjectType { + case gtsmodel.ActivityStreamsNote: + // DELETE A STATUS + // TODO: handle side effects of status deletion here: + // 1. delete all media associated with status + // 2. delete boosts of status + // 3. etc etc etc + case gtsmodel.ActivityStreamsProfile: + // DELETE A PROFILE/ACCOUNT + // TODO: handle side effects of account deletion here: delete all objects, statuses, media etc associated with account + } } return nil @@ -220,7 +233,7 @@ func (p *processor) dereferenceStatusFields(status *gtsmodel.Status) error { continue } - targetAccount, err = p.tc.ASRepresentationToAccount(accountable) + targetAccount, err = p.tc.ASRepresentationToAccount(accountable, false) if err != nil { l.Debugf("error converting remote account with uri %s into gts model: %s", uri.String(), err) continue @@ -243,7 +256,7 @@ func (p *processor) dereferenceStatusFields(status *gtsmodel.Status) error { return nil } -func (p *processor) dereferenceAccountFields(account *gtsmodel.Account, requestingUsername string) error { +func (p *processor) dereferenceAccountFields(account *gtsmodel.Account, requestingUsername string, refresh bool) error { l := p.log.WithFields(logrus.Fields{ "func": "dereferenceAccountFields", "requestingUsername": requestingUsername, @@ -255,7 +268,7 @@ func (p *processor) dereferenceAccountFields(account *gtsmodel.Account, requesti } // fetch the header and avatar - if err := p.fetchHeaderAndAviForAccount(account, t); err != nil { + if err := p.fetchHeaderAndAviForAccount(account, t, refresh); err != nil { // if this doesn't work, just skip it -- we can do it later l.Debugf("error fetching header/avi for account: %s", err) } |