summaryrefslogtreecommitdiff
path: root/internal/processing
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-08-08 12:26:34 +0100
committerLibravatar GitHub <noreply@github.com>2023-08-08 12:26:34 +0100
commit3920bc87d1398893feda21f32e4f59129b2cc9cd (patch)
treeed5a6651e034fd551f03dcfcf42b9c61a796e001 /internal/processing
parent[chore] Update robots.txt, give chatgpt the middle finger (#2085) (diff)
downloadgotosocial-3920bc87d1398893feda21f32e4f59129b2cc9cd.tar.xz
[bugfix] don't accept unrelated statuses (#2078)
Co-authored-by: Daenney <daenney@users.noreply.github.com> Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/processing')
-rw-r--r--internal/processing/fromfederator.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/internal/processing/fromfederator.go b/internal/processing/fromfederator.go
index abe292cae..2790d31ee 100644
--- a/internal/processing/fromfederator.go
+++ b/internal/processing/fromfederator.go
@@ -108,20 +108,23 @@ func (p *Processor) ProcessFromFederator(ctx context.Context, federatorMsg messa
// processCreateStatusFromFederator handles Activity Create and Object Note.
func (p *Processor) processCreateStatusFromFederator(ctx context.Context, federatorMsg messages.FromFederator) error {
- // Check the federatorMsg for either an already
- // dereferenced and converted status pinned to
- // the message, or an AP IRI that we need to deref.
var (
status *gtsmodel.Status
err error
+
+ // Check the federatorMsg for either an already dereferenced
+ // and converted status pinned to the message, or a forwarded
+ // AP IRI that we still need to deref.
+ forwarded = (federatorMsg.GTSModel == nil)
)
- if federatorMsg.GTSModel != nil {
- // Model is set, use that.
- status, err = p.statusFromGTSModel(ctx, federatorMsg)
- } else {
- // Model is not set, use IRI.
+ if forwarded {
+ // Model was not set, deref with IRI.
+ // This will also cause the status to be inserted into the db.
status, err = p.statusFromAPIRI(ctx, federatorMsg)
+ } else {
+ // Model is set, ensure we have the most up-to-date model.
+ status, err = p.statusFromGTSModel(ctx, federatorMsg)
}
if err != nil {