feat(GODT-2835): Bump GPA adding support for AsyncAttachments for BugReport +...
This commit is contained in:
parent
1c344211d1
commit
de0b6c0737
2
go.mod
2
go.mod
|
@ -7,7 +7,7 @@ require (
|
|||
github.com/Masterminds/semver/v3 v3.2.0
|
||||
github.com/ProtonMail/gluon v0.17.1-0.20230911134257-5eb2eeebbef5
|
||||
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a
|
||||
github.com/ProtonMail/go-proton-api v0.4.1-0.20230925123025-331ad8e6d5ee
|
||||
github.com/ProtonMail/go-proton-api v0.4.1-0.20231003121658-67aa58c9f12d
|
||||
github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton
|
||||
github.com/PuerkitoBio/goquery v1.8.1
|
||||
github.com/abiosoft/ishell v2.0.0+incompatible
|
||||
|
|
4
go.sum
4
go.sum
|
@ -35,8 +35,8 @@ github.com/ProtonMail/go-message v0.13.1-0.20230526094639-b62c999c85b7 h1:+j+Kd/
|
|||
github.com/ProtonMail/go-message v0.13.1-0.20230526094639-b62c999c85b7/go.mod h1:NBAn21zgCJ/52WLDyed18YvYFm5tEoeDauubFqLokM4=
|
||||
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f h1:tCbYj7/299ekTTXpdwKYF8eBlsYsDVoggDAuAjoK66k=
|
||||
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f/go.mod h1:gcr0kNtGBqin9zDW9GOHcVntrwnjrK+qdJ06mWYBybw=
|
||||
github.com/ProtonMail/go-proton-api v0.4.1-0.20230925123025-331ad8e6d5ee h1:CzFXOiflEZZqT3HQqj2I5AkIprRbc/c6/lToPdEKzxM=
|
||||
github.com/ProtonMail/go-proton-api v0.4.1-0.20230925123025-331ad8e6d5ee/go.mod h1:Y3ea3i1UbqHz5vq43odmAAd6lmR4nx0ZIQ32tqMfxTY=
|
||||
github.com/ProtonMail/go-proton-api v0.4.1-0.20231003121658-67aa58c9f12d h1:2W4BXGvJZGQlzRTDyRm7B9FG5VkMqs59yatrjzkpf3c=
|
||||
github.com/ProtonMail/go-proton-api v0.4.1-0.20231003121658-67aa58c9f12d/go.mod h1:Y3ea3i1UbqHz5vq43odmAAd6lmR4nx0ZIQ32tqMfxTY=
|
||||
github.com/ProtonMail/go-srp v0.0.7 h1:Sos3Qk+th4tQR64vsxGIxYpN3rdnG9Wf9K4ZloC1JrI=
|
||||
github.com/ProtonMail/go-srp v0.0.7/go.mod h1:giCp+7qRnMIcCvI6V6U3S1lDDXDQYx2ewJ6F/9wdlJk=
|
||||
github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton h1:YS6M20yvjCJPR1r4ADW5TPn6rahs4iAyZaACei86bEc=
|
||||
|
|
|
@ -78,7 +78,7 @@ func (bridge *Bridge) ReportBug(ctx context.Context, osType, osVersion, title, d
|
|||
}
|
||||
}, bridge.usersLock)
|
||||
|
||||
return bridge.api.ReportBug(ctx, proton.ReportBugReq{
|
||||
_, err := bridge.api.ReportBug(ctx, proton.ReportBugReq{
|
||||
OS: osType,
|
||||
OSVersion: osVersion,
|
||||
|
||||
|
@ -92,4 +92,6 @@ func (bridge *Bridge) ReportBug(ctx context.Context, osType, osVersion, title, d
|
|||
Username: account,
|
||||
Email: email,
|
||||
}, attachment...)
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -68,10 +68,10 @@ type UserInfo struct {
|
|||
BridgePass []byte
|
||||
|
||||
// UsedSpace is the amount of space used by the user.
|
||||
UsedSpace int
|
||||
UsedSpace uint64
|
||||
|
||||
// MaxSpace is the total amount of space available to the user.
|
||||
MaxSpace int
|
||||
MaxSpace uint64
|
||||
}
|
||||
|
||||
// GetUserIDs returns the IDs of all known users (authorized or not).
|
||||
|
|
|
@ -175,7 +175,7 @@ type UsedSpaceChanged struct {
|
|||
|
||||
UserID string
|
||||
|
||||
UsedSpace int
|
||||
UsedSpace uint64
|
||||
}
|
||||
|
||||
func (event UsedSpaceChanged) String() string {
|
||||
|
|
|
@ -193,7 +193,7 @@ func NewUserBadEvent(userID string, errorMessage string) *StreamEvent {
|
|||
return userEvent(&UserEvent{Event: &UserEvent_UserBadEvent{UserBadEvent: &UserBadEvent{UserID: userID, ErrorMessage: errorMessage}}})
|
||||
}
|
||||
|
||||
func NewUsedBytesChangedEvent(userID string, usedBytes int) *StreamEvent {
|
||||
func NewUsedBytesChangedEvent(userID string, usedBytes uint64) *StreamEvent {
|
||||
return userEvent(&UserEvent{Event: &UserEvent_UsedBytesChangedEvent{UsedBytesChangedEvent: &UsedBytesChangedEvent{UserID: userID, UsedBytes: int64(usedBytes)}}})
|
||||
}
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ func (m *MockUserUsedSpaceEventHandler) EXPECT() *MockUserUsedSpaceEventHandlerM
|
|||
}
|
||||
|
||||
// HandleUsedSpaceEvent mocks base method.
|
||||
func (m *MockUserUsedSpaceEventHandler) HandleUsedSpaceEvent(arg0 context.Context, arg1 int) error {
|
||||
func (m *MockUserUsedSpaceEventHandler) HandleUsedSpaceEvent(arg0 context.Context, arg1 int64) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "HandleUsedSpaceEvent", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
|
|
@ -84,7 +84,7 @@ func TestServiceHandleEvent_CheckEventCategoriesHandledInOrder(t *testing.T) {
|
|||
require.NoError(t, service.handleEvent(context.Background(), "", proton.Event{Refresh: proton.RefreshMail}))
|
||||
|
||||
// Simulate Regular event.
|
||||
usedSpace := 20
|
||||
usedSpace := int64(20)
|
||||
require.NoError(t, service.handleEvent(context.Background(), "", proton.Event{
|
||||
User: new(proton.User),
|
||||
Addresses: []proton.AddressEvent{
|
||||
|
|
|
@ -98,7 +98,7 @@ type UserEventHandler interface {
|
|||
}
|
||||
|
||||
type UserUsedSpaceEventHandler interface {
|
||||
HandleUsedSpaceEvent(ctx context.Context, newSpace int) error
|
||||
HandleUsedSpaceEvent(ctx context.Context, newSpace int64) error
|
||||
}
|
||||
|
||||
type UserSettingsHandler interface {
|
||||
|
|
|
@ -102,13 +102,13 @@ func (s *Service) CheckAuth(ctx context.Context, email string, password []byte)
|
|||
})
|
||||
}
|
||||
|
||||
func (s *Service) HandleUsedSpaceEvent(ctx context.Context, newSpace int) error {
|
||||
func (s *Service) HandleUsedSpaceEvent(ctx context.Context, newSpace int64) error {
|
||||
s.log.Info("Handling User Space Changed event")
|
||||
|
||||
if s.identity.OnUserSpaceChanged(newSpace) {
|
||||
if s.identity.OnUserSpaceChanged(uint64(newSpace)) {
|
||||
s.eventPublisher.PublishEvent(ctx, events.UsedSpaceChanged{
|
||||
UserID: s.identity.User.ID,
|
||||
UsedSpace: newSpace,
|
||||
UsedSpace: uint64(newSpace),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ func TestService_OnUserSpaceChanged(t *testing.T) {
|
|||
|
||||
// New value, event should be published.
|
||||
require.NoError(t, service.HandleUsedSpaceEvent(context.Background(), 1024))
|
||||
require.Equal(t, 1024, service.identity.User.UsedSpace)
|
||||
require.Equal(t, uint64(1024), service.identity.User.UsedSpace)
|
||||
}
|
||||
|
||||
func TestService_OnRefreshEvent(t *testing.T) {
|
||||
|
|
|
@ -119,7 +119,7 @@ func (s *State) OnRefreshEvent(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *State) OnUserSpaceChanged(value int) bool {
|
||||
func (s *State) OnUserSpaceChanged(value uint64) bool {
|
||||
if s.User.UsedSpace == value {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ func (user *User) BridgePass() []byte {
|
|||
}
|
||||
|
||||
// UsedSpace returns the total space used by the user on the API.
|
||||
func (user *User) UsedSpace() int {
|
||||
func (user *User) UsedSpace() uint64 {
|
||||
ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(time.Minute))
|
||||
defer cancel()
|
||||
|
||||
|
@ -528,7 +528,7 @@ func (user *User) UsedSpace() int {
|
|||
}
|
||||
|
||||
// MaxSpace returns the amount of space the user can use on the API.
|
||||
func (user *User) MaxSpace() int {
|
||||
func (user *User) MaxSpace() uint64 {
|
||||
ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(time.Minute))
|
||||
defer cancel()
|
||||
|
||||
|
|
Loading…
Reference in New Issue