mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-17 08:44:20 +01:00
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:
@@ -64,7 +64,7 @@ impl RelayConfig {
|
|||||||
|
|
||||||
impl Default for RelayConfig {
|
impl Default for RelayConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::default_relays()
|
Self::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ impl TimelineKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TimelineKind::Hashtag(hashtag) => {
|
TimelineKind::Hashtag(hashtag) => {
|
||||||
let filters = hashtag
|
let mut filters: Vec<Filter> = hashtag
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|tag| !tag.is_empty())
|
.filter(|tag| !tag.is_empty())
|
||||||
.map(|tag| {
|
.map(|tag| {
|
||||||
@@ -525,7 +525,17 @@ impl TimelineKind {
|
|||||||
.tags([tag.to_lowercase().as_str()], 't')
|
.tags([tag.to_lowercase().as_str()], 't')
|
||||||
.build()
|
.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)
|
FilterState::ready(filters)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ pub struct ChannelDialog {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
pub hashtags: String,
|
pub hashtags: String,
|
||||||
pub is_open: bool,
|
pub is_open: bool,
|
||||||
|
pub focus_requested: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum ChannelDialogAction {
|
pub enum ChannelDialogAction {
|
||||||
@@ -19,6 +20,7 @@ impl ChannelDialog {
|
|||||||
name: String::new(),
|
name: String::new(),
|
||||||
hashtags: String::new(),
|
hashtags: String::new(),
|
||||||
is_open: false,
|
is_open: false,
|
||||||
|
focus_requested: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,6 +28,7 @@ impl ChannelDialog {
|
|||||||
self.is_open = true;
|
self.is_open = true;
|
||||||
self.name.clear();
|
self.name.clear();
|
||||||
self.hashtags.clear();
|
self.hashtags.clear();
|
||||||
|
self.focus_requested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn close(&mut self) {
|
pub fn close(&mut self) {
|
||||||
@@ -70,8 +73,11 @@ impl ChannelDialog {
|
|||||||
.desired_width(f32::INFINITY),
|
.desired_width(f32::INFINITY),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Auto-focus on name field when opened
|
// Auto-focus on name field when first opened
|
||||||
|
if !self.focus_requested {
|
||||||
name_response.request_focus();
|
name_response.request_focus();
|
||||||
|
self.focus_requested = true;
|
||||||
|
}
|
||||||
|
|
||||||
ui.add_space(16.0);
|
ui.add_space(16.0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user