From d5f4462f3ecf1be80a193a9366a2236f1779b83b Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 3 Jan 2023 21:14:42 +0100 Subject: [PATCH] Forward status visibility to the editor for reply / edit + prevent quote on non public status --- .../Sources/Status/Editor/StatusEditorViewModel.swift | 2 ++ .../Status/Sources/Status/Row/StatusRowView.swift | 11 +++++++---- README.md | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift b/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift index b31bb8f7..5efc2f7d 100644 --- a/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift +++ b/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift @@ -114,6 +114,7 @@ public class StatusEditorViewModel: ObservableObject { } mentionString += " " replyToStatus = status + visibility = status.visibility statusText = .init(string: mentionString) selectedRange = .init(location: mentionString.utf16.count, length: 0) case let .edit(status): @@ -121,6 +122,7 @@ public class StatusEditorViewModel: ObservableObject { selectedRange = .init(location: statusText.string.utf16.count, length: 0) spoilerOn = !status.spoilerText.isEmpty spoilerText = status.spoilerText + visibility = status.visibility mediasImages = status.mediaAttachments.map{ .init(image: nil, mediaAttachement: $0, error: nil )} case let .quote(status): self.embededStatus = status diff --git a/Packages/Status/Sources/Status/Row/StatusRowView.swift b/Packages/Status/Sources/Status/Row/StatusRowView.swift index 13403aae..741b6b10 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowView.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowView.swift @@ -238,10 +238,13 @@ public struct StatusRowView: View { } } label: { Label(viewModel.isReblogged ? "Unboost" : "Boost", systemImage: "arrow.left.arrow.right.circle") } - Button { - routeurPath.presentedSheet = .quoteStatusEditor(status: viewModel.status) - } label: { - Label("Quote this post", systemImage: "quote.bubble") + + if viewModel.status.visibility == .pub { + Button { + routeurPath.presentedSheet = .quoteStatusEditor(status: viewModel.status) + } label: { + Label("Quote this post", systemImage: "quote.bubble") + } } if let url = viewModel.status.reblog?.url ?? viewModel.status.url { diff --git a/README.md b/README.md index fd4cea5b..c11f8469 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ For contributors and myself, here is a todo list of features that could be added - [ ] Edit filters. - [X] Open remote status locally - [ ] More context menu everywhere -- [ ] Support pinned posts +- [X] Support pinned posts - [ ] Support IceCubesApp://any mastodon links - [ ] Add a share sheet - [ ] Translate button