Skip to content

feat: select unread messages#665

Open
mstruebing wants to merge 2 commits intoayn2op:mainfrom
mstruebing:first-unread
Open

feat: select unread messages#665
mstruebing wants to merge 2 commits intoayn2op:mainfrom
mstruebing:first-unread

Conversation

@mstruebing
Copy link
Copy Markdown

@mstruebing mstruebing commented Dec 16, 2025

selects the first unread channel and expands the guild if necessary with shortcut u (aka unread) while selected the guild tree.

Closes #664

root := gt.GetRoot()

var guildNode *tview.TreeNode
foundGuild := false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant: you can just check if guildNode != nil for foundGuild.

Comment on lines +232 to +235
// it continues walking without this
if foundGuild {
return false
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant: since you are already returning false when a guild a found, so the Walk func returns early anyway.

Comment on lines +236 to +243
if guildID, ok := node.GetReference().(discord.GuildID); ok {
indication := discordState.GuildIsUnread(guildID, ningen.GuildUnreadOpts{UnreadOpts: ningen.UnreadOpts{IncludeMutedCategories: true}})
if indication == ningen.ChannelMentioned || indication == ningen.ChannelUnread {
guildNode = node
foundGuild = true
return false
}
}
Copy link
Copy Markdown
Contributor

@ossenthusiast ossenthusiast Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only handles guilds, not private channels (DMs), check state.go:80 for example:

			switch node.GetReference() {
			case event.GuildID:
				node.SetTextStyle(app.chatView.guildsTree.getGuildNodeStyle(event.GuildID))
				guildNode = node
				return false
			case event.ChannelID:
				// private channel
				if !event.GuildID.IsValid() {
					style := app.chatView.guildsTree.getChannelNodeStyle(event.ChannelID)
					node.SetTextStyle(style)
					return false
				}
			}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard shortcut to select unread guild/channel/direct message

3 participants