mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
* Route Calls pushes through a VoIP token if present
Add VoIP device id support so calls notifications can be delivered as iOS
PushKit pushes, while standard pushes continue using the regular device
token.
* New SessionPropVoIPDeviceId + IsValidVoIPDeviceID validator
* PushNotifyAppleReactNativeVoIP platform constant
* voip_device_id accepted on PUT /users/sessions/device and on login
* DoLogin refactored to accept LoginOptions struct; all four call sites
(api4/user, channels/web/{saml,magic_link,oauth}) converted
* sendPushNotificationToAllSessions: when SubType=calls, prefer
Session.Props[voip_device_id]; fall back to standard DeviceId
Tests cover the validator, the device-props endpoint (accept/reject), and
the SubType=calls routing matrix.
* Skip session per Calls plugin "answered_elsewhere" convention
When the Calls plugin fans out a cancel-ring push to a user's other
VoIP devices after they answer a call from one of them, it can't tell
core which session to skip because the public plugin API doesn't expose
a skip-session-id parameter. It encodes the auth-session-id on SenderId
together with Category="answered_elsewhere". Core honors the convention
and clears SenderId on the per-session copy before forwarding so the
session id never reaches the proxy or device. Category is preserved on
the wire so the mobile client can pick CXCallEndedReason.answeredElsewhere.
The matching side lives in mattermost-plugin-calls' push_notifications.go;
both sides cross-reference the constant.
* delay voip token audit until session props are set
* capture voip audit failed case
* Promote VoIP token to a column; dispatch by Transport; harden revocation
* ai feedback review
* feedback review
* feedback review
* fix tests
* update openAPI
* update serialized session model
---------
Co-authored-by: Jesse Hallam <[email protected]>
459 lines
11 KiB
Go
459 lines
11 KiB
Go
// Code generated by mockery v2.53.4. DO NOT EDIT.
|
|
|
|
// Regenerate this file using `make store-mocks`.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
model "github.com/mattermost/mattermost/server/public/model"
|
|
request "github.com/mattermost/mattermost/server/public/shared/request"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// SessionStore is an autogenerated mock type for the SessionStore type
|
|
type SessionStore struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// AnalyticsSessionCount provides a mock function with no fields
|
|
func (_m *SessionStore) AnalyticsSessionCount() (int64, error) {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for AnalyticsSessionCount")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func() (int64, error)); ok {
|
|
return rf()
|
|
}
|
|
if rf, ok := ret.Get(0).(func() int64); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func() error); ok {
|
|
r1 = rf()
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Cleanup provides a mock function with given fields: expiryTime, batchSize
|
|
func (_m *SessionStore) Cleanup(expiryTime int64, batchSize int64) error {
|
|
ret := _m.Called(expiryTime, batchSize)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Cleanup")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(int64, int64) error); ok {
|
|
r0 = rf(expiryTime, batchSize)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Get provides a mock function with given fields: rctx, sessionIDOrToken
|
|
func (_m *SessionStore) Get(rctx request.CTX, sessionIDOrToken string) (*model.Session, error) {
|
|
ret := _m.Called(rctx, sessionIDOrToken)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *model.Session
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.Session, error)); ok {
|
|
return rf(rctx, sessionIDOrToken)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.Session); ok {
|
|
r0 = rf(rctx, sessionIDOrToken)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.Session)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(request.CTX, string) error); ok {
|
|
r1 = rf(rctx, sessionIDOrToken)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetLRUSessions provides a mock function with given fields: rctx, userID, limit, offset
|
|
func (_m *SessionStore) GetLRUSessions(rctx request.CTX, userID string, limit uint64, offset uint64) ([]*model.Session, error) {
|
|
ret := _m.Called(rctx, userID, limit, offset)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetLRUSessions")
|
|
}
|
|
|
|
var r0 []*model.Session
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(request.CTX, string, uint64, uint64) ([]*model.Session, error)); ok {
|
|
return rf(rctx, userID, limit, offset)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(request.CTX, string, uint64, uint64) []*model.Session); ok {
|
|
r0 = rf(rctx, userID, limit, offset)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.Session)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(request.CTX, string, uint64, uint64) error); ok {
|
|
r1 = rf(rctx, userID, limit, offset)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetMobileSessionMetadata provides a mock function with no fields
|
|
func (_m *SessionStore) GetMobileSessionMetadata() ([]*model.MobileSessionMetadata, error) {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetMobileSessionMetadata")
|
|
}
|
|
|
|
var r0 []*model.MobileSessionMetadata
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func() ([]*model.MobileSessionMetadata, error)); ok {
|
|
return rf()
|
|
}
|
|
if rf, ok := ret.Get(0).(func() []*model.MobileSessionMetadata); ok {
|
|
r0 = rf()
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.MobileSessionMetadata)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func() error); ok {
|
|
r1 = rf()
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetSessions provides a mock function with given fields: rctx, userID
|
|
func (_m *SessionStore) GetSessions(rctx request.CTX, userID string) ([]*model.Session, error) {
|
|
ret := _m.Called(rctx, userID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetSessions")
|
|
}
|
|
|
|
var r0 []*model.Session
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(request.CTX, string) ([]*model.Session, error)); ok {
|
|
return rf(rctx, userID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(request.CTX, string) []*model.Session); ok {
|
|
r0 = rf(rctx, userID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.Session)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(request.CTX, string) error); ok {
|
|
r1 = rf(rctx, userID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetSessionsExpired provides a mock function with given fields: thresholdMillis, mobileOnly, unnotifiedOnly
|
|
func (_m *SessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) {
|
|
ret := _m.Called(thresholdMillis, mobileOnly, unnotifiedOnly)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetSessionsExpired")
|
|
}
|
|
|
|
var r0 []*model.Session
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(int64, bool, bool) ([]*model.Session, error)); ok {
|
|
return rf(thresholdMillis, mobileOnly, unnotifiedOnly)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(int64, bool, bool) []*model.Session); ok {
|
|
r0 = rf(thresholdMillis, mobileOnly, unnotifiedOnly)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.Session)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(int64, bool, bool) error); ok {
|
|
r1 = rf(thresholdMillis, mobileOnly, unnotifiedOnly)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetSessionsWithActiveDeviceIds provides a mock function with given fields: userID
|
|
func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userID string) ([]*model.Session, error) {
|
|
ret := _m.Called(userID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetSessionsWithActiveDeviceIds")
|
|
}
|
|
|
|
var r0 []*model.Session
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) ([]*model.Session, error)); ok {
|
|
return rf(userID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) []*model.Session); ok {
|
|
r0 = rf(userID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.Session)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(userID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// PermanentDeleteSessionsByUser provides a mock function with given fields: teamID
|
|
func (_m *SessionStore) PermanentDeleteSessionsByUser(teamID string) error {
|
|
ret := _m.Called(teamID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for PermanentDeleteSessionsByUser")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
|
r0 = rf(teamID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Remove provides a mock function with given fields: sessionIDOrToken
|
|
func (_m *SessionStore) Remove(sessionIDOrToken string) error {
|
|
ret := _m.Called(sessionIDOrToken)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Remove")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
|
r0 = rf(sessionIDOrToken)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// RemoveAllSessions provides a mock function with no fields
|
|
func (_m *SessionStore) RemoveAllSessions() error {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RemoveAllSessions")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func() error); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Save provides a mock function with given fields: rctx, session
|
|
func (_m *SessionStore) Save(rctx request.CTX, session *model.Session) (*model.Session, error) {
|
|
ret := _m.Called(rctx, session)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Save")
|
|
}
|
|
|
|
var r0 *model.Session
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(request.CTX, *model.Session) (*model.Session, error)); ok {
|
|
return rf(rctx, session)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(request.CTX, *model.Session) *model.Session); ok {
|
|
r0 = rf(rctx, session)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.Session)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(request.CTX, *model.Session) error); ok {
|
|
r1 = rf(rctx, session)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// UpdateDeviceId provides a mock function with given fields: id, deviceId, voIPDeviceId, expiresAt
|
|
func (_m *SessionStore) UpdateDeviceId(id string, deviceId string, voIPDeviceId string, expiresAt int64) error {
|
|
ret := _m.Called(id, deviceId, voIPDeviceId, expiresAt)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateDeviceId")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, string, string, int64) error); ok {
|
|
r0 = rf(id, deviceId, voIPDeviceId, expiresAt)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateExpiredNotify provides a mock function with given fields: sessionid, notified
|
|
func (_m *SessionStore) UpdateExpiredNotify(sessionid string, notified bool) error {
|
|
ret := _m.Called(sessionid, notified)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateExpiredNotify")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, bool) error); ok {
|
|
r0 = rf(sessionid, notified)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateExpiresAt provides a mock function with given fields: sessionID, timestamp
|
|
func (_m *SessionStore) UpdateExpiresAt(sessionID string, timestamp int64) error {
|
|
ret := _m.Called(sessionID, timestamp)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateExpiresAt")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
|
|
r0 = rf(sessionID, timestamp)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateLastActivityAt provides a mock function with given fields: sessionID, timestamp
|
|
func (_m *SessionStore) UpdateLastActivityAt(sessionID string, timestamp int64) error {
|
|
ret := _m.Called(sessionID, timestamp)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateLastActivityAt")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
|
|
r0 = rf(sessionID, timestamp)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateProps provides a mock function with given fields: session
|
|
func (_m *SessionStore) UpdateProps(session *model.Session) error {
|
|
ret := _m.Called(session)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateProps")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(*model.Session) error); ok {
|
|
r0 = rf(session)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateRoles provides a mock function with given fields: userID, roles
|
|
func (_m *SessionStore) UpdateRoles(userID string, roles string) (string, error) {
|
|
ret := _m.Called(userID, roles)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateRoles")
|
|
}
|
|
|
|
var r0 string
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok {
|
|
return rf(userID, roles)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string) string); ok {
|
|
r0 = rf(userID, roles)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
|
r1 = rf(userID, roles)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewSessionStore creates a new instance of SessionStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewSessionStore(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *SessionStore {
|
|
mock := &SessionStore{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|