Add channel name on chat pane on start-up

This commit is contained in:
erroneousboat 2016-10-02 13:32:36 +02:00
parent 1f27fcbcf9
commit 9be15b87f8
3 changed files with 7 additions and 6 deletions

View File

@ -18,9 +18,9 @@ Bugs:
want to load. want to load.
- [x] GetMessages for a channel can result in `json: cannot unmarshal number - [x] GetMessages for a channel can result in `json: cannot unmarshal number
into Go value of type string` https://github.com/nlopes/slack/issues/92 into Go value of type string` https://github.com/nlopes/slack/issues/92
- [x] set channelname on start
- [ ] docs at exported functions - [ ] docs at exported functions
- [ ] incoming message event.go probably need a type switch - [ ] incoming message event.go probably need a type switch
- [ ] set channel on start
Features: Features:
@ -29,4 +29,5 @@ Features:
- [x] scrolling in chat pane - [x] scrolling in chat pane
- [x] group channels, im channels - [x] group channels, im channels
- [x] scrolling in channel pane - [x] scrolling in channel pane
- [ ] command mode center text
- [ ] remove unsubscribed or closed channels/groups/im - [ ] remove unsubscribed or closed channels/groups/im

View File

@ -10,12 +10,11 @@ import (
type Chat struct { type Chat struct {
List *termui.List List *termui.List
SelectedChannel string
Offset int Offset int
} }
// CreateChat is the constructor for the Chat struct // CreateChat is the constructor for the Chat struct
func CreateChat(svc *service.SlackService, inputHeight int, selectedChannel interface{}) *Chat { func CreateChat(svc *service.SlackService, inputHeight int, selectedChannel interface{}, selectedChannelName string) *Chat {
chat := &Chat{ chat := &Chat{
List: termui.NewList(), List: termui.NewList(),
Offset: 0, Offset: 0,
@ -25,7 +24,7 @@ func CreateChat(svc *service.SlackService, inputHeight int, selectedChannel inte
chat.List.Overflow = "wrap" chat.List.Overflow = "wrap"
chat.GetMessages(svc, selectedChannel) chat.GetMessages(svc, selectedChannel)
// chat.SetBorderLabel(selectedChannel.Name) chat.SetBorderLabel(selectedChannelName)
return chat return chat
} }

View File

@ -23,6 +23,7 @@ func CreateChatView(svc *service.SlackService) *View {
svc, svc,
input.Par.Height, input.Par.Height,
svc.SlackChannels[channels.SelectedChannel], svc.SlackChannels[channels.SelectedChannel],
svc.Channels[channels.SelectedChannel].Name,
) )
mode := components.CreateMode() mode := components.CreateMode()