-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mute threads #604
base: master
Are you sure you want to change the base?
Mute threads #604
Conversation
- they need to be separate, both on at once is too much --features debug-widget-callstack Show callstack for the current widget on hover if all modifier keys are pressed down --features debug-interactive-widgets Show an overlay on all interactive widgets Notes: - debug-widget-callstack asserts `egui:callstack` feature when enabled - Only works in debug builds, compile error w/ release builds
I think this bug affected pubkey mutes as well.
Fixes damus-io#214 Needed to add the thread id of the Note we're checking to the MuteFun call signature.
On Thu, Dec 19, 2024 at 03:48:12PM GMT, Ken Sedgwick wrote:
Closes: #604
---
crates/notedeck_columns/src/actionbar.rs | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/crates/notedeck_columns/src/actionbar.rs b/crates/notedeck_columns/src/actionbar.rs
index e8d42f0..60225e4 100644
--- a/crates/notedeck_columns/src/actionbar.rs
+++ b/crates/notedeck_columns/src/actionbar.rs
@@ -7,7 +7,7 @@ use crate::{
};
use enostr::{NoteId, Pubkey, RelayPool};
-use nostrdb::{Ndb, Transaction};
+use nostrdb::{Ndb, NoteBuilder, Transaction};
use notedeck::{note::root_note_id_from_selected_id, MuteFun, NoteCache, NoteRef};
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
@@ -43,10 +43,15 @@ fn open_thread(
selected_note: &[u8; 32],
is_muted: &MuteFun,
) -> Option<NotesHolderResult> {
- router.route_to(Route::thread(NoteId::new(selected_note.to_owned())));
-
let root_id = root_note_id_from_selected_id(ndb, note_cache, txn, selected_note);
- Thread::open(ndb, note_cache, txn, pool, threads, root_id, is_muted)
+ // we only need to check if the thread is muted so use a dummy note
+ let dummy_note = NoteBuilder::new().build().unwrap();
this seems odd to me, maybe is_muted should take an enum instead? an
enum of what its checking to mute?
…+ if is_muted(&dummy_note, root_id) {
+ None
+ } else {
+ router.route_to(Route::thread(NoteId::new(selected_note.to_owned())));
+ Thread::open(ndb, note_cache, txn, pool, threads, root_id, is_muted)
+ }
}
impl NoteAction {
|
is_muted almost always is checking everything, this is the only case where we happen to not care about any note mutes because we are already targeting the thread. Actually, I think we should remove this check and instead display the thread view with a "this thread is muted" message to the user. Currently it crashes with something about height == 0. But we need to handle the case where the user is sitting on a thread view and it is muted externally ... I'm guessing we currently crash in this case. |
Converted to draft to consider the thread view |
Completes #214
Is it worth caching the root_note_id somewhere in the note or note view so we don't have to recompute it more than once?