[bugfix] Add proper constraints on status faves, dedupe (#1674)

* [bugfix] Start working on multiple like issue

* finish up
This commit is contained in:
tobi
2023-04-05 20:10:05 +02:00
committed by GitHub
parent 36a2131375
commit 8d2a76c58c
6 changed files with 387 additions and 97 deletions

View File

@@ -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
}