🐛 fix(gmail): use GMAIL_DELETE_SCOPE for batch delete
- use GMAIL_DELETE_SCOPE instead of GMAIL_MODIFY_SCOPE for batch delete operation - GMAIL_DELETE_SCOPE is required for batch delete to work
This commit is contained in:
committed by
Jeremiah Russell
parent
4d3b554309
commit
83a5c45cb5
@@ -64,6 +64,13 @@ const TRASH_LABEL: &str = "TRASH";
|
|||||||
/// modification operations. Preferred over broader scopes for security.
|
/// modification operations. Preferred over broader scopes for security.
|
||||||
const GMAIL_MODIFY_SCOPE: &str = "https://www.googleapis.com/auth/gmail.modify";
|
const GMAIL_MODIFY_SCOPE: &str = "https://www.googleapis.com/auth/gmail.modify";
|
||||||
|
|
||||||
|
/// Gmail API scope for deleting messages.
|
||||||
|
///
|
||||||
|
/// This scope allows all operations and is required to authorise the batch
|
||||||
|
/// delete operation. It is only used for batch delete. For all other
|
||||||
|
/// operations `GMAIL_MODIFY_SCOPE` is preferred.
|
||||||
|
const GMAIL_DELETE_SCOPE: &str = "https://mail.google.com/";
|
||||||
|
|
||||||
/// Internal trait defining the minimal operations needed for rule processing.
|
/// Internal trait defining the minimal operations needed for rule processing.
|
||||||
///
|
///
|
||||||
/// This trait is used internally to enable unit testing of orchestration logic
|
/// This trait is used internally to enable unit testing of orchestration logic
|
||||||
@@ -424,7 +431,7 @@ impl RuleProcessor for GmailClient {
|
|||||||
.hub()
|
.hub()
|
||||||
.users()
|
.users()
|
||||||
.messages_batch_delete(batch_request, "me")
|
.messages_batch_delete(batch_request, "me")
|
||||||
.add_scope(GMAIL_MODIFY_SCOPE)
|
.add_scope(GMAIL_DELETE_SCOPE)
|
||||||
.doit()
|
.doit()
|
||||||
.await
|
.await
|
||||||
.map_err(Box::new);
|
.map_err(Box::new);
|
||||||
|
|||||||
Reference in New Issue
Block a user