mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Check if resource exists and is connected before adding comment
This commit is contained in:
@@ -123,7 +123,11 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
|
||||
|
||||
$latestCommentId = '';
|
||||
|
||||
if (!empty($providerPullRequestId) && $resource->getAttribute('providerSilentMode', false) === false) {
|
||||
// Check if VCS is still connected and resource exists before creating/updating comments
|
||||
$resourceExists = !$resource->isEmpty();
|
||||
$isVcsConnected = !empty($resource->getAttribute('providerRepositoryId', ''));
|
||||
|
||||
if ($resourceExists && $isVcsConnected && !empty($providerPullRequestId) && $resource->getAttribute('providerSilentMode', false) === false) {
|
||||
$latestComment = Authorization::skip(fn () => $dbForPlatform->findOne('vcsComments', [
|
||||
Query::equal('providerRepositoryId', [$providerRepositoryId]),
|
||||
Query::equal('providerPullRequestId', [$providerPullRequestId]),
|
||||
@@ -166,7 +170,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
|
||||
])));
|
||||
}
|
||||
}
|
||||
} elseif (!empty($providerBranch)) {
|
||||
} elseif ($resourceExists && $isVcsConnected && !empty($providerBranch)) {
|
||||
$latestComments = Authorization::skip(fn () => $dbForPlatform->find('vcsComments', [
|
||||
Query::equal('providerRepositoryId', [$providerRepositoryId]),
|
||||
Query::equal('providerBranch', [$providerBranch]),
|
||||
|
||||
Reference in New Issue
Block a user