mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-18 17:14:21 +01:00
Merge remote-tracking branches 'github/pr/87{0,1,2}'
Merge a few bug fixes and lint issues
Fernando López Guevara (1):
fix: skip blurring for user's own images
William Casarin (3):
clippy: fix large enum.
kernelkind (1):
bugfix: txn failed
This commit is contained in:
@@ -123,8 +123,8 @@ impl From<NoteAction> for RenderNavAction {
|
||||
}
|
||||
|
||||
enum NotedeckNavResponse {
|
||||
Popup(PopupResponse<Option<RenderNavAction>>),
|
||||
Nav(NavResponse<Option<RenderNavAction>>),
|
||||
Popup(Box<PopupResponse<Option<RenderNavAction>>>),
|
||||
Nav(Box<NavResponse<Option<RenderNavAction>>>),
|
||||
}
|
||||
|
||||
pub struct RenderNavResponse {
|
||||
@@ -147,11 +147,11 @@ impl RenderNavResponse {
|
||||
) -> bool {
|
||||
match self.response {
|
||||
NotedeckNavResponse::Popup(nav_action) => {
|
||||
process_popup_resp(nav_action, app, ctx, ui, self.column);
|
||||
process_popup_resp(*nav_action, app, ctx, ui, self.column);
|
||||
false
|
||||
}
|
||||
NotedeckNavResponse::Nav(nav_response) => {
|
||||
process_nav_resp(app, ctx, ui, nav_response, self.column)
|
||||
process_nav_resp(app, ctx, ui, *nav_response, self.column)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -748,7 +748,7 @@ pub fn render_nav(
|
||||
NavUiType::Body => render_nav_body(ui, app, ctx, route, 1, col, inner_rect),
|
||||
});
|
||||
|
||||
return RenderNavResponse::new(col, NotedeckNavResponse::Popup(resp));
|
||||
return RenderNavResponse::new(col, NotedeckNavResponse::Popup(Box::new(resp)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -790,5 +790,5 @@ pub fn render_nav(
|
||||
}
|
||||
});
|
||||
|
||||
RenderNavResponse::new(col, NotedeckNavResponse::Nav(nav_response))
|
||||
RenderNavResponse::new(col, NotedeckNavResponse::Nav(Box::new(nav_response)))
|
||||
}
|
||||
|
||||
@@ -482,6 +482,7 @@ pub fn merge_sorted_vecs<T: Ord + Copy>(vec1: &[T], vec2: &[T]) -> (Vec<T>, Merg
|
||||
pub fn setup_new_timeline(
|
||||
timeline: &mut Timeline,
|
||||
ndb: &Ndb,
|
||||
txn: &Transaction,
|
||||
subs: &mut Subscriptions,
|
||||
pool: &mut RelayPool,
|
||||
note_cache: &mut NoteCache,
|
||||
@@ -489,7 +490,7 @@ pub fn setup_new_timeline(
|
||||
) {
|
||||
// if we're ready, setup local subs
|
||||
if is_timeline_ready(ndb, pool, note_cache, timeline) {
|
||||
if let Err(err) = setup_timeline_nostrdb_sub(ndb, note_cache, timeline) {
|
||||
if let Err(err) = setup_timeline_nostrdb_sub(ndb, txn, note_cache, timeline) {
|
||||
error!("setup_new_timeline: {err}");
|
||||
}
|
||||
}
|
||||
@@ -616,6 +617,7 @@ fn fetch_contact_list(
|
||||
|
||||
fn setup_initial_timeline(
|
||||
ndb: &Ndb,
|
||||
txn: &Transaction,
|
||||
timeline: &mut Timeline,
|
||||
note_cache: &mut NoteCache,
|
||||
filters: &[Filter],
|
||||
@@ -647,14 +649,13 @@ fn setup_initial_timeline(
|
||||
lim += filter.limit().unwrap_or(1) as i32;
|
||||
}
|
||||
|
||||
let txn = Transaction::new(ndb)?;
|
||||
let notes: Vec<NoteRef> = ndb
|
||||
.query(&txn, filters, lim)?
|
||||
.query(txn, filters, lim)?
|
||||
.into_iter()
|
||||
.map(NoteRef::from_query_result)
|
||||
.collect();
|
||||
|
||||
timeline.insert_new(&txn, ndb, note_cache, ¬es);
|
||||
timeline.insert_new(txn, ndb, note_cache, ¬es);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -665,7 +666,8 @@ pub fn setup_initial_nostrdb_subs(
|
||||
timeline_cache: &mut TimelineCache,
|
||||
) -> Result<()> {
|
||||
for (_kind, timeline) in timeline_cache.timelines.iter_mut() {
|
||||
if let Err(err) = setup_timeline_nostrdb_sub(ndb, note_cache, timeline) {
|
||||
let txn = Transaction::new(ndb).expect("txn");
|
||||
if let Err(err) = setup_timeline_nostrdb_sub(ndb, &txn, note_cache, timeline) {
|
||||
error!("setup_initial_nostrdb_subs: {err}");
|
||||
}
|
||||
}
|
||||
@@ -675,6 +677,7 @@ pub fn setup_initial_nostrdb_subs(
|
||||
|
||||
fn setup_timeline_nostrdb_sub(
|
||||
ndb: &Ndb,
|
||||
txn: &Transaction,
|
||||
note_cache: &mut NoteCache,
|
||||
timeline: &mut Timeline,
|
||||
) -> Result<()> {
|
||||
@@ -684,7 +687,7 @@ fn setup_timeline_nostrdb_sub(
|
||||
.ok_or(Error::App(notedeck::Error::empty_contact_list()))?
|
||||
.to_owned();
|
||||
|
||||
setup_initial_timeline(ndb, timeline, note_cache, &filter_state)?;
|
||||
setup_initial_timeline(ndb, txn, timeline, note_cache, &filter_state)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -754,7 +757,8 @@ pub fn is_timeline_ready(
|
||||
// we just switched to the ready state, we should send initial
|
||||
// queries and setup the local subscription
|
||||
info!("Found contact list! Setting up local and remote contact list query");
|
||||
setup_initial_timeline(ndb, timeline, note_cache, &filter).expect("setup init");
|
||||
let txn = Transaction::new(ndb).expect("txn");
|
||||
setup_initial_timeline(ndb, &txn, timeline, note_cache, &filter).expect("setup init");
|
||||
timeline
|
||||
.filter
|
||||
.set_relay_state(relay_id, FilterState::ready(filter.clone()));
|
||||
|
||||
@@ -637,6 +637,7 @@ pub fn render_add_column_routes(
|
||||
crate::timeline::setup_new_timeline(
|
||||
&mut timeline,
|
||||
ctx.ndb,
|
||||
&txn,
|
||||
&mut app.subscriptions,
|
||||
ctx.pool,
|
||||
ctx.note_cache,
|
||||
@@ -669,15 +670,15 @@ pub fn render_add_column_routes(
|
||||
// source to be, so let;s create a timeline from that and
|
||||
// add it to our list of timelines
|
||||
AlgoOption::LastPerPubkey(Decision::Decided(list_kind)) => {
|
||||
let maybe_timeline = {
|
||||
let txn = Transaction::new(ctx.ndb).unwrap();
|
||||
TimelineKind::last_per_pubkey(list_kind).into_timeline(&txn, ctx.ndb)
|
||||
};
|
||||
let txn = Transaction::new(ctx.ndb).unwrap();
|
||||
let maybe_timeline =
|
||||
TimelineKind::last_per_pubkey(list_kind).into_timeline(&txn, ctx.ndb);
|
||||
|
||||
if let Some(mut timeline) = maybe_timeline {
|
||||
crate::timeline::setup_new_timeline(
|
||||
&mut timeline,
|
||||
ctx.ndb,
|
||||
&txn,
|
||||
&mut app.subscriptions,
|
||||
ctx.pool,
|
||||
ctx.note_cache,
|
||||
|
||||
@@ -410,7 +410,8 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
|
||||
let zapping_acc = self
|
||||
.cur_acc
|
||||
.as_ref()
|
||||
.filter(|_| self.note_context.current_account_has_wallet);
|
||||
.filter(|_| self.note_context.current_account_has_wallet)
|
||||
.or(self.cur_acc.as_ref());
|
||||
|
||||
notedeck_ui::padding(8.0, ui, |ui| {
|
||||
let resp = NoteView::new(
|
||||
|
||||
@@ -17,7 +17,7 @@ pub fn trust_media_from_pk2(
|
||||
pk1: Option<&[u8; 32]>,
|
||||
pk2: &[u8; 32],
|
||||
) -> bool {
|
||||
pk1.map(|pk| pk1_is_following_pk2(ndb, txn, pk, pk2).unwrap_or(false))
|
||||
pk1.map(|pk| pk == pk2 || pk1_is_following_pk2(ndb, txn, pk, pk2).unwrap_or(false))
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user