Fix gestione invio email tramite OAuth2

This commit is contained in:
Dasc3er 2021-08-05 12:31:47 +02:00
parent 0b140f93ce
commit 06eb5f916a
2 changed files with 6 additions and 5 deletions

View File

@ -67,7 +67,7 @@ class EmailHook extends Manager
// Selezione email per account // Selezione email per account
$accounts = Account::all(); $accounts = Account::all();
$lista = []; $lista = collect();
foreach ($accounts as $account) { foreach ($accounts as $account) {
// Ultima email inviata per l'account // Ultima email inviata per l'account
$last_mail = $account->emails() $last_mail = $account->emails()
@ -90,9 +90,7 @@ class EmailHook extends Manager
->take($numero_email) ->take($numero_email)
->get(); ->get();
if (!empty($lista_account)) { $lista = $lista->concat($lista_account);
$lista = array_merge($lista, $lista_account);
}
} }
} }

View File

@ -170,7 +170,10 @@ class OAuth2
public function updateTokens($access_token, $refresh_token) public function updateTokens($access_token, $refresh_token)
{ {
$this->account->access_token = serialize($access_token); $this->account->access_token = serialize($access_token);
$this->account->refresh_token = $refresh_token;
$previous_refresh_token = $this->account->refresh_token;
$this->account->refresh_token = $refresh_token ?: $previous_refresh_token;
$this->account->save(); $this->account->save();
} }