Browse Source

fix(main): clear messages TextView when channel of type GuildText or GuildNews is selected only (#20)

rigormorrtiss 4 năm trước cách đây
mục cha
commit
ae60aa8bd6
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      discordo.go

+ 2 - 2
discordo.go

@@ -197,8 +197,6 @@ func onGuildsDropDownSelected(_ string, i int) {
 }
 
 func onChannelsTreeViewSelected(n *tview.TreeNode) {
-	messagesTextView.Clear()
-
 	channelID := n.GetReference().(discord.ChannelID)
 	currentChannel, err := discordState.Cabinet.Channel(channelID)
 	if err != nil {
@@ -230,6 +228,8 @@ func onChannelsTreeViewSelected(n *tview.TreeNode) {
 			mainFlex.AddItem(messageInputField, 3, 1, false)
 		}
 		app.SetFocus(messageInputField)
+
+		messagesTextView.Clear()
 		messagesTextView.SetTitle(currentChannel.Name)
 
 		messages, _ := discordSession.Messages(currentChannel.ID, config.GetMessagesLimit)