feat: remove the post duplication feature (closes #10)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3744,36 +3744,6 @@ impl BdsApp {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
fn duplicate_post_editor(&mut self, post_id: &str) -> Task<Message> {
|
||||
let Some(db) = &self.db else {
|
||||
return Task::none();
|
||||
};
|
||||
let Some(data_dir) = &self.data_dir else {
|
||||
return Task::none();
|
||||
};
|
||||
match engine::post::duplicate_post(db.conn(), data_dir, post_id) {
|
||||
Ok(post) => {
|
||||
let tab = Tab {
|
||||
id: post.id.clone(),
|
||||
title: post.title.clone(),
|
||||
tab_type: TabType::Post,
|
||||
is_transient: false,
|
||||
is_dirty: false,
|
||||
};
|
||||
let idx = tabs::open_tab(&mut self.tabs, tab);
|
||||
self.active_tab = self.tabs.get(idx).map(|tab| tab.id.clone());
|
||||
if let Some(tab) = self.tabs.get(idx).cloned() {
|
||||
self.load_editor_for_tab(&tab);
|
||||
}
|
||||
self.enforce_panel_tab_fallback();
|
||||
self.sync_menu_state();
|
||||
self.notify(ToastLevel::Success, &t(self.ui_locale, "editor.saved"));
|
||||
}
|
||||
Err(e) => self.notify_operation_failed("editor.duplicate", e),
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
fn delete_media_editor(&mut self, media_id: &str) -> Task<Message> {
|
||||
let Some(db) = &self.db else {
|
||||
return Task::none();
|
||||
|
||||
@@ -15,7 +15,6 @@ impl BdsApp {
|
||||
},
|
||||
Save(String),
|
||||
Publish(String),
|
||||
Duplicate(String),
|
||||
Discard(String),
|
||||
ShowDelete {
|
||||
tab_id: String,
|
||||
@@ -169,9 +168,6 @@ impl BdsApp {
|
||||
PostEditorMsg::Publish => {
|
||||
deferred = DeferredPostAction::Publish(tab_id.clone());
|
||||
}
|
||||
PostEditorMsg::Duplicate => {
|
||||
deferred = DeferredPostAction::Duplicate(tab_id.clone());
|
||||
}
|
||||
PostEditorMsg::Discard => {
|
||||
deferred = DeferredPostAction::Discard(tab_id.clone());
|
||||
}
|
||||
@@ -280,7 +276,6 @@ impl BdsApp {
|
||||
} => self.translate_post_to(&post_id, &target_language),
|
||||
DeferredPostAction::Save(tab_id) => self.save_post_editor(&tab_id),
|
||||
DeferredPostAction::Publish(tab_id) => self.publish_post_editor(&tab_id),
|
||||
DeferredPostAction::Duplicate(tab_id) => self.duplicate_post_editor(&tab_id),
|
||||
DeferredPostAction::Discard(tab_id) => self.discard_post_editor(&tab_id),
|
||||
DeferredPostAction::ShowDelete { tab_id, name } => {
|
||||
Task::done(Message::ShowModal(modal::ModalState::ConfirmDelete {
|
||||
|
||||
@@ -347,7 +347,6 @@ pub enum PostEditorMsg {
|
||||
RemoveCategory(String),
|
||||
Save,
|
||||
Publish,
|
||||
Duplicate,
|
||||
Discard,
|
||||
Delete,
|
||||
InsertLink,
|
||||
@@ -412,19 +411,6 @@ pub fn view<'a>(
|
||||
.padding([6, 16])
|
||||
.into(),
|
||||
];
|
||||
if !on_translation {
|
||||
header_action_items.push(
|
||||
button(
|
||||
text(t(locale, "editor.duplicate"))
|
||||
.size(13)
|
||||
.shaping(Shaping::Advanced),
|
||||
)
|
||||
.on_press(Message::PostEditor(PostEditorMsg::Duplicate))
|
||||
.padding([6, 16])
|
||||
.style(inputs::secondary_button)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
if state.status == PostStatus::Draft {
|
||||
header_action_items.push(
|
||||
button(
|
||||
|
||||
Reference in New Issue
Block a user