mirror of
https://github.com/shlinkio/shlink.git
synced 2026-08-11 13:34:52 -05:00
Deprecated action and endpoint to edit short URL tags
This commit is contained in:
@@ -8,11 +8,14 @@ use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Shlinkio\Shlink\Core\Exception\ValidationException;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlEdit;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
||||
use Shlinkio\Shlink\Core\Validation\ShortUrlInputFilter;
|
||||
use Shlinkio\Shlink\Rest\Action\AbstractRestAction;
|
||||
use Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware;
|
||||
|
||||
/** @deprecated */
|
||||
class EditShortUrlTagsAction extends AbstractRestAction
|
||||
{
|
||||
protected const ROUTE_PATH = '/short-urls/{shortCode}/tags';
|
||||
@@ -38,7 +41,9 @@ class EditShortUrlTagsAction extends AbstractRestAction
|
||||
$identifier = ShortUrlIdentifier::fromApiRequest($request);
|
||||
$apiKey = AuthenticationMiddleware::apiKeyFromRequest($request);
|
||||
|
||||
$shortUrl = $this->shortUrlService->setTagsByShortCode($identifier, $tags, $apiKey);
|
||||
$shortUrl = $this->shortUrlService->updateShortUrl($identifier, ShortUrlEdit::fromRawData([
|
||||
ShortUrlInputFilter::TAGS => $tags,
|
||||
]), $apiKey);
|
||||
return new JsonResponse(['tags' => $shortUrl->getTags()->toArray()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ use Prophecy\Prophecy\ObjectProphecy;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\Exception\ValidationException;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlEdit;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
||||
use Shlinkio\Shlink\Rest\Action\ShortUrl\EditShortUrlTagsAction;
|
||||
@@ -41,9 +42,9 @@ class EditShortUrlTagsActionTest extends TestCase
|
||||
public function tagsListIsReturnedIfCorrectShortCodeIsProvided(): void
|
||||
{
|
||||
$shortCode = 'abc123';
|
||||
$this->shortUrlService->setTagsByShortCode(
|
||||
$this->shortUrlService->updateShortUrl(
|
||||
new ShortUrlIdentifier($shortCode),
|
||||
[],
|
||||
Argument::type(ShortUrlEdit::class),
|
||||
Argument::type(ApiKey::class),
|
||||
)->willReturn(ShortUrl::createEmpty())
|
||||
->shouldBeCalledOnce();
|
||||
|
||||
Reference in New Issue
Block a user