mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-24 07:32:51 +00:00
Factor out URLs in feedback
crate (#6776)
This PR factors out the inlined URLs in the `feedback` crate so that they don't mess with `rustfmt`. Release Notes: - N/A
This commit is contained in:
parent
47860a5dc8
commit
8da5e57d6d
1 changed files with 19 additions and 10 deletions
|
@ -19,6 +19,21 @@ actions!(
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const fn zed_repo_url() -> &'static str {
|
||||||
|
"https://github.com/zed-industries/zed"
|
||||||
|
}
|
||||||
|
|
||||||
|
const fn request_feature_url() -> &'static str {
|
||||||
|
"https://github.com/zed-industries/zed/issues/new?assignees=&labels=enhancement%2Ctriage&template=0_feature_request.yml"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn file_bug_report_url(specs: &SystemSpecs) -> String {
|
||||||
|
format!(
|
||||||
|
"https://github.com/zed-industries/zed/issues/new?assignees=&labels=defect%2Ctriage&template=2_bug_report.yml&environment={}",
|
||||||
|
urlencoding::encode(&specs.to_string())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn init(cx: &mut AppContext) {
|
pub fn init(cx: &mut AppContext) {
|
||||||
cx.observe_new_views(|workspace: &mut Workspace, cx| {
|
cx.observe_new_views(|workspace: &mut Workspace, cx| {
|
||||||
feedback_modal::FeedbackModal::register(workspace, cx);
|
feedback_modal::FeedbackModal::register(workspace, cx);
|
||||||
|
@ -39,20 +54,14 @@ pub fn init(cx: &mut AppContext) {
|
||||||
cx.write_to_clipboard(ClipboardItem::new(specs.clone()));
|
cx.write_to_clipboard(ClipboardItem::new(specs.clone()));
|
||||||
})
|
})
|
||||||
.register_action(|_, _: &RequestFeature, cx| {
|
.register_action(|_, _: &RequestFeature, cx| {
|
||||||
let url = "https://github.com/zed-industries/zed/issues/new?assignees=&labels=enhancement%2Ctriage&template=0_feature_request.yml";
|
cx.open_url(request_feature_url());
|
||||||
cx.open_url(url);
|
|
||||||
})
|
})
|
||||||
.register_action(move |_, _: &FileBugReport, cx| {
|
.register_action(move |_, _: &FileBugReport, cx| {
|
||||||
let url = format!(
|
cx.open_url(&file_bug_report_url(&SystemSpecs::new(&cx)));
|
||||||
"https://github.com/zed-industries/zed/issues/new?assignees=&labels=defect%2Ctriage&template=2_bug_report.yml&environment={}",
|
|
||||||
urlencoding::encode(&SystemSpecs::new(&cx).to_string())
|
|
||||||
);
|
|
||||||
cx.open_url(&url);
|
|
||||||
})
|
})
|
||||||
.register_action(move |_, _: &OpenZedRepo, cx| {
|
.register_action(move |_, _: &OpenZedRepo, cx| {
|
||||||
let url = "https://github.com/zed-industries/zed";
|
cx.open_url(zed_repo_url());
|
||||||
cx.open_url(&url);
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue