commit cec49c83bd4f17b074bcb0b2479630c15069c2bc
parent 65bd6a65f902773d4c249fdf0b0837dc4f582c60
Author: William Casarin <jb55@jb55.com>
Date: Fri, 7 Mar 2025 12:36:26 -0800
fix formatting
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
8 files changed, 100 insertions(+), 52 deletions(-)
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -352,7 +352,8 @@ fn render_nav_body(
let txn = Transaction::new(ctx.ndb).expect("txn");
let post_response =
- ui::PostView::new(&mut note_context, draft, PostType::New, kp, inner_rect).ui(&txn, ui);
+ ui::PostView::new(&mut note_context, draft, PostType::New, kp, inner_rect)
+ .ui(&txn, ui);
post_response.action.map(Into::into)
}
diff --git a/crates/notedeck_columns/src/timeline/route.rs b/crates/notedeck_columns/src/timeline/route.rs
@@ -31,7 +31,8 @@ pub fn render_timeline_route(
| TimelineKind::Hashtag(_)
| TimelineKind::Generic(_) => {
let note_action =
- ui::TimelineView::new(kind, timeline_cache, &accounts.mutefun(), note_context).ui(ui);
+ ui::TimelineView::new(kind, timeline_cache, &accounts.mutefun(), note_context)
+ .ui(ui);
note_action.map(RenderNavAction::NoteAction)
}
diff --git a/crates/notedeck_columns/src/ui/note/contents.rs b/crates/notedeck_columns/src/ui/note/contents.rs
@@ -146,20 +146,28 @@ fn render_note_contents(
match block.blocktype() {
BlockType::MentionBech32 => match block.as_mention().unwrap() {
Mention::Profile(profile) => {
- let act =
- ui::Mention::new(note_context.ndb, note_context.img_cache, txn, profile.pubkey())
- .show(ui)
- .inner;
+ let act = ui::Mention::new(
+ note_context.ndb,
+ note_context.img_cache,
+ txn,
+ profile.pubkey(),
+ )
+ .show(ui)
+ .inner;
if act.is_some() {
note_action = act;
}
}
Mention::Pubkey(npub) => {
- let act =
- ui::Mention::new(note_context.ndb, note_context.img_cache, txn, npub.pubkey())
- .show(ui)
- .inner;
+ let act = ui::Mention::new(
+ note_context.ndb,
+ note_context.img_cache,
+ txn,
+ npub.pubkey(),
+ )
+ .show(ui)
+ .inner;
if act.is_some() {
note_action = act;
}
diff --git a/crates/notedeck_columns/src/ui/note/mod.rs b/crates/notedeck_columns/src/ui/note/mod.rs
@@ -385,7 +385,9 @@ impl<'a, 'd> NoteView<'a, 'd> {
if note_reply.reply().is_some() {
let action = ui
- .horizontal(|ui| reply_desc(ui, txn, ¬e_reply, self.note_context))
+ .horizontal(|ui| {
+ reply_desc(ui, txn, ¬e_reply, self.note_context)
+ })
.inner;
if action.is_some() {
diff --git a/crates/notedeck_columns/src/ui/note/post.rs b/crates/notedeck_columns/src/ui/note/post.rs
@@ -223,7 +223,8 @@ impl<'a, 'd> PostView<'a, 'd> {
hint_rect
};
- if let Ok(res) = self.note_context.ndb.search_profile(txn, mention_str, 10) {
+ if let Ok(res) = self.note_context.ndb.search_profile(txn, mention_str, 10)
+ {
let resp = SearchResultsView::new(
self.note_context.img_cache,
self.note_context.ndb,
@@ -238,8 +239,10 @@ impl<'a, 'd> PostView<'a, 'd> {
) => {
if let Some(hint_index) = selection {
if let Some(pk) = res.get(hint_index) {
- let record =
- self.note_context.ndb.get_profile_by_pubkey(txn, pk);
+ let record = self
+ .note_context
+ .ndb
+ .get_profile_by_pubkey(txn, pk);
self.draft.buffer.select_mention_and_replace_name(
mention.index,
diff --git a/crates/notedeck_columns/src/ui/note/reply_description.rs b/crates/notedeck_columns/src/ui/note/reply_description.rs
@@ -61,11 +61,16 @@ pub fn reply_desc(
if note_reply.is_reply_to_root() {
// We're replying to the root, let's show this
- let action = ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
- .size(size)
- .selectable(selectable)
- .show(ui)
- .inner;
+ let action = ui::Mention::new(
+ note_context.ndb,
+ note_context.img_cache,
+ txn,
+ reply_note.pubkey(),
+ )
+ .size(size)
+ .selectable(selectable)
+ .show(ui)
+ .inner;
if action.is_some() {
note_action = action;
@@ -80,12 +85,16 @@ pub fn reply_desc(
if let Ok(root_note) = note_context.ndb.get_note_by_id(txn, root.id) {
if root_note.pubkey() == reply_note.pubkey() {
// simply "replying to bob's note" when replying to bob in his thread
- let action =
- ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
- .size(size)
- .selectable(selectable)
- .show(ui)
- .inner;
+ let action = ui::Mention::new(
+ note_context.ndb,
+ note_context.img_cache,
+ txn,
+ reply_note.pubkey(),
+ )
+ .size(size)
+ .selectable(selectable)
+ .show(ui)
+ .inner;
if action.is_some() {
note_action = action;
@@ -99,12 +108,16 @@ pub fn reply_desc(
} else {
// replying to bob in alice's thread
- let action =
- ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
- .size(size)
- .selectable(selectable)
- .show(ui)
- .inner;
+ let action = ui::Mention::new(
+ note_context.ndb,
+ note_context.img_cache,
+ txn,
+ reply_note.pubkey(),
+ )
+ .size(size)
+ .selectable(selectable)
+ .show(ui)
+ .inner;
if action.is_some() {
note_action = action;
@@ -120,12 +133,16 @@ pub fn reply_desc(
Label::new(RichText::new("in").size(size).color(color)).selectable(selectable),
);
- let action =
- ui::Mention::new(note_context.ndb, note_context.img_cache, txn, root_note.pubkey())
- .size(size)
- .selectable(selectable)
- .show(ui)
- .inner;
+ let action = ui::Mention::new(
+ note_context.ndb,
+ note_context.img_cache,
+ txn,
+ root_note.pubkey(),
+ )
+ .size(size)
+ .selectable(selectable)
+ .show(ui)
+ .inner;
if action.is_some() {
note_action = action;
@@ -138,11 +155,16 @@ pub fn reply_desc(
note_link(ui, note_context, "thread", &root_note);
}
} else {
- let action = ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
- .size(size)
- .selectable(selectable)
- .show(ui)
- .inner;
+ let action = ui::Mention::new(
+ note_context.ndb,
+ note_context.img_cache,
+ txn,
+ reply_note.pubkey(),
+ )
+ .size(size)
+ .selectable(selectable)
+ .show(ui)
+ .inner;
if action.is_some() {
note_action = action;
diff --git a/crates/notedeck_columns/src/ui/profile/mod.rs b/crates/notedeck_columns/src/ui/profile/mod.rs
@@ -140,9 +140,12 @@ impl<'a, 'd> ProfileView<'a, 'd> {
ui.horizontal(|ui| {
ui.put(
pfp_rect,
- ProfilePic::new(self.note_context.img_cache, get_profile_url(Some(&profile)))
- .size(size)
- .border(ProfilePic::border_stroke(ui)),
+ ProfilePic::new(
+ self.note_context.img_cache,
+ get_profile_url(Some(&profile)),
+ )
+ .size(size)
+ .border(ProfilePic::border_stroke(ui)),
);
if ui.add(copy_key_widget(&pfp_rect)).clicked() {
diff --git a/crates/notedeck_columns/src/ui/timeline.rs b/crates/notedeck_columns/src/ui/timeline.rs
@@ -138,7 +138,14 @@ fn timeline_ui(
let txn = Transaction::new(note_context.ndb).expect("failed to create txn");
- TimelineTabView::new(timeline.current_view(), reversed, &txn, is_muted, note_context).show(ui)
+ TimelineTabView::new(
+ timeline.current_view(),
+ reversed,
+ &txn,
+ is_muted,
+ note_context,
+ )
+ .show(ui)
});
let at_top_after_scroll = scroll_output.state.offset.y == 0.0;
@@ -338,12 +345,13 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
let note_key = self.tab.notes[ind].key;
- let note = if let Ok(note) = self.note_context.ndb.get_note_by_key(self.txn, note_key) {
- note
- } else {
- warn!("failed to query note {:?}", note_key);
- return 0;
- };
+ let note =
+ if let Ok(note) = self.note_context.ndb.get_note_by_key(self.txn, note_key) {
+ note
+ } else {
+ warn!("failed to query note {:?}", note_key);
+ return 0;
+ };
// should we mute the thread? we might not have it!
let muted = if let Ok(root_id) = root_note_id_from_selected_id(