mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-19 14:17:20 +02:00
fix: save renamed source together with reconnected access
This commit is contained in:
1 parent
e6073941b9
commit
ccccf07491
3 files changed
+20
-2
No files matched your search
@@ -208,7 +208,10 @@ router.post("/connections/migrate", async (req, res) => {
|
||||
if (preview === true) return res.json({ eligible: true, connection });
|
||||
const filter = { _id: model._id, owner: user.id, status: model.status, source: model.source,
|
||||
githubAccess: model.githubAccess ? model.githubAccess : { $exists: false } };
|
||||
const change = { $set: { githubAccess: selected.binding } };
|
||||
const change = { $set: { githubAccess: selected.binding,
|
||||
...(selected.fullName && selected.fullName !== name
|
||||
? { [isRepo ? "source.repositoryName" : "source.repositoryFullName"]: selected.fullName } : {}),
|
||||
} };
|
||||
const result = isRepo ? await RepositoryModel.updateOne(filter, change) : await PullRequestModel.updateOne(filter, change);
|
||||
if (!result.modifiedCount) throw appError("connection_changed", 409);
|
||||
res.json({ connection });
|
||||
|
||||
Reference in new issue
Block a user