Fix GetLastViewedAt

This commit is contained in:
Wim 2016-11-13 16:03:04 +01:00
parent 0b4ac61435
commit 4fb0544b0e
1 changed files with 8 additions and 10 deletions

View File

@ -275,7 +275,7 @@ func (m *MMClient) parseActionPost(rmsg *Message) {
} }
func (m *MMClient) UpdateUsers() error { func (m *MMClient) UpdateUsers() error {
mmusers, err := m.Client.GetProfiles(0, 1000, "") mmusers, err := m.Client.GetProfiles(0, 5000, "")
if err != nil { if err != nil {
return errors.New(err.DetailedError) return errors.New(err.DetailedError)
} }
@ -542,14 +542,12 @@ func (m *MMClient) GetTeamFromChannel(channelId string) string {
func (m *MMClient) GetLastViewedAt(channelId string) int64 { func (m *MMClient) GetLastViewedAt(channelId string) int64 {
m.RLock() m.RLock()
defer m.RUnlock() defer m.RUnlock()
/* res, err := m.Client.GetChannel(channelId, "")
for _, t := range m.OtherTeams { if err != nil {
if _, ok := t.Channels.Members[channelId]; ok { return model.GetMillis()
return t.Channels.Members[channelId].LastViewedAt
} }
} data := res.Data.(*model.ChannelData)
*/ return data.Member.LastViewedAt
return 0
} }
func (m *MMClient) GetUsers() map[string]*model.User { func (m *MMClient) GetUsers() map[string]*model.User {
@ -623,7 +621,7 @@ func (m *MMClient) initUser() error {
//m.log.Debug("initUser(): loading all team data") //m.log.Debug("initUser(): loading all team data")
for _, v := range initData.Teams { for _, v := range initData.Teams {
m.Client.SetTeamId(v.Id) m.Client.SetTeamId(v.Id)
mmusers, _ := m.Client.GetProfiles(0, 1000, "") mmusers, _ := m.Client.GetProfiles(0, 5000, "")
t := &Team{Team: v, Users: mmusers.Data.(map[string]*model.User), Id: v.Id} t := &Team{Team: v, Users: mmusers.Data.(map[string]*model.User), Id: v.Id}
mmchannels, _ := m.Client.GetChannels("") mmchannels, _ := m.Client.GetChannels("")
t.Channels = mmchannels.Data.(*model.ChannelList) t.Channels = mmchannels.Data.(*model.ChannelList)