mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 01:24:21 +01:00
ui: render repost cluster impl
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -12,8 +12,8 @@ use std::f32::consts::PI;
|
|||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
|
|
||||||
use crate::timeline::{
|
use crate::timeline::{
|
||||||
CompositeType, CompositeUnit, NoteUnit, ReactionUnit, TimelineCache, TimelineKind, TimelineTab,
|
CompositeType, CompositeUnit, NoteUnit, ReactionUnit, RepostUnit, TimelineCache, TimelineKind,
|
||||||
ViewFilter,
|
TimelineTab, ViewFilter,
|
||||||
};
|
};
|
||||||
use notedeck::{
|
use notedeck::{
|
||||||
note::root_note_id_from_selected_id, tr, Localization, NoteAction, NoteContext, ScrollInfo,
|
note::root_note_id_from_selected_id, tr, Localization, NoteAction, NoteContext, ScrollInfo,
|
||||||
@@ -774,6 +774,44 @@ fn render_composite_entry(
|
|||||||
RenderEntryResponse::Success(action)
|
RenderEntryResponse::Success(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_repost_cluster(
|
||||||
|
ui: &mut egui::Ui,
|
||||||
|
note_context: &mut NoteContext,
|
||||||
|
note_options: NoteOptions,
|
||||||
|
jobs: &mut JobsCache,
|
||||||
|
mute: &std::sync::Arc<Muted>,
|
||||||
|
txn: &Transaction,
|
||||||
|
repost: &RepostUnit,
|
||||||
|
) -> RenderEntryResponse {
|
||||||
|
let reposted_key = repost.note_reposted.key;
|
||||||
|
let reposted_note = if let Ok(note) = note_context.ndb.get_note_by_key(txn, reposted_key) {
|
||||||
|
note
|
||||||
|
} else {
|
||||||
|
warn!("failed to query note {:?}", reposted_key);
|
||||||
|
return RenderEntryResponse::Unsuccessful;
|
||||||
|
};
|
||||||
|
|
||||||
|
let profiles_to_show: Vec<ProfileEntry> = repost
|
||||||
|
.reposts
|
||||||
|
.values()
|
||||||
|
.filter(|r| !mute.is_pk_muted(r.bytes()))
|
||||||
|
.map(|p| ProfileEntry {
|
||||||
|
record: note_context.ndb.get_profile_by_pubkey(txn, p.bytes()).ok(),
|
||||||
|
pk: p,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
render_composite_entry(
|
||||||
|
ui,
|
||||||
|
note_context,
|
||||||
|
note_options,
|
||||||
|
jobs,
|
||||||
|
reposted_note,
|
||||||
|
profiles_to_show,
|
||||||
|
CompositeType::Repost,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
enum RenderEntryResponse {
|
enum RenderEntryResponse {
|
||||||
Unsuccessful,
|
Unsuccessful,
|
||||||
Success(Option<NoteAction>),
|
Success(Option<NoteAction>),
|
||||||
|
|||||||
Reference in New Issue
Block a user