Browse Source
Don't allow to close polls twice
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/7805/head
Joas Schilling
3 years ago
No known key found for this signature in database
GPG Key ID: 74434EFE0D2E2205
3 changed files with
6 additions and
0 deletions
-
docs/poll.md
-
lib/Controller/PollController.php
-
tests/integration/features/chat/poll.feature
|
|
|
@ -77,6 +77,7 @@ Base endpoint is: `/ocs/v2.php/apps/spreed/api/v1` |
|
|
|
* Response: |
|
|
|
- Status code: |
|
|
|
+ `200 OK` |
|
|
|
+ `400 Bad Request` When the poll is already closed |
|
|
|
+ `403 Forbidden` When the participant is not the author of the poll or a moderator |
|
|
|
+ `404 Not Found` When the conversation could not be found for the participant |
|
|
|
+ `404 Not Found` When the poll id could not be found in the conversation |
|
|
|
|
|
|
|
@ -202,6 +202,10 @@ class PollController extends AEnvironmentAwareController { |
|
|
|
return new DataResponse([], Http::STATUS_NOT_FOUND); |
|
|
|
} |
|
|
|
|
|
|
|
if ($poll->getStatus() === Poll::STATUS_CLOSED) { |
|
|
|
return new DataResponse([], Http::STATUS_BAD_REQUEST); |
|
|
|
} |
|
|
|
|
|
|
|
$poll->setStatus(Poll::STATUS_CLOSED); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
@ -382,6 +382,7 @@ Feature: chat/poll |
|
|
|
| actorDisplayName | participant1-displayname | |
|
|
|
| status | closed | |
|
|
|
| votedSelf | [0] | |
|
|
|
Then user "participant1" closes poll "What is the question?" in room "room" with 400 |
|
|
|
Then user "participant1" sees the following system messages in room "room" with 200 (v1) |
|
|
|
| room | actorType | actorId | actorDisplayName | systemMessage | |
|
|
|
| room | users | participant1 | participant1-displayname | poll_closed | |
|
|
|
|