Fix: Prevent re-requesting approval for already approved files#399
Open
Amitdwivedi22 wants to merge 1 commit intonextcloud:mainfrom
Open
Fix: Prevent re-requesting approval for already approved files#399Amitdwivedi22 wants to merge 1 commit intonextcloud:mainfrom
Amitdwivedi22 wants to merge 1 commit intonextcloud:mainfrom
Conversation
lukasdotcom
reviewed
Mar 18, 2026
Member
There was a problem hiding this comment.
Hi @Amitdwivedi22,
Thanks for the contribution. Could you sign your commits? There are instructions at https://github.com/nextcloud/approval/pull/399/checks?check_run_id=67481178296
| public function request(int $fileId, int $ruleId, ?string $userId, bool $createShares): array { | ||
| public function request(int $fileId, int $ruleId, ?string $userId, bool $createShares) { | ||
|
|
||
| $state = $this->getApprovalState($fileId, $userId); |
Member
There was a problem hiding this comment.
This check is done before ensuring that the user has access to the file which could leak information.
|
|
||
| $state = $this->getApprovalState($fileId, $userId); | ||
|
|
||
| if ($state['state'] === \OCA\Approval\AppInfo\Application::STATE_APPROVED) { |
Member
There was a problem hiding this comment.
Suggested change
| if ($state['state'] === \OCA\Approval\AppInfo\Application::STATE_APPROVED) { | |
| if ($state['state'] === Application::STATE_APPROVED) { |
| }, | ||
| canRequestApproval() { | ||
| return this.userRules.length > 0 | ||
| return this.userRules.length > 0 && this.state !== states.APPROVED |
Member
There was a problem hiding this comment.
This isn't necessary as it only matters that you can't re-request approval for the same workflow. Some users may have two approval flows they want on the same file.
Member
|
For fixing the php-cs workflow you can run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Prevent re-requesting approval for already approved files
Closes #398