feat: refactor activity center endpoints (#3237)
* feat: refactor activity center endpoints * fix: restore activity center tests using new endpoints * feat: Remove from activity center endpoints accepted flag * feat: Activity Center review fixes
This commit is contained in:
parent
596660c110
commit
224f7461e9
|
@ -38,6 +38,14 @@ const (
|
||||||
ActivityCenterMembershipStatusDeclined
|
ActivityCenterMembershipStatusDeclined
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type ActivityCenterQueryParamsRead uint
|
||||||
|
|
||||||
|
const (
|
||||||
|
ActivityCenterQueryParamsReadRead = iota + 1
|
||||||
|
ActivityCenterQueryParamsReadUnread
|
||||||
|
ActivityCenterQueryParamsReadAll
|
||||||
|
)
|
||||||
|
|
||||||
var ErrInvalidActivityCenterNotification = errors.New("invalid activity center notification")
|
var ErrInvalidActivityCenterNotification = errors.New("invalid activity center notification")
|
||||||
|
|
||||||
type ActivityCenterNotification struct {
|
type ActivityCenterNotification struct {
|
||||||
|
@ -59,11 +67,25 @@ type ActivityCenterNotification struct {
|
||||||
ContactVerificationStatus verification.RequestStatus `json:"contactVerificationStatus"`
|
ContactVerificationStatus verification.RequestStatus `json:"contactVerificationStatus"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ActivityCenterNotificationsRequest struct {
|
||||||
|
Cursor string `json:"cursor"`
|
||||||
|
Limit uint64 `json:"limit"`
|
||||||
|
ActivityTypes []ActivityCenterType `json:"activityTypes"`
|
||||||
|
ReadType ActivityCenterQueryParamsRead `json:"readType"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ActivityCenterCountRequest struct {
|
||||||
|
ActivityTypes []ActivityCenterType `json:"activityTypes"`
|
||||||
|
ReadType ActivityCenterQueryParamsRead `json:"readType"`
|
||||||
|
}
|
||||||
|
|
||||||
type ActivityCenterPaginationResponse struct {
|
type ActivityCenterPaginationResponse struct {
|
||||||
Cursor string `json:"cursor"`
|
Cursor string `json:"cursor"`
|
||||||
Notifications []*ActivityCenterNotification `json:"notifications"`
|
Notifications []*ActivityCenterNotification `json:"notifications"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ActivityCenterCountResponse = map[ActivityCenterType]uint64
|
||||||
|
|
||||||
type ActivityCenterState struct {
|
type ActivityCenterState struct {
|
||||||
HasSeen bool `json:"hasSeen"`
|
HasSeen bool `json:"hasSeen"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,14 +323,6 @@ func (db sqlitePersistence) unmarshalActivityCenterNotificationRows(rows *sql.Ro
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ActivityCenterQueryParamsRead uint
|
|
||||||
|
|
||||||
const (
|
|
||||||
ActivityCenterQueryParamsReadRead = iota + 1
|
|
||||||
ActivityCenterQueryParamsReadUnread
|
|
||||||
ActivityCenterQueryParamsReadAll
|
|
||||||
)
|
|
||||||
|
|
||||||
type activityCenterQueryParams struct {
|
type activityCenterQueryParams struct {
|
||||||
cursor string
|
cursor string
|
||||||
limit uint64
|
limit uint64
|
||||||
|
@ -580,40 +572,6 @@ func (db sqlitePersistence) GetActivityCenterNotificationByID(id types.HexBytes)
|
||||||
return notification, err
|
return notification, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db sqlitePersistence) UnreadActivityCenterNotifications(cursor string, limit uint64, activityTypes []ActivityCenterType) (string, []*ActivityCenterNotification, error) {
|
|
||||||
params := activityCenterQueryParams{
|
|
||||||
activityCenterTypes: activityTypes,
|
|
||||||
cursor: cursor,
|
|
||||||
limit: limit,
|
|
||||||
read: ActivityCenterQueryParamsReadUnread,
|
|
||||||
}
|
|
||||||
|
|
||||||
return db.activityCenterNotifications(params)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (db sqlitePersistence) ReadActivityCenterNotifications(cursor string, limit uint64, activityTypes []ActivityCenterType) (string, []*ActivityCenterNotification, error) {
|
|
||||||
params := activityCenterQueryParams{
|
|
||||||
activityCenterTypes: activityTypes,
|
|
||||||
cursor: cursor,
|
|
||||||
limit: limit,
|
|
||||||
read: ActivityCenterQueryParamsReadRead,
|
|
||||||
}
|
|
||||||
|
|
||||||
return db.activityCenterNotifications(params)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (db sqlitePersistence) ActivityCenterNotificationsBy(cursor string, limit uint64, activityTypes []ActivityCenterType, readType ActivityCenterQueryParamsRead, accepted bool) (string, []*ActivityCenterNotification, error) {
|
|
||||||
params := activityCenterQueryParams{
|
|
||||||
activityCenterTypes: activityTypes,
|
|
||||||
cursor: cursor,
|
|
||||||
limit: limit,
|
|
||||||
read: readType,
|
|
||||||
accepted: accepted,
|
|
||||||
}
|
|
||||||
|
|
||||||
return db.activityCenterNotifications(params)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (db sqlitePersistence) activityCenterNotifications(params activityCenterQueryParams) (string, []*ActivityCenterNotification, error) {
|
func (db sqlitePersistence) activityCenterNotifications(params activityCenterQueryParams) (string, []*ActivityCenterNotification, error) {
|
||||||
var tx *sql.Tx
|
var tx *sql.Tx
|
||||||
var err error
|
var err error
|
||||||
|
@ -648,14 +606,6 @@ func (db sqlitePersistence) activityCenterNotifications(params activityCenterQue
|
||||||
return latestCursor, notifications, nil
|
return latestCursor, notifications, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db sqlitePersistence) ActivityCenterNotifications(currCursor string, limit uint64) (string, []*ActivityCenterNotification, error) {
|
|
||||||
params := activityCenterQueryParams{
|
|
||||||
cursor: currCursor,
|
|
||||||
limit: limit,
|
|
||||||
}
|
|
||||||
return db.activityCenterNotifications(params)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (db sqlitePersistence) DismissAllActivityCenterNotifications() error {
|
func (db sqlitePersistence) DismissAllActivityCenterNotifications() error {
|
||||||
_, err := db.db.Exec(`UPDATE activity_center_notifications SET read = 1, dismissed = 1 WHERE NOT dismissed AND NOT accepted`)
|
_, err := db.db.Exec(`UPDATE activity_center_notifications SET read = 1, dismissed = 1 WHERE NOT dismissed AND NOT accepted`)
|
||||||
return err
|
return err
|
||||||
|
@ -887,22 +837,21 @@ func (db sqlitePersistence) MarkActivityCenterNotificationsUnread(ids []types.He
|
||||||
query := "UPDATE activity_center_notifications SET read = 0 WHERE id IN (" + inVector + ")" // nolint: gosec
|
query := "UPDATE activity_center_notifications SET read = 0 WHERE id IN (" + inVector + ")" // nolint: gosec
|
||||||
_, err := db.db.Exec(query, idsArgs...)
|
_, err := db.db.Exec(query, idsArgs...)
|
||||||
return err
|
return err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db sqlitePersistence) UnreadActivityCenterNotificationsCount() (uint64, error) {
|
func (db sqlitePersistence) ActivityCenterNotifications(cursor string, limit uint64, activityTypes []ActivityCenterType, readType ActivityCenterQueryParamsRead, accepted bool) (string, []*ActivityCenterNotification, error) {
|
||||||
var count uint64
|
params := activityCenterQueryParams{
|
||||||
err := db.buildActivityCenterNotificationsCountQuery(true, ActivityCenterQueryParamsReadUnread, []ActivityCenterType{}).Scan(&count)
|
activityCenterTypes: activityTypes,
|
||||||
return count, err
|
cursor: cursor,
|
||||||
|
limit: limit,
|
||||||
|
read: readType,
|
||||||
|
accepted: accepted,
|
||||||
|
}
|
||||||
|
|
||||||
|
return db.activityCenterNotifications(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db sqlitePersistence) UnreadAndAcceptedActivityCenterNotificationsCount(activityTypes []ActivityCenterType) (uint64, error) {
|
func (db sqlitePersistence) ActivityCenterNotificationsCount(activityTypes []ActivityCenterType, readType ActivityCenterQueryParamsRead, accepted bool) (uint64, error) {
|
||||||
var count uint64
|
|
||||||
err := db.buildActivityCenterNotificationsCountQuery(true, ActivityCenterQueryParamsReadUnread, activityTypes).Scan(&count)
|
|
||||||
return count, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (db sqlitePersistence) ActivityCenterNotificationsCountBy(activityTypes []ActivityCenterType, readType ActivityCenterQueryParamsRead, accepted bool) (uint64, error) {
|
|
||||||
var count uint64
|
var count uint64
|
||||||
err := db.buildActivityCenterNotificationsCountQuery(accepted, readType, activityTypes).Scan(&count)
|
err := db.buildActivityCenterNotificationsCountQuery(accepted, readType, activityTypes).Scan(&count)
|
||||||
return count, err
|
return count, err
|
||||||
|
|
|
@ -52,13 +52,13 @@ func TestDeleteActivityCenterNotificationsWhenEmpty(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
var count uint64
|
var count uint64
|
||||||
count, _ = p.UnreadActivityCenterNotificationsCount()
|
count, _ = p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, false)
|
||||||
require.Equal(t, uint64(1), count)
|
require.Equal(t, uint64(1), count)
|
||||||
|
|
||||||
err = p.DeleteActivityCenterNotifications([]types.HexBytes{})
|
err = p.DeleteActivityCenterNotifications([]types.HexBytes{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
count, _ = p.UnreadActivityCenterNotificationsCount()
|
count, _ = p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, false)
|
||||||
require.Equal(t, uint64(1), count)
|
require.Equal(t, uint64(1), count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,13 +81,13 @@ func TestDeleteActivityCenterNotificationsWithMultipleIds(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
var count uint64
|
var count uint64
|
||||||
count, _ = p.UnreadActivityCenterNotificationsCount()
|
count, _ = p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, false)
|
||||||
require.Equal(t, uint64(3), count)
|
require.Equal(t, uint64(3), count)
|
||||||
|
|
||||||
err = p.DeleteActivityCenterNotifications([]types.HexBytes{notifications[1].ID, notifications[2].ID})
|
err = p.DeleteActivityCenterNotifications([]types.HexBytes{notifications[1].ID, notifications[2].ID})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
count, _ = p.UnreadActivityCenterNotificationsCount()
|
count, _ = p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, false)
|
||||||
require.Equal(t, uint64(1), count)
|
require.Equal(t, uint64(1), count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ func TestUnreadActivityCenterNotificationsCount(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Test: Ignore soft deleted and accepted.
|
// Test: Ignore soft deleted and accepted.
|
||||||
count, err := p.UnreadActivityCenterNotificationsCount()
|
count, err := p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, true)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, uint64(3), count)
|
require.Equal(t, uint64(3), count)
|
||||||
}
|
}
|
||||||
|
@ -670,16 +670,14 @@ func TestUnreadAndAcceptedActivityCenterNotificationsCount(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Test: counts everything, except soft deleted notifications.
|
// Test: counts everything, except soft deleted notifications.
|
||||||
count, err := p.UnreadAndAcceptedActivityCenterNotificationsCount([]ActivityCenterType{})
|
count, err := p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, true)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, uint64(3), count)
|
require.Equal(t, uint64(3), count)
|
||||||
|
|
||||||
// Test: counts everything, except soft deleted ones and limit by type.
|
// Test: counts everything, except soft deleted ones and limit by type.
|
||||||
count, err = p.UnreadAndAcceptedActivityCenterNotificationsCount(
|
count, err = p.ActivityCenterNotificationsCount([]ActivityCenterType{
|
||||||
[]ActivityCenterType{
|
|
||||||
ActivityCenterNotificationTypeContactRequest,
|
ActivityCenterNotificationTypeContactRequest,
|
||||||
},
|
}, ActivityCenterQueryParamsReadUnread, true)
|
||||||
)
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, uint64(1), count)
|
require.Equal(t, uint64(1), count)
|
||||||
}
|
}
|
||||||
|
@ -710,7 +708,7 @@ func TestActivityCenterPersistence(t *testing.T) {
|
||||||
err = p.SaveActivityCenterNotification(notification)
|
err = p.SaveActivityCenterNotification(notification)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
cursor, notifications, err := p.ActivityCenterNotifications("", 2)
|
cursor, notifications, err := p.ActivityCenterNotifications("", 2, []ActivityCenterType{}, ActivityCenterQueryParamsReadAll, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Empty(t, cursor)
|
require.Empty(t, cursor)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
|
@ -727,7 +725,7 @@ func TestActivityCenterPersistence(t *testing.T) {
|
||||||
err = p.SaveActivityCenterNotification(notification)
|
err = p.SaveActivityCenterNotification(notification)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
cursor, notifications, err = p.ActivityCenterNotifications("", 1)
|
cursor, notifications, err = p.ActivityCenterNotifications("", 1, []ActivityCenterType{}, ActivityCenterQueryParamsReadAll, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
require.NotEmpty(t, cursor)
|
require.NotEmpty(t, cursor)
|
||||||
|
@ -735,7 +733,7 @@ func TestActivityCenterPersistence(t *testing.T) {
|
||||||
|
|
||||||
// fetch next pagination
|
// fetch next pagination
|
||||||
|
|
||||||
cursor, notifications, err = p.ActivityCenterNotifications(cursor, 1)
|
cursor, notifications, err = p.ActivityCenterNotifications(cursor, 1, []ActivityCenterType{}, ActivityCenterQueryParamsReadAll, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
require.Empty(t, cursor)
|
require.Empty(t, cursor)
|
||||||
|
@ -743,25 +741,25 @@ func TestActivityCenterPersistence(t *testing.T) {
|
||||||
require.Equal(t, nID1, notifications[0].ID)
|
require.Equal(t, nID1, notifications[0].ID)
|
||||||
|
|
||||||
// Check count
|
// Check count
|
||||||
count, err := p.UnreadActivityCenterNotificationsCount()
|
count, err := p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, uint64(2), count)
|
require.Equal(t, uint64(2), count)
|
||||||
|
|
||||||
// Mark first one as read
|
// Mark first one as read
|
||||||
require.NoError(t, p.MarkActivityCenterNotificationsRead([]types.HexBytes{nID1}))
|
require.NoError(t, p.MarkActivityCenterNotificationsRead([]types.HexBytes{nID1}))
|
||||||
count, err = p.UnreadActivityCenterNotificationsCount()
|
count, err = p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, uint64(1), count)
|
require.Equal(t, uint64(1), count)
|
||||||
|
|
||||||
// Mark first one as unread
|
// Mark first one as unread
|
||||||
require.NoError(t, p.MarkActivityCenterNotificationsUnread([]types.HexBytes{nID1}))
|
require.NoError(t, p.MarkActivityCenterNotificationsUnread([]types.HexBytes{nID1}))
|
||||||
count, err = p.UnreadActivityCenterNotificationsCount()
|
count, err = p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, uint64(2), count)
|
require.Equal(t, uint64(2), count)
|
||||||
|
|
||||||
// Mark all read
|
// Mark all read
|
||||||
require.NoError(t, p.MarkAllActivityCenterNotificationsRead())
|
require.NoError(t, p.MarkAllActivityCenterNotificationsRead())
|
||||||
_, notifications, err = p.ActivityCenterNotifications(cursor, 2)
|
_, notifications, err = p.ActivityCenterNotifications(cursor, 2, []ActivityCenterType{}, ActivityCenterQueryParamsReadAll, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 2)
|
require.Len(t, notifications, 2)
|
||||||
require.Empty(t, cursor)
|
require.Empty(t, cursor)
|
||||||
|
@ -769,7 +767,7 @@ func TestActivityCenterPersistence(t *testing.T) {
|
||||||
require.True(t, notifications[1].Read)
|
require.True(t, notifications[1].Read)
|
||||||
|
|
||||||
// Check count
|
// Check count
|
||||||
count, err = p.UnreadActivityCenterNotificationsCount()
|
count, err = p.ActivityCenterNotificationsCount([]ActivityCenterType{}, ActivityCenterQueryParamsReadUnread, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, uint64(0), count)
|
require.Equal(t, uint64(0), count)
|
||||||
|
|
||||||
|
@ -778,14 +776,14 @@ func TestActivityCenterPersistence(t *testing.T) {
|
||||||
notifications, err = p.AcceptActivityCenterNotifications([]types.HexBytes{nID1})
|
notifications, err = p.AcceptActivityCenterNotifications([]types.HexBytes{nID1})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
_, notifications, err = p.ActivityCenterNotifications("", 2)
|
_, notifications, err = p.ActivityCenterNotifications("", 2, []ActivityCenterType{}, ActivityCenterQueryParamsReadAll, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
// It should not be returned anymore
|
// It should not be returned anymore
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
|
|
||||||
// Mark last one as dismissed
|
// Mark last one as dismissed
|
||||||
require.NoError(t, p.DismissActivityCenterNotifications([]types.HexBytes{nID2}))
|
require.NoError(t, p.DismissActivityCenterNotifications([]types.HexBytes{nID2}))
|
||||||
_, notifications, err = p.ActivityCenterNotifications("", 2)
|
_, notifications, err = p.ActivityCenterNotifications("", 2, []ActivityCenterType{}, ActivityCenterQueryParamsReadAll, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
|
@ -805,7 +803,7 @@ func TestActivityCenterPersistence(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 2)
|
require.Len(t, notifications, 2)
|
||||||
|
|
||||||
_, notifications, err = p.ActivityCenterNotifications("", 2)
|
_, notifications, err = p.ActivityCenterNotifications("", 2, []ActivityCenterType{}, ActivityCenterQueryParamsReadAll, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
|
@ -821,7 +819,7 @@ func TestActivityCenterPersistence(t *testing.T) {
|
||||||
|
|
||||||
// Mark all as dismissed
|
// Mark all as dismissed
|
||||||
require.NoError(t, p.DismissAllActivityCenterNotifications())
|
require.NoError(t, p.DismissAllActivityCenterNotifications())
|
||||||
_, notifications, err = p.ActivityCenterNotifications("", 2)
|
_, notifications, err = p.ActivityCenterNotifications("", 2, []ActivityCenterType{}, ActivityCenterQueryParamsReadAll, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.Len(t, notifications, 2)
|
require.Len(t, notifications, 2)
|
||||||
|
@ -894,10 +892,12 @@ func TestActivityCenterReadUnreadPagination(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Fetch UNREAD notifications, first page.
|
// Fetch UNREAD notifications, first page.
|
||||||
cursor, notifications, err := p.UnreadActivityCenterNotifications(
|
cursor, notifications, err := p.ActivityCenterNotifications(
|
||||||
initialOrFinalCursor,
|
initialOrFinalCursor,
|
||||||
1,
|
1,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadUnread,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
|
@ -905,20 +905,24 @@ func TestActivityCenterReadUnreadPagination(t *testing.T) {
|
||||||
require.NotEmpty(t, cursor)
|
require.NotEmpty(t, cursor)
|
||||||
|
|
||||||
// Fetch next pages.
|
// Fetch next pages.
|
||||||
cursor, notifications, err = p.UnreadActivityCenterNotifications(
|
cursor, notifications, err = p.ActivityCenterNotifications(
|
||||||
cursor,
|
cursor,
|
||||||
1,
|
1,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadUnread,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
require.Equal(t, nID3, notifications[0].ID)
|
require.Equal(t, nID3, notifications[0].ID)
|
||||||
require.NotEmpty(t, cursor)
|
require.NotEmpty(t, cursor)
|
||||||
|
|
||||||
cursor, notifications, err = p.UnreadActivityCenterNotifications(
|
cursor, notifications, err = p.ActivityCenterNotifications(
|
||||||
cursor,
|
cursor,
|
||||||
1,
|
1,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadUnread,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
|
@ -926,10 +930,12 @@ func TestActivityCenterReadUnreadPagination(t *testing.T) {
|
||||||
require.Empty(t, cursor)
|
require.Empty(t, cursor)
|
||||||
|
|
||||||
// Fetch READ notifications, first page.
|
// Fetch READ notifications, first page.
|
||||||
cursor, notifications, err = p.ReadActivityCenterNotifications(
|
cursor, notifications, err = p.ActivityCenterNotifications(
|
||||||
initialOrFinalCursor,
|
initialOrFinalCursor,
|
||||||
1,
|
1,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadRead,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
|
@ -937,10 +943,12 @@ func TestActivityCenterReadUnreadPagination(t *testing.T) {
|
||||||
require.NotEmpty(t, cursor)
|
require.NotEmpty(t, cursor)
|
||||||
|
|
||||||
// Fetch next page.
|
// Fetch next page.
|
||||||
cursor, notifications, err = p.ReadActivityCenterNotifications(
|
cursor, notifications, err = p.ActivityCenterNotifications(
|
||||||
cursor,
|
cursor,
|
||||||
1,
|
1,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadRead,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
|
@ -994,10 +1002,12 @@ func TestActivityCenterReadUnreadFilterByTypes(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't filter by type if the array of types is empty.
|
// Don't filter by type if the array of types is empty.
|
||||||
_, notifications, err := p.UnreadActivityCenterNotifications(
|
_, notifications, err := p.ActivityCenterNotifications(
|
||||||
initialCursor,
|
initialCursor,
|
||||||
limit,
|
limit,
|
||||||
[]ActivityCenterType{},
|
[]ActivityCenterType{},
|
||||||
|
ActivityCenterQueryParamsReadUnread,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 3)
|
require.Len(t, notifications, 3)
|
||||||
|
@ -1005,29 +1015,35 @@ func TestActivityCenterReadUnreadFilterByTypes(t *testing.T) {
|
||||||
require.Equal(t, nID2, notifications[1].ID)
|
require.Equal(t, nID2, notifications[1].ID)
|
||||||
require.Equal(t, nID1, notifications[2].ID)
|
require.Equal(t, nID1, notifications[2].ID)
|
||||||
|
|
||||||
_, notifications, err = p.UnreadActivityCenterNotifications(
|
_, notifications, err = p.ActivityCenterNotifications(
|
||||||
initialCursor,
|
initialCursor,
|
||||||
limit,
|
limit,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadUnread,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
require.Equal(t, nID2, notifications[0].ID)
|
require.Equal(t, nID2, notifications[0].ID)
|
||||||
|
|
||||||
_, notifications, err = p.UnreadActivityCenterNotifications(
|
_, notifications, err = p.ActivityCenterNotifications(
|
||||||
initialCursor,
|
initialCursor,
|
||||||
limit,
|
limit,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeMention},
|
[]ActivityCenterType{ActivityCenterNotificationTypeMention},
|
||||||
|
ActivityCenterQueryParamsReadUnread,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 2)
|
require.Len(t, notifications, 2)
|
||||||
require.Equal(t, nID3, notifications[0].ID)
|
require.Equal(t, nID3, notifications[0].ID)
|
||||||
require.Equal(t, nID1, notifications[1].ID)
|
require.Equal(t, nID1, notifications[1].ID)
|
||||||
|
|
||||||
_, notifications, err = p.UnreadActivityCenterNotifications(
|
_, notifications, err = p.ActivityCenterNotifications(
|
||||||
initialCursor,
|
initialCursor,
|
||||||
limit,
|
limit,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeMention, ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeMention, ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadUnread,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 3)
|
require.Len(t, notifications, 3)
|
||||||
|
@ -1041,19 +1057,23 @@ func TestActivityCenterReadUnreadFilterByTypes(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, notifications, err = p.ReadActivityCenterNotifications(
|
_, notifications, err = p.ActivityCenterNotifications(
|
||||||
initialCursor,
|
initialCursor,
|
||||||
limit,
|
limit,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadRead,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
require.Equal(t, nID2, notifications[0].ID)
|
require.Equal(t, nID2, notifications[0].ID)
|
||||||
|
|
||||||
_, notifications, err = p.ReadActivityCenterNotifications(
|
_, notifications, err = p.ActivityCenterNotifications(
|
||||||
initialCursor,
|
initialCursor,
|
||||||
limit,
|
limit,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeMention},
|
[]ActivityCenterType{ActivityCenterNotificationTypeMention},
|
||||||
|
ActivityCenterQueryParamsReadRead,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, notifications, 2)
|
require.Len(t, notifications, 2)
|
||||||
|
@ -1100,20 +1120,24 @@ func TestActivityCenterReadUnread(t *testing.T) {
|
||||||
err = p.MarkActivityCenterNotificationsRead([]types.HexBytes{nID2})
|
err = p.MarkActivityCenterNotificationsRead([]types.HexBytes{nID2})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
cursor, notifications, err := p.UnreadActivityCenterNotifications(
|
cursor, notifications, err := p.ActivityCenterNotifications(
|
||||||
"",
|
"",
|
||||||
2,
|
2,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadUnread,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Empty(t, cursor)
|
require.Empty(t, cursor)
|
||||||
require.Len(t, notifications, 1)
|
require.Len(t, notifications, 1)
|
||||||
require.Equal(t, nID1, notifications[0].ID)
|
require.Equal(t, nID1, notifications[0].ID)
|
||||||
|
|
||||||
cursor, notifications, err = p.ReadActivityCenterNotifications(
|
cursor, notifications, err = p.ActivityCenterNotifications(
|
||||||
"",
|
"",
|
||||||
2,
|
2,
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
[]ActivityCenterType{ActivityCenterNotificationTypeNewOneToOne},
|
||||||
|
ActivityCenterQueryParamsReadRead,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Empty(t, cursor)
|
require.Empty(t, cursor)
|
||||||
|
|
|
@ -12,22 +12,6 @@ import (
|
||||||
"github.com/status-im/status-go/protocol/protobuf"
|
"github.com/status-im/status-go/protocol/protobuf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *Messenger) UnreadActivityCenterNotificationsCount() (uint64, error) {
|
|
||||||
return m.persistence.UnreadActivityCenterNotificationsCount()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Messenger) UnreadAndAcceptedActivityCenterNotificationsCount(activityTypes []ActivityCenterType) (uint64, error) {
|
|
||||||
return m.persistence.UnreadAndAcceptedActivityCenterNotificationsCount(activityTypes)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Messenger) HasUnseenActivityCenterNotifications() (bool, error) {
|
|
||||||
return m.persistence.HasUnseenActivityCenterNotifications()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Messenger) GetActivityCenterState() (*ActivityCenterState, error) {
|
|
||||||
return m.persistence.GetActivityCenterState()
|
|
||||||
}
|
|
||||||
|
|
||||||
func toHexBytes(b [][]byte) []types.HexBytes {
|
func toHexBytes(b [][]byte) []types.HexBytes {
|
||||||
hb := make([]types.HexBytes, len(b))
|
hb := make([]types.HexBytes, len(b))
|
||||||
|
|
||||||
|
@ -48,6 +32,41 @@ func fromHexBytes(hb []types.HexBytes) [][]byte {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Messenger) ActivityCenterNotifications(request ActivityCenterNotificationsRequest) (*ActivityCenterPaginationResponse, error) {
|
||||||
|
cursor, notifications, err := m.persistence.ActivityCenterNotifications(request.Cursor, request.Limit, request.ActivityTypes, request.ReadType, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &ActivityCenterPaginationResponse{
|
||||||
|
Cursor: cursor,
|
||||||
|
Notifications: notifications,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Messenger) ActivityCenterNotificationsCount(request ActivityCenterCountRequest) (*ActivityCenterCountResponse, error) {
|
||||||
|
response := make(ActivityCenterCountResponse)
|
||||||
|
|
||||||
|
for _, activityType := range request.ActivityTypes {
|
||||||
|
count, err := m.persistence.ActivityCenterNotificationsCount([]ActivityCenterType{activityType}, request.ReadType, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
response[activityType] = count
|
||||||
|
}
|
||||||
|
|
||||||
|
return &response, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Messenger) HasUnseenActivityCenterNotifications() (bool, error) {
|
||||||
|
return m.persistence.HasUnseenActivityCenterNotifications()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Messenger) GetActivityCenterState() (*ActivityCenterState, error) {
|
||||||
|
return m.persistence.GetActivityCenterState()
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Messenger) MarkAsSeenActivityCenterNotifications() (*MessengerResponse, error) {
|
func (m *Messenger) MarkAsSeenActivityCenterNotifications() (*MessengerResponse, error) {
|
||||||
response := &MessengerResponse{}
|
response := &MessengerResponse{}
|
||||||
err := m.persistence.MarkAsSeenActivityCenterNotifications()
|
err := m.persistence.MarkAsSeenActivityCenterNotifications()
|
||||||
|
@ -278,58 +297,6 @@ func (m *Messenger) ActivityCenterNotification(id types.HexBytes) (*ActivityCent
|
||||||
return m.persistence.GetActivityCenterNotificationByID(id)
|
return m.persistence.GetActivityCenterNotificationByID(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Messenger) ActivityCenterNotifications(cursor string, limit uint64) (*ActivityCenterPaginationResponse, error) {
|
|
||||||
cursor, notifications, err := m.persistence.ActivityCenterNotifications(cursor, limit)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &ActivityCenterPaginationResponse{
|
|
||||||
Cursor: cursor,
|
|
||||||
Notifications: notifications,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Messenger) ReadActivityCenterNotifications(cursor string, limit uint64, activityTypes []ActivityCenterType) (*ActivityCenterPaginationResponse, error) {
|
|
||||||
cursor, notifications, err := m.persistence.ReadActivityCenterNotifications(cursor, limit, activityTypes)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &ActivityCenterPaginationResponse{
|
|
||||||
Cursor: cursor,
|
|
||||||
Notifications: notifications,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Messenger) UnreadActivityCenterNotifications(cursor string, limit uint64, activityTypes []ActivityCenterType) (*ActivityCenterPaginationResponse, error) {
|
|
||||||
cursor, notifications, err := m.persistence.UnreadActivityCenterNotifications(cursor, limit, activityTypes)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &ActivityCenterPaginationResponse{
|
|
||||||
Cursor: cursor,
|
|
||||||
Notifications: notifications,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Messenger) ActivityCenterNotificationsBy(cursor string, limit uint64, activityTypes []ActivityCenterType, readType ActivityCenterQueryParamsRead, accepted bool) (*ActivityCenterPaginationResponse, error) {
|
|
||||||
cursor, notifications, err := m.persistence.ActivityCenterNotificationsBy(cursor, limit, activityTypes, readType, accepted)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &ActivityCenterPaginationResponse{
|
|
||||||
Cursor: cursor,
|
|
||||||
Notifications: notifications,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Messenger) ActivityCenterNotificationsCountBy(activityTypes []ActivityCenterType, readType ActivityCenterQueryParamsRead, accepted bool) (uint64, error) {
|
|
||||||
return m.persistence.ActivityCenterNotificationsCountBy(activityTypes, readType, accepted)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Messenger) handleActivityCenterRead(state *ReceivedMessageState, message protobuf.SyncActivityCenterRead) error {
|
func (m *Messenger) handleActivityCenterRead(state *ReceivedMessageState, message protobuf.SyncActivityCenterRead) error {
|
||||||
resp, err := m.MarkActivityCenterNotificationsRead(context.TODO(), toHexBytes(message.Ids), false)
|
resp, err := m.MarkActivityCenterNotificationsRead(context.TODO(), toHexBytes(message.Ids), false)
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,13 @@ func (s *MessengerContactRequestSuite) TestReceiveAndAcceptContactRequest() { //
|
||||||
|
|
||||||
s.Require().Equal(common.ContactRequestStatePending, resp.Messages()[0].ContactRequestState)
|
s.Require().Equal(common.ContactRequestStatePending, resp.Messages()[0].ContactRequestState)
|
||||||
|
|
||||||
notifications, err := theirMessenger.ActivityCenterNotifications("", 10)
|
notifications, err := theirMessenger.ActivityCenterNotifications(ActivityCenterNotificationsRequest{
|
||||||
|
Cursor: "",
|
||||||
|
Limit: 10,
|
||||||
|
ActivityTypes: []ActivityCenterType{},
|
||||||
|
ReadType: ActivityCenterQueryParamsReadUnread,
|
||||||
|
},
|
||||||
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
s.Require().Len(notifications.Notifications, 1)
|
s.Require().Len(notifications.Notifications, 1)
|
||||||
|
|
|
@ -691,10 +691,13 @@ func (s *MessengerVerificationRequests) TestCancelVerificationRequest() {
|
||||||
s.Require().Equal(common.ContactVerificationStatePending, resp.Messages()[0].ContactVerificationState)
|
s.Require().Equal(common.ContactVerificationStatePending, resp.Messages()[0].ContactVerificationState)
|
||||||
|
|
||||||
// Make sure it's stored and retrieved correctly
|
// Make sure it's stored and retrieved correctly
|
||||||
notifications, err := theirMessenger.UnreadActivityCenterNotifications(
|
notifications, err := theirMessenger.ActivityCenterNotifications(
|
||||||
"",
|
ActivityCenterNotificationsRequest{
|
||||||
4,
|
Cursor: "",
|
||||||
[]ActivityCenterType{ActivityCenterNotificationTypeContactVerification},
|
Limit: 4,
|
||||||
|
ActivityTypes: []ActivityCenterType{ActivityCenterNotificationTypeContactVerification},
|
||||||
|
ReadType: ActivityCenterQueryParamsReadUnread,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Greater(len(notifications.Notifications), 0)
|
s.Require().Greater(len(notifications.Notifications), 0)
|
||||||
|
|
|
@ -1090,14 +1090,12 @@ func (api *PublicAPI) RequestCommunityInfoFromMailserverAsync(communityID string
|
||||||
return api.service.messenger.RequestCommunityInfoFromMailserverAsync(communityID)
|
return api.service.messenger.RequestCommunityInfoFromMailserverAsync(communityID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *PublicAPI) UnreadActivityCenterNotificationsCount() (uint64, error) {
|
func (api *PublicAPI) ActivityCenterNotifications(request protocol.ActivityCenterNotificationsRequest) (*protocol.ActivityCenterPaginationResponse, error) {
|
||||||
return api.service.messenger.UnreadActivityCenterNotificationsCount()
|
return api.service.messenger.ActivityCenterNotifications(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnreadAndAcceptedActivityCenterNotificationsCount is a temporary endpoint to
|
func (api *PublicAPI) ActivityCenterNotificationsCount(request protocol.ActivityCenterCountRequest) (*protocol.ActivityCenterCountResponse, error) {
|
||||||
// support the mobile client needs.
|
return api.service.messenger.ActivityCenterNotificationsCount(request)
|
||||||
func (api *PublicAPI) UnreadAndAcceptedActivityCenterNotificationsCount(activityTypes []protocol.ActivityCenterType) (uint64, error) {
|
|
||||||
return api.service.messenger.UnreadAndAcceptedActivityCenterNotificationsCount(activityTypes)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *PublicAPI) HasUnseenActivityCenterNotifications() (bool, error) {
|
func (api *PublicAPI) HasUnseenActivityCenterNotifications() (bool, error) {
|
||||||
|
@ -1137,26 +1135,6 @@ func (api *PublicAPI) DeleteActivityCenterNotifications(ctx context.Context, ids
|
||||||
return api.service.messenger.DeleteActivityCenterNotifications(ctx, ids, false)
|
return api.service.messenger.DeleteActivityCenterNotifications(ctx, ids, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *PublicAPI) ActivityCenterNotifications(cursor string, limit uint64) (*protocol.ActivityCenterPaginationResponse, error) {
|
|
||||||
return api.service.messenger.ActivityCenterNotifications(cursor, limit)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *PublicAPI) ReadActivityCenterNotifications(cursor string, limit uint64, activityType protocol.ActivityCenterType) (*protocol.ActivityCenterPaginationResponse, error) {
|
|
||||||
return api.service.messenger.ReadActivityCenterNotifications(cursor, limit, []protocol.ActivityCenterType{activityType})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *PublicAPI) UnreadActivityCenterNotifications(cursor string, limit uint64, activityType protocol.ActivityCenterType) (*protocol.ActivityCenterPaginationResponse, error) {
|
|
||||||
return api.service.messenger.UnreadActivityCenterNotifications(cursor, limit, []protocol.ActivityCenterType{activityType})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *PublicAPI) ActivityCenterNotificationsBy(cursor string, limit uint64, activityTypes []protocol.ActivityCenterType, readType protocol.ActivityCenterQueryParamsRead, accepted bool) (*protocol.ActivityCenterPaginationResponse, error) {
|
|
||||||
return api.service.messenger.ActivityCenterNotificationsBy(cursor, limit, activityTypes, readType, accepted)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *PublicAPI) ActivityCenterNotificationsCountBy(activityTypes []protocol.ActivityCenterType, readType protocol.ActivityCenterQueryParamsRead, accepted bool) (uint64, error) {
|
|
||||||
return api.service.messenger.ActivityCenterNotificationsCountBy(activityTypes, readType, accepted)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *PublicAPI) RequestAllHistoricMessages() (*protocol.MessengerResponse, error) {
|
func (api *PublicAPI) RequestAllHistoricMessages() (*protocol.MessengerResponse, error) {
|
||||||
return api.service.messenger.RequestAllHistoricMessages()
|
return api.service.messenger.RequestAllHistoricMessages()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue