Skip to content

Commit 7a1663d

Browse files
authored
Allow viewing quotes for supported instances (#2341)
* Allow viewing quotes when supported * Lower Mastodon API version requirement for status quotes Changed the minimum required Mastodon API version for viewing status quotes from 8 to 7, allowing broader compatibility with older instances.
1 parent 065e867 commit 7a1663d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Packages/Env/Sources/Env/CurrentInstance.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ import Observation
5151
instance?.apiVersions?.mastodon ?? 0 >= 7
5252
}
5353

54+
public var canViewStatusQuotes: Bool {
55+
instance?.apiVersions?.mastodon ?? 0 >= 7
56+
}
57+
5458
private init() {}
5559

5660
public func setClient(client: MastodonClient) {

Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowDetailView.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct StatusRowDetailView: View {
99

1010
@Environment(StatusDataController.self) private var statusDataController
1111
@Environment(CurrentAccount.self) private var currentAccount
12+
@Environment(CurrentInstance.self) private var currentInstance
1213

1314
var viewModel: StatusRowViewModel
1415

@@ -100,14 +101,13 @@ struct StatusRowDetailView: View {
100101
{
101102
Divider()
102103
Button {
103-
if viewModel.status.account.id == currentAccount.account?.id {
104-
viewModel.routerPath.navigate(to: .quotes(id: viewModel.status.id))
105-
}
104+
guard canAccessQuotes else { return }
105+
viewModel.routerPath.navigate(to: .quotes(id: viewModel.status.id))
106106
} label: {
107107
HStack {
108108
Text("status.summary.n-quotes \(statusDataController.quotesCount)")
109109
.font(.scaledCallout)
110-
if viewModel.status.account.id == currentAccount.account?.id {
110+
if canAccessQuotes {
111111
Spacer()
112112
makeAccountsScrollView(accounts: viewModel.quoters)
113113
Image(systemName: "chevron.right")
@@ -136,4 +136,8 @@ struct StatusRowDetailView: View {
136136
.padding(.leading, .layoutPadding)
137137
}
138138
}
139+
140+
private var canAccessQuotes: Bool {
141+
currentInstance.canViewStatusQuotes || viewModel.status.account.id == currentAccount.account?.id
142+
}
139143
}

0 commit comments

Comments
 (0)