mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-24 03:24:21 +01:00
need mutable ndb reference to unsubscribe
Closes: https://github.com/damus-io/notedeck/pull/584
This commit is contained in:
committed by
William Casarin
parent
926a3f80f4
commit
0c29c89909
@@ -6,7 +6,7 @@ use nostrdb::Ndb;
|
|||||||
// TODO: make this interface more sandboxed
|
// TODO: make this interface more sandboxed
|
||||||
|
|
||||||
pub struct AppContext<'a> {
|
pub struct AppContext<'a> {
|
||||||
pub ndb: &'a Ndb,
|
pub ndb: &'a mut Ndb,
|
||||||
pub img_cache: &'a mut ImageCache,
|
pub img_cache: &'a mut ImageCache,
|
||||||
pub unknown_ids: &'a mut UnknownIds,
|
pub unknown_ids: &'a mut UnknownIds,
|
||||||
pub pool: &'a mut RelayPool,
|
pub pool: &'a mut RelayPool,
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ impl Notedeck {
|
|||||||
|
|
||||||
pub fn app_context(&mut self) -> AppContext<'_> {
|
pub fn app_context(&mut self) -> AppContext<'_> {
|
||||||
AppContext {
|
AppContext {
|
||||||
ndb: &self.ndb,
|
ndb: &mut self.ndb,
|
||||||
img_cache: &mut self.img_cache,
|
img_cache: &mut self.img_cache,
|
||||||
unknown_ids: &mut self.unknown_ids,
|
unknown_ids: &mut self.unknown_ids,
|
||||||
pool: &mut self.pool,
|
pool: &mut self.pool,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ impl MultiSubscriber {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unsubscribe(&mut self, ndb: &Ndb, pool: &mut RelayPool) {
|
pub fn unsubscribe(&mut self, ndb: &mut Ndb, pool: &mut RelayPool) {
|
||||||
if self.subscribers == 0 {
|
if self.subscribers == 0 {
|
||||||
error!("No subscribers to unsubscribe from");
|
error!("No subscribers to unsubscribe from");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ pub fn render_nav(
|
|||||||
RenderNavResponse::new(col, nav_response)
|
RenderNavResponse::new(col, nav_response)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unsubscribe_timeline(ndb: &Ndb, timeline: &Timeline) {
|
fn unsubscribe_timeline(ndb: &mut Ndb, timeline: &Timeline) {
|
||||||
if let Some(sub_id) = timeline.subscription {
|
if let Some(sub_id) = timeline.subscription {
|
||||||
if let Err(e) = ndb.unsubscribe(sub_id) {
|
if let Err(e) = ndb.unsubscribe(sub_id) {
|
||||||
error!("unsubscribe error: {}", e);
|
error!("unsubscribe error: {}", e);
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ pub trait NotesHolder {
|
|||||||
/// Local NotesHolder unsubscribe
|
/// Local NotesHolder unsubscribe
|
||||||
fn unsubscribe_locally<M: NotesHolder>(
|
fn unsubscribe_locally<M: NotesHolder>(
|
||||||
txn: &Transaction,
|
txn: &Transaction,
|
||||||
ndb: &Ndb,
|
ndb: &mut Ndb,
|
||||||
note_cache: &mut NoteCache,
|
note_cache: &mut NoteCache,
|
||||||
notes_holder_storage: &mut NotesHolderStorage<M>,
|
notes_holder_storage: &mut NotesHolderStorage<M>,
|
||||||
pool: &mut RelayPool,
|
pool: &mut RelayPool,
|
||||||
|
|||||||
Reference in New Issue
Block a user