post quote reposts impl
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -6,7 +6,10 @@ use crate::{
|
||||
notecache::NoteCache,
|
||||
thread::Threads,
|
||||
timeline::TimelineId,
|
||||
ui::{self, note::post::PostResponse},
|
||||
ui::{
|
||||
self,
|
||||
note::{post::PostResponse, QuoteRepostView},
|
||||
},
|
||||
};
|
||||
|
||||
use enostr::{NoteId, RelayPool};
|
||||
@@ -17,6 +20,7 @@ pub enum TimelineRoute {
|
||||
Timeline(TimelineId),
|
||||
Thread(NoteId),
|
||||
Reply(NoteId),
|
||||
Quote(NoteId),
|
||||
}
|
||||
|
||||
pub enum TimelineRouteResponse {
|
||||
@@ -49,7 +53,7 @@ pub fn render_timeline_route(
|
||||
TimelineRoute::Timeline(timeline_id) => {
|
||||
if show_postbox {
|
||||
if let Some(kp) = accounts.selected_or_first_nsec() {
|
||||
ui::timeline::postbox_view(ndb, kp, pool, drafts, img_cache, ui);
|
||||
ui::timeline::postbox_view(ndb, kp, pool, drafts, img_cache, note_cache, ui);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,5 +113,34 @@ pub fn render_timeline_route(
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
TimelineRoute::Quote(id) => {
|
||||
let txn = if let Ok(txn) = Transaction::new(ndb) {
|
||||
txn
|
||||
} else {
|
||||
ui.label("Quote of unknown note");
|
||||
return None;
|
||||
};
|
||||
|
||||
let note = if let Ok(note) = ndb.get_note_by_id(&txn, id.bytes()) {
|
||||
note
|
||||
} else {
|
||||
ui.label("Quote of unknown note");
|
||||
return None;
|
||||
};
|
||||
|
||||
let id = egui::Id::new(("post", col, note.key().unwrap()));
|
||||
if let Some(poster) = accounts.selected_or_first_nsec() {
|
||||
let response = egui::ScrollArea::vertical().show(ui, |ui| {
|
||||
QuoteRepostView::new(ndb, poster, pool, note_cache, img_cache, drafts, ¬e)
|
||||
.id_source(id)
|
||||
.show(ui)
|
||||
});
|
||||
|
||||
Some(TimelineRouteResponse::post(response.inner))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user