Remove unneeded cardId parameters

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-07-11 11:58:53 +02:00
parent cd0b3b29f1
commit 6114c28b10
8 changed files with 46 additions and 88 deletions

View File

@@ -213,7 +213,6 @@ class AttachmentService {
/**
* Display the attachment
*
* @param $cardId
* @param $attachmentId
* @return Response
* @throws BadRequestException
@@ -222,11 +221,7 @@ class AttachmentService {
* @throws \OCP\AppFramework\Db\DoesNotExistException
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
*/
public function display($cardId, $attachmentId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
public function display($attachmentId) {
if (is_numeric($attachmentId) === false) {
throw new BadRequestException('attachment id must be a number');
}
@@ -249,7 +244,6 @@ class AttachmentService {
/**
* Update an attachment with custom data
*
* @param $cardId
* @param $attachmentId
* @param $request
* @return mixed
@@ -258,11 +252,7 @@ class AttachmentService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
* @throws BadRequestException
*/
public function update($cardId, $attachmentId, $data) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
public function update($attachmentId, $data) {
if (is_numeric($attachmentId) === false) {
throw new BadRequestException('attachment id must be a number');
}
@@ -277,7 +267,7 @@ class AttachmentService {
}
$this->permissionService->checkPermission($this->cardMapper, $attachment->getCardId(), Acl::PERMISSION_EDIT);
$this->cache->clear('card-' . $cardId);
$this->cache->clear('card-' . $attachment->getCardId());
$attachment->setData($data);
try {
@@ -304,7 +294,6 @@ class AttachmentService {
* Either mark an attachment as deleted for later removal or just remove it depending
* on the IAttachmentService implementation
*
* @param $cardId
* @param $attachmentId
* @return \OCP\AppFramework\Db\Entity
* @throws \OCA\Deck\NoPermissionException
@@ -312,11 +301,7 @@ class AttachmentService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
* @throws BadRequestException
*/
public function delete($cardId, $attachmentId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
public function delete($attachmentId) {
if (is_numeric($attachmentId) === false) {
throw new BadRequestException('attachment id must be a number');
}
@@ -328,7 +313,7 @@ class AttachmentService {
}
$this->permissionService->checkPermission($this->cardMapper, $attachment->getCardId(), Acl::PERMISSION_EDIT);
$this->cache->clear('card-' . $cardId);
$this->cache->clear('card-' . $attachment->getCardId());
try {
$service = $this->getService($attachment->getType());
@@ -347,11 +332,7 @@ class AttachmentService {
return $attachment;
}
public function restore($cardId, $attachmentId) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
public function restore($attachmentId) {
if (is_numeric($attachmentId) === false) {
throw new BadRequestException('attachment id must be a number');
}
@@ -363,7 +344,7 @@ class AttachmentService {
}
$this->permissionService->checkPermission($this->cardMapper, $attachment->getCardId(), Acl::PERMISSION_EDIT);
$this->cache->clear('card-' . $cardId);
$this->cache->clear('card-' . $attachment->getCardId());
try {
$service = $this->getService($attachment->getType());