Remove automatic relay configuration and fix channel creation issues

This commit fixes three user-reported issues:

1. **Remove automatic relay configuration**
   - Changed RelayConfig::default() to use new() instead of default_relays()
   - This ensures no relays are added automatically on startup
   - Users must now configure relays manually at startup

2. **Fix channel dialog focus constantly switching**
   - Added focus_requested flag to ChannelDialog
   - request_focus() is now only called once when dialog is first opened
   - Previously it was called every frame, causing constant focus switching
   - This prevented users from typing in the hashtags field

3. **Fix channel creation crash without hashtags**
   - Modified TimelineKind::Hashtag filter creation to handle empty hashtags
   - When no valid hashtags are provided, shows all notes (kind 1) instead of empty filter
   - Previously, empty hashtag vector caused crash due to empty filter set
   - Channels without hashtags now work as a "general" feed showing all notes

All fixes tested and build succeeds without errors.
This commit is contained in:
Claude
2025-11-14 06:19:01 +00:00
parent dc48b53339
commit 156dc21df1
3 changed files with 21 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ impl RelayConfig {
impl Default for RelayConfig {
fn default() -> Self {
Self::default_relays()
Self::new()
}
}

View File

@@ -515,7 +515,7 @@ impl TimelineKind {
}
TimelineKind::Hashtag(hashtag) => {
let filters = hashtag
let mut filters: Vec<Filter> = hashtag
.iter()
.filter(|tag| !tag.is_empty())
.map(|tag| {
@@ -525,7 +525,17 @@ impl TimelineKind {
.tags([tag.to_lowercase().as_str()], 't')
.build()
})
.collect::<Vec<_>>();
.collect();
// If no valid hashtags were provided, show all notes
if filters.is_empty() {
filters.push(
Filter::new()
.kinds([1])
.limit(filter::default_limit())
.build()
);
}
FilterState::ready(filters)
}

View File

@@ -6,6 +6,7 @@ pub struct ChannelDialog {
pub name: String,
pub hashtags: String,
pub is_open: bool,
pub focus_requested: bool,
}
pub enum ChannelDialogAction {
@@ -19,6 +20,7 @@ impl ChannelDialog {
name: String::new(),
hashtags: String::new(),
is_open: false,
focus_requested: false,
}
}
@@ -26,6 +28,7 @@ impl ChannelDialog {
self.is_open = true;
self.name.clear();
self.hashtags.clear();
self.focus_requested = false;
}
pub fn close(&mut self) {
@@ -70,8 +73,11 @@ impl ChannelDialog {
.desired_width(f32::INFINITY),
);
// Auto-focus on name field when opened
name_response.request_focus();
// Auto-focus on name field when first opened
if !self.focus_requested {
name_response.request_focus();
self.focus_requested = true;
}
ui.add_space(16.0);