Add deleted user check

This commit is contained in:
erroneousboat 2018-09-01 18:59:00 +02:00
parent 7c3b08d1de
commit 3ab8921388
2 changed files with 12 additions and 14 deletions

View File

@ -380,8 +380,6 @@ func actionSearchPrevChannels(ctx *context.AppContext) {
} }
func actionChangeChannel(ctx *context.AppContext) { func actionChangeChannel(ctx *context.AppContext) {
ctx.View.Debug.Println(fmt.Sprintf("%d", ctx.View.Channels.SelectedChannel))
// Clear messages from Chat pane // Clear messages from Chat pane
ctx.View.Chat.ClearMessages() ctx.View.Chat.ClearMessages()

View File

@ -122,8 +122,8 @@ func (s *SlackService) GetChannels() []components.ChannelItem {
var chans []components.ChannelItem var chans []components.ChannelItem
for _, chn := range slackChans { for _, chn := range slackChans {
// Defaults // Defaults
var chanName string
var chanType string var chanType string
var presence string var presence string
@ -135,6 +135,7 @@ func (s *SlackService) GetChannels() []components.ChannelItem {
} }
chanType = components.ChannelTypeChannel chanType = components.ChannelTypeChannel
chanName = chn.Name
} }
if chn.IsGroup { if chn.IsGroup {
@ -143,29 +144,28 @@ func (s *SlackService) GetChannels() []components.ChannelItem {
} }
chanType = components.ChannelTypeGroup chanType = components.ChannelTypeGroup
chanName = chn.Name
} }
if chn.IsMpIM { if chn.IsMpIM {
// TODO: does it have an IsMember? // TODO: does it have an IsMember?
// TODO: same api as im? // TODO: same api as im?
chanType = components.ChannelTypeMpIM chanType = components.ChannelTypeMpIM
chanName = chn.Name
} }
if chn.IsIM { if chn.IsIM {
// TODO: check if user is deleted. IsUsedDeleted is not present // Check if user is deleted, we do this by checking the user id,
// in the `conversation` struct. // and see if we have the user in the UserCache
chanType = components.ChannelTypeIM name, ok := s.UserCache[chn.User]
if !ok {
// TODO: way to speed this up? see SetPresenceChannels continue
presence, _ = s.GetUserPresence(chn.ID)
} }
var chanName string
name, ok := s.UserCache[chn.User]
if ok {
chanName = name chanName = name
} else { chanType = components.ChannelTypeIM
chanName = chn.Name // TODO: way to speed this up? see SetPresenceChannels
presence, _ = s.GetUserPresence(chn.ID)
} }
chans = append( chans = append(