diff options
author | 2023-04-05 20:10:05 +0200 | |
---|---|---|
committer | 2023-04-05 20:10:05 +0200 | |
commit | 8d2a76c58ce018fb6cd6760a3607cf1ee720037a (patch) | |
tree | 5443b6a9828483c884150639b9cdee02bc850319 /internal/federation/federatingdb/util.go | |
parent | [chore] Update templates license headers (#1672) (diff) | |
download | gotosocial-8d2a76c58ce018fb6cd6760a3607cf1ee720037a.tar.xz |
[bugfix] Add proper constraints on status faves, dedupe (#1674)
* [bugfix] Start working on multiple like issue
* finish up
Diffstat (limited to 'internal/federation/federatingdb/util.go')
-rw-r--r-- | internal/federation/federatingdb/util.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/internal/federation/federatingdb/util.go b/internal/federation/federatingdb/util.go index 8ad209f5e..5137145f2 100644 --- a/internal/federation/federatingdb/util.go +++ b/internal/federation/federatingdb/util.go @@ -36,23 +36,27 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/uris" ) -func sameActor(activityActor vocab.ActivityStreamsActorProperty, followActor vocab.ActivityStreamsActorProperty) bool { - if activityActor == nil || followActor == nil { +func sameActor(actor1 vocab.ActivityStreamsActorProperty, actor2 vocab.ActivityStreamsActorProperty) bool { + if actor1 == nil || actor2 == nil { return false } - for aIter := activityActor.Begin(); aIter != activityActor.End(); aIter = aIter.Next() { - for fIter := followActor.Begin(); fIter != followActor.End(); fIter = fIter.Next() { - if aIter.GetIRI() == nil { + + for a1Iter := actor1.Begin(); a1Iter != actor1.End(); a1Iter = a1Iter.Next() { + for a2Iter := actor2.Begin(); a2Iter != actor2.End(); a2Iter = a2Iter.Next() { + if a1Iter.GetIRI() == nil { return false } - if fIter.GetIRI() == nil { + + if a2Iter.GetIRI() == nil { return false } - if aIter.GetIRI().String() == fIter.GetIRI().String() { + + if a1Iter.GetIRI().String() == a2Iter.GetIRI().String() { return true } } } + return false } |