mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
GODT-2312: used space is properly updated.
This commit is contained in:
@ -66,6 +66,10 @@ func (user *User) handleAPIEvent(ctx context.Context, event proton.Event) error
|
||||
}
|
||||
}
|
||||
|
||||
if event.UsedSpace != nil {
|
||||
user.handleUsedSpaceChange(*event.UsedSpace)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -655,6 +659,20 @@ func (user *User) handleUpdateDraftEvent(ctx context.Context, event proton.Messa
|
||||
}, user.apiUserLock, user.apiAddrsLock, user.apiLabelsLock, user.updateChLock)
|
||||
}
|
||||
|
||||
func (user *User) handleUsedSpaceChange(usedSpace int) {
|
||||
safe.Lock(func() {
|
||||
if user.apiUser.UsedSpace == usedSpace {
|
||||
return
|
||||
}
|
||||
|
||||
user.apiUser.UsedSpace = usedSpace
|
||||
user.eventCh.Enqueue(events.UsedSpaceChanged{
|
||||
UserID: user.apiUser.ID,
|
||||
UsedSpace: usedSpace,
|
||||
})
|
||||
}, user.apiUserLock)
|
||||
}
|
||||
|
||||
func getMailboxName(label proton.Label) []string {
|
||||
var name []string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user