mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-10-31 22:40:01 +00:00
[bugfix] Fix first item of thread dereferencing always being skipped (#1858)
* [bugfix] Fix first item of thread dereferencing always being skipped * tweak to status descendant item iteration Signed-off-by: kim <grufwub@gmail.com> --------- Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
1f39275c0f
commit
1d4137fb88
1 changed files with 12 additions and 19 deletions
|
@ -22,6 +22,7 @@
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"codeberg.org/gruf/go-kv"
|
"codeberg.org/gruf/go-kv"
|
||||||
|
"github.com/superseriousbusiness/activity/pub"
|
||||||
"github.com/superseriousbusiness/activity/streams/vocab"
|
"github.com/superseriousbusiness/activity/streams/vocab"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/ap"
|
"github.com/superseriousbusiness/gotosocial/internal/ap"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/config"
|
"github.com/superseriousbusiness/gotosocial/internal/config"
|
||||||
|
@ -97,7 +98,8 @@ func (d *deref) dereferenceStatusAncestors(ctx context.Context, username string,
|
||||||
l.Tracef("following remote status ancestors: %s", status.InReplyToURI)
|
l.Tracef("following remote status ancestors: %s", status.InReplyToURI)
|
||||||
|
|
||||||
// Fetch the remote status found at this IRI
|
// Fetch the remote status found at this IRI
|
||||||
remoteStatus, _, err := d.getStatusByURI(ctx,
|
remoteStatus, _, err := d.getStatusByURI(
|
||||||
|
ctx,
|
||||||
username,
|
username,
|
||||||
replyIRI,
|
replyIRI,
|
||||||
)
|
)
|
||||||
|
@ -184,8 +186,8 @@ type frame struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
if current.page == nil {
|
if current.page == nil {
|
||||||
// This is a local status, no looping to do
|
|
||||||
if current.statusIRI.Host == config.GetHost() {
|
if current.statusIRI.Host == config.GetHost() {
|
||||||
|
// This is a local status, no looping to do
|
||||||
continue stackLoop
|
continue stackLoop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,33 +229,24 @@ type frame struct {
|
||||||
|
|
||||||
// Start off the item iterator
|
// Start off the item iterator
|
||||||
current.itemIter = items.Begin()
|
current.itemIter = items.Begin()
|
||||||
if current.itemIter == nil {
|
|
||||||
continue stackLoop
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
itemLoop:
|
itemLoop:
|
||||||
for {
|
for {
|
||||||
var itemIRI *url.URL
|
// Check for remaining iter
|
||||||
|
|
||||||
// Get next item iterator object
|
|
||||||
current.itemIter = current.itemIter.Next()
|
|
||||||
if current.itemIter == nil {
|
if current.itemIter == nil {
|
||||||
break itemLoop
|
break itemLoop
|
||||||
}
|
}
|
||||||
|
|
||||||
if iri := current.itemIter.GetIRI(); iri != nil {
|
// Get current item iterator
|
||||||
// Item is already an IRI type
|
itemIter := current.itemIter
|
||||||
itemIRI = iri
|
|
||||||
} else if note := current.itemIter.GetActivityStreamsNote(); note != nil {
|
|
||||||
// Item is a note, fetch the note ID IRI
|
|
||||||
if id := note.GetJSONLDId(); id != nil {
|
|
||||||
itemIRI = id.GetIRI()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Set the next available iterator
|
||||||
|
current.itemIter = itemIter.Next()
|
||||||
|
|
||||||
|
// Check for available IRI on item
|
||||||
|
itemIRI, _ := pub.ToId(itemIter)
|
||||||
if itemIRI == nil {
|
if itemIRI == nil {
|
||||||
// Unusable iter object
|
|
||||||
continue itemLoop
|
continue itemLoop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue