Skip to content

Commit 95e3c22

Browse files
authored
feat: Send editor feedback (#23980)
* feat: Send editor feedback Collecting feedback from users while in editor may uncover valuable insights. * docs: Add release note * feat: Prefix editor feedback with tag Indicate the context for feedback submissions originating from the editor.
1 parent e0a82f9 commit 95e3c22

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
* [*] Fix an issue with small tap area of the ellipsis in the post list [#23973]
4747
* [*] Avoid unexpectedly marking post content as unsaved. [#23969]
4848
* [*] Fix an issue with Mastodon connection not working [#23981]
49+
* [**] Send feedback from within the experimental editor "more" options menu. [#23980]
4950

5051
25.6
5152
-----

WordPress/Classes/Utility/In-App Feedback/SubmitFeedbackViewController.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import WordPressShared
44

55
final class SubmitFeedbackViewController: UIViewController {
66
private var source: String
7+
private var feedbackPrefix: String?
78

8-
init(source: String) {
9+
init(source: String, feedbackPrefix: String? = nil) {
910
self.source = source
11+
self.feedbackPrefix = feedbackPrefix
1012
super.init(nibName: nil, bundle: nil)
1113
self.modalPresentationStyle = .formSheet
1214
}
@@ -18,7 +20,7 @@ final class SubmitFeedbackViewController: UIViewController {
1820
override func viewDidLoad() {
1921
super.viewDidLoad()
2022

21-
let viewController = UIHostingController(rootView: SubmitFeedbackView(presentingViewController: self, source: source))
23+
let viewController = UIHostingController(rootView: SubmitFeedbackView(presentingViewController: self, source: source, feedbackPrefix: feedbackPrefix))
2224

2325
let navigationController = UINavigationController(rootViewController: viewController)
2426

@@ -33,6 +35,7 @@ final class SubmitFeedbackViewController: UIViewController {
3335
private struct SubmitFeedbackView: View {
3436
weak var presentingViewController: UIViewController?
3537
let source: String
38+
let feedbackPrefix: String?
3639

3740
@State private var text = ""
3841
@State private var isSubmitting = false
@@ -141,9 +144,10 @@ private struct SubmitFeedbackView: View {
141144

142145
isSubmitting = true
143146

147+
let descriptionPrefix = feedbackPrefix.map { "[\($0)] " } ?? ""
144148
ZendeskUtils.sharedInstance.createNewRequest(
145149
in: presentingViewController,
146-
description: text.trim(),
150+
description: descriptionPrefix + text.trim(),
147151
tags: ["appreview_jetpack", "in_app_feedback"],
148152
attachments: attachmentsViewModel.attachments.compactMap(\.response),
149153
alertOptions: nil
@@ -195,6 +199,6 @@ private enum Strings {
195199

196200
#Preview {
197201
NavigationView {
198-
SubmitFeedbackView(source: "preview")
202+
SubmitFeedbackView(source: "preview", feedbackPrefix: nil)
199203
}
200204
}

WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
288288
guard let url = URL(string: "https://wordpress.com/support/wordpress-editor/") else { return }
289289
present(SFSafariViewController(url: url), animated: true)
290290
}
291+
292+
func showFeedbackView() {
293+
self.present(SubmitFeedbackViewController(source: "gutenberg_kit", feedbackPrefix: "Editor"), animated: true)
294+
}
291295
}
292296

293297
extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate {
@@ -706,6 +710,9 @@ extension NewGutenbergViewController {
706710
actions.append(UIAction(title: helpTitle, image: UIImage(systemName: "questionmark.circle")) { [weak self] _ in
707711
self?.showEditorHelp()
708712
})
713+
actions.append(UIAction(title: Strings.sendFeedback, image: UIImage(systemName: "envelope")) { [weak self] _ in
714+
self?.showFeedbackView()
715+
})
709716
return actions
710717
}
711718

@@ -745,6 +752,7 @@ private enum Strings {
745752
static let postSettings = NSLocalizedString("postEditor.moreMenu.postSettings", value: "Post Settings", comment: "Post Editor / Button in the 'More' menu")
746753
static let helpAndSupport = NSLocalizedString("postEditor.moreMenu.helpAndSupport", value: "Help & Support", comment: "Post Editor / Button in the 'More' menu")
747754
static let help = NSLocalizedString("postEditor.moreMenu.help", value: "Help", comment: "Post Editor / Button in the 'More' menu")
755+
static let sendFeedback = NSLocalizedString("postEditor.moreMenu.sendFeedback", value: "Send Feedback", comment: "Post Editor / Button in the 'More' menu")
748756
static let saveDraft = NSLocalizedString("postEditor.moreMenu.saveDraft", value: "Save Draft", comment: "Post Editor / Button in the 'More' menu")
749757
static let contentStructure = NSLocalizedString("postEditor.moreMenu.contentStructure", value: "Blocks: %li, Words: %li, Characters: %li", comment: "Post Editor / 'More' menu details labels with 'Blocks', 'Words' and 'Characters' counts as parameters (in that order)")
750758
}

0 commit comments

Comments
 (0)