Add deleted user check
This commit is contained in:
parent
7c3b08d1de
commit
3ab8921388
@ -380,8 +380,6 @@ func actionSearchPrevChannels(ctx *context.AppContext) {
|
||||
}
|
||||
|
||||
func actionChangeChannel(ctx *context.AppContext) {
|
||||
ctx.View.Debug.Println(fmt.Sprintf("%d", ctx.View.Channels.SelectedChannel))
|
||||
|
||||
// Clear messages from Chat pane
|
||||
ctx.View.Chat.ClearMessages()
|
||||
|
||||
|
@ -122,8 +122,8 @@ func (s *SlackService) GetChannels() []components.ChannelItem {
|
||||
|
||||
var chans []components.ChannelItem
|
||||
for _, chn := range slackChans {
|
||||
|
||||
// Defaults
|
||||
var chanName string
|
||||
var chanType string
|
||||
var presence string
|
||||
|
||||
@ -135,6 +135,7 @@ func (s *SlackService) GetChannels() []components.ChannelItem {
|
||||
}
|
||||
|
||||
chanType = components.ChannelTypeChannel
|
||||
chanName = chn.Name
|
||||
}
|
||||
|
||||
if chn.IsGroup {
|
||||
@ -143,31 +144,30 @@ func (s *SlackService) GetChannels() []components.ChannelItem {
|
||||
}
|
||||
|
||||
chanType = components.ChannelTypeGroup
|
||||
chanName = chn.Name
|
||||
}
|
||||
|
||||
if chn.IsMpIM {
|
||||
// TODO: does it have an IsMember?
|
||||
// TODO: same api as im?
|
||||
chanType = components.ChannelTypeMpIM
|
||||
chanName = chn.Name
|
||||
}
|
||||
|
||||
if chn.IsIM {
|
||||
// TODO: check if user is deleted. IsUsedDeleted is not present
|
||||
// in the `conversation` struct.
|
||||
chanType = components.ChannelTypeIM
|
||||
// Check if user is deleted, we do this by checking the user id,
|
||||
// and see if we have the user in the UserCache
|
||||
name, ok := s.UserCache[chn.User]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
chanName = name
|
||||
chanType = components.ChannelTypeIM
|
||||
// TODO: way to speed this up? see SetPresenceChannels
|
||||
presence, _ = s.GetUserPresence(chn.ID)
|
||||
}
|
||||
|
||||
var chanName string
|
||||
name, ok := s.UserCache[chn.User]
|
||||
if ok {
|
||||
chanName = name
|
||||
} else {
|
||||
chanName = chn.Name
|
||||
}
|
||||
|
||||
chans = append(
|
||||
chans, components.ChannelItem{
|
||||
ID: chn.ID,
|
||||
|
Loading…
Reference in New Issue
Block a user