mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-17 18:05:42 +02:00
* fix(github): honour the force flag in checkRefreshToken `checkRefreshToken` accepts a `force` parameter but never reads it, so the only caller that passes `force = true` (worker.ts, when re-syncing a user) behaves exactly like the non-forced call and skips the refresh entirely. Gate the refresh on `force || expired` instead of on expiry alone. As a side effect a record with a `refreshToken` but a null `expiresIn` is now validated when forced, instead of being reported as valid unchecked. Signed-off-by: koreanjoker <namug014@gmail.com> * fix(github): return undefined from getOctokit when the token is dead When `checkRefreshToken` reports failure, `getOctokit` cleared `record.octokit` and then fell straight through to constructing a new Octokit from the very token that was just rejected. The method therefore never returned `undefined` for a revoked user, so the `(await getOctokit(...)) ?? container.container.octokit` installation-token fallback that the sync code already writes at 13 call sites was unreachable. Return `undefined` after clearing the client so the existing fallback can take effect. Signed-off-by: koreanjoker <namug014@gmail.com> * fix(github): preserve accounts when deserialising a user secret `updateUser` serialises the whole `GithubUserRecord` — `accounts` included — into the integration secret, but `secretToUserRecord` placed a literal `accounts: {}` after the spread of the parsed payload, discarding whatever was stored. Every consumer of a record loaded through `getAccount` therefore saw an empty map. `revokeUserAuth` iterates `Object.entries(record.accounts)`, so its body never ran and the re-authorisation notice was never written to any workspace. Read `accounts` back from the parsed payload, keeping `{}` as the fallback for records written before the field existed. Signed-off-by: koreanjoker <namug014@gmail.com> --------- Signed-off-by: koreanjoker <namug014@gmail.com>