MM-18463 Added update_badge notification when marking a channel as unread (#12499)

* MM-18463 Added update_badge notification when marking a channel as unread

* Address feedback
This commit is contained in:
Harrison Healey
2019-10-07 09:58:39 -04:00
committed by GitHub
parent 3fa26bd0ee
commit 66da2bab2b
9 changed files with 92 additions and 78 deletions

View File

@@ -1129,7 +1129,7 @@ func (us SqlUserStore) AnalyticsActiveCount(timePeriod int64, options model.User
return v, nil
}
func (us SqlUserStore) GetUnreadCount(userId string) (int64, error) {
func (us SqlUserStore) GetUnreadCount(userId string) (int64, *model.AppError) {
query := `
SELECT SUM(CASE WHEN c.Type = 'D' THEN (c.TotalMsgCount - cm.MsgCount) ELSE cm.MentionCount END)
FROM Channels c

View File

@@ -277,7 +277,7 @@ type UserStore interface {
GetSystemAdminProfiles() (map[string]*model.User, *model.AppError)
PermanentDelete(userId string) *model.AppError
AnalyticsActiveCount(time int64, options model.UserCountOptions) (int64, *model.AppError)
GetUnreadCount(userId string) (int64, error)
GetUnreadCount(userId string) (int64, *model.AppError)
GetUnreadCountForChannel(userId string, channelId string) (int64, *model.AppError)
GetAnyUnreadPostCountForChannel(userId string, channelId string) (int64, *model.AppError)
GetRecentlyActiveUsersForTeam(teamId string, offset, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)

View File

@@ -810,7 +810,7 @@ func (_m *UserStore) GetTeamGroupUsers(teamID string) ([]*model.User, *model.App
}
// GetUnreadCount provides a mock function with given fields: userId
func (_m *UserStore) GetUnreadCount(userId string) (int64, error) {
func (_m *UserStore) GetUnreadCount(userId string) (int64, *model.AppError) {
ret := _m.Called(userId)
var r0 int64
@@ -820,11 +820,13 @@ func (_m *UserStore) GetUnreadCount(userId string) (int64, error) {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(userId)
} else {
r1 = ret.Error(1)
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1

View File

@@ -6504,7 +6504,7 @@ func (s *TimerLayerUserStore) GetTeamGroupUsers(teamID string) ([]*model.User, *
return resultVar0, resultVar1
}
func (s *TimerLayerUserStore) GetUnreadCount(userId string) (int64, error) {
func (s *TimerLayerUserStore) GetUnreadCount(userId string) (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.UserStore.GetUnreadCount(userId)