Fix reblog

This commit is contained in:
Thomas Ricouard 2023-02-10 18:25:38 +01:00
parent feefb02456
commit dbdcf4c2d6
2 changed files with 33 additions and 5 deletions

View file

@ -141,6 +141,38 @@ public struct Status: AnyStatus, Codable, Identifiable, Equatable, Hashable, Sta
public static func placeholders() -> [Status] {
[.placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder()]
}
public var reblogAsAsStatus: Status? {
if let reblog {
return .init(id: reblog.id,
content: reblog.content,
account: reblog.account,
createdAt: reblog.createdAt,
editedAt: reblog.editedAt,
reblog: nil,
mediaAttachments: reblog.mediaAttachments,
mentions: reblog.mentions,
repliesCount: reblog.repliesCount,
reblogsCount: reblog.reblogsCount,
favouritesCount: reblog.favouritesCount,
card: reblog.card,
favourited: reblog.favourited,
reblogged: reblog.reblogged,
pinned: reblog.pinned,
bookmarked: reblog.bookmarked,
emojis: reblog.emojis,
url: reblog.url,
application: reblog.application,
inReplyToAccountId: reblog.inReplyToAccountId,
visibility: reblog.visibility,
poll: reblog.poll,
spoilerText: reblog.spoilerText,
filtered: reblog.filtered,
sensitive: reblog.sensitive,
language: reblog.language)
}
return nil
}
}
public struct ReblogStatus: AnyStatus, Codable, Identifiable, Equatable, Hashable {

View file

@ -97,11 +97,7 @@ public class StatusRowViewModel: ObservableObject {
if isRemote, let url = URL(string: status.reblog?.url ?? status.url ?? "") {
routerPath.navigate(to: .remoteStatusDetail(url: url))
} else {
if let id = status.reblog?.id {
routerPath.navigate(to: .statusDetail(id: id))
} else {
routerPath.navigate(to: .statusDetailWithStatus(status: status))
}
routerPath.navigate(to: .statusDetailWithStatus(status: status.reblogAsAsStatus ?? status))
}
}