Fix: Prevent re-requesting approval for already approved files#399
Merged
lukasdotcom merged 2 commits intonextcloud:mainfrom Apr 6, 2026
Merged
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
lib/Service/ApprovalService.php
Outdated
| 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.
lib/Service/ApprovalService.php
Outdated
|
|
||
| $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) { |
src/components/Info.vue
Outdated
| }, | ||
| 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 |
Member
|
Hi @Amitdwivedi22, Are you still interested in working on this? |
Contributor
Author
|
Yes by today I will complete it and raise the pr
…On Tue, Mar 31, 2026, 6:14 PM Lukas Schaefer ***@***.***> wrote:
*lukasdotcom* left a comment (nextcloud/approval#399)
<#399?email_source=notifications&email_token=BEHW66D3O6ZM4234XYEFX534TO4SVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJWGIZTQMJWHE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4162381694>
Hi @Amitdwivedi22 <https://github.com/Amitdwivedi22>,
Are you still interested in working on this?
—
Reply to this email directly, view it on GitHub
<#399?email_source=notifications&email_token=BEHW66D3O6ZM4234XYEFX534TO4SVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJWGIZTQMJWHE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4162381694>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BEHW66AKFKJOBBBTGY3TBVD4TO4SVAVCNFSM6AAAAACWVPV75KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCNRSGM4DCNRZGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
0a0368e to
d4255a6
Compare
lukasdotcom
approved these changes
Apr 6, 2026
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