Fix handling of (re-)reblogged and favorites state in home timeline (IOS-176)

This commit is contained in:
Marcus Kida 2023-11-27 11:18:43 +01:00
parent 1dfcf407e1
commit c7d62d56a2
No known key found for this signature in database
GPG Key ID: 19FF64E08013CA40
1 changed files with 15 additions and 6 deletions

View File

@ -47,15 +47,24 @@ final public class FeedFetchedResultsController {
} else if let reblog = status.reblog, reblog.id == record.status?.id { } else if let reblog = status.reblog, reblog.id == record.status?.id {
newRecords[i] = .fromStatus(status, kind: record.kind) newRecords[i] = .fromStatus(status, kind: record.kind)
} else if let reblog = record.status?.reblog, reblog.id == status.id { } else if let reblog = record.status?.reblog, reblog.id == status.id {
newRecords[i] = .fromStatus(status, kind: record.kind) // Handle reblogged state
switch status.entity.reblogged { switch status.entity.reblogged {
case .some(true): case .some(true):
newRecords[i].status?.reblog = status newRecords[i] = .fromStatus({
case .some(false): let stat = MastodonStatus.fromEntity(records[i].status!.entity)
newRecords[i].status?.reblog = nil stat.reblog = .fromEntity(status.entity)
case .none: return stat
break }(), kind: record.kind)
case .some(false), .none:
newRecords[i] = .fromStatus({
let stat = MastodonStatus.fromEntity(status.entity)
return stat
}(), kind: record.kind)
} }
} else if let reblog = record.status?.reblog, reblog.id == status.reblog?.id {
// Handle re-reblogged state
newRecords[i] = .fromStatus(status, kind: record.kind)
} }
} }
records = newRecords records = newRecords