After our last community sync, we came to the conclusion that feedback being sent outside of email is difficult to reply to. Our decision was to use the old, tried and true email system, so that we can better respond to people asking questions. <img width="392" alt="SCR-20250320-igub" src="https://github.com/user-attachments/assets/f1d01771-30eb-4b6f-b031-c68ddaac5700" /> Release Notes: - N/A --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
91 lines
2.7 KiB
Rust
91 lines
2.7 KiB
Rust
use gpui::{actions, App, ClipboardItem, PromptLevel};
|
|
use system_specs::SystemSpecs;
|
|
use util::ResultExt;
|
|
use workspace::Workspace;
|
|
|
|
pub mod feedback_modal;
|
|
|
|
mod system_specs;
|
|
|
|
actions!(
|
|
zed,
|
|
[
|
|
CopySystemSpecsIntoClipboard,
|
|
EmailZed,
|
|
FileBugReport,
|
|
OpenZedRepo,
|
|
RequestFeature,
|
|
]
|
|
);
|
|
|
|
const ZED_REPO_URL: &str = "https://github.com/zed-industries/zed";
|
|
|
|
const REQUEST_FEATURE_URL: &str = "https://github.com/zed-industries/zed/discussions/new/choose";
|
|
|
|
const EMAIL_ZED_URL: &str = "mailto:hi@zed.dev";
|
|
|
|
fn file_bug_report_url(specs: &SystemSpecs) -> String {
|
|
format!(
|
|
concat!(
|
|
"https://github.com/zed-industries/zed/issues/new",
|
|
"?",
|
|
"template=1_bug_report.yml",
|
|
"&",
|
|
"environment={}"
|
|
),
|
|
urlencoding::encode(&specs.to_string())
|
|
)
|
|
}
|
|
|
|
pub fn init(cx: &mut App) {
|
|
cx.observe_new(|workspace: &mut Workspace, window, cx| {
|
|
let Some(window) = window else {
|
|
return;
|
|
};
|
|
feedback_modal::FeedbackModal::register(workspace, window, cx);
|
|
workspace
|
|
.register_action(|_, _: &CopySystemSpecsIntoClipboard, window, cx| {
|
|
let specs = SystemSpecs::new(window, cx);
|
|
|
|
cx.spawn_in(window, async move |_, cx| {
|
|
let specs = specs.await.to_string();
|
|
|
|
cx.update(|_, cx| {
|
|
cx.write_to_clipboard(ClipboardItem::new_string(specs.clone()))
|
|
})
|
|
.log_err();
|
|
|
|
cx.prompt(
|
|
PromptLevel::Info,
|
|
"Copied into clipboard",
|
|
Some(&specs),
|
|
&["OK"],
|
|
)
|
|
.await
|
|
})
|
|
.detach();
|
|
})
|
|
.register_action(|_, _: &RequestFeature, _, cx| {
|
|
cx.open_url(REQUEST_FEATURE_URL);
|
|
})
|
|
.register_action(move |_, _: &FileBugReport, window, cx| {
|
|
let specs = SystemSpecs::new(window, cx);
|
|
cx.spawn_in(window, async move |_, cx| {
|
|
let specs = specs.await;
|
|
cx.update(|_, cx| {
|
|
cx.open_url(&file_bug_report_url(&specs));
|
|
})
|
|
.log_err();
|
|
})
|
|
.detach();
|
|
})
|
|
.register_action(move |_, _: &EmailZed, _, cx| {
|
|
cx.open_url(EMAIL_ZED_URL);
|
|
})
|
|
.register_action(move |_, _: &OpenZedRepo, _, cx| {
|
|
cx.open_url(ZED_REPO_URL);
|
|
});
|
|
})
|
|
.detach();
|
|
}
|