Switch static::$parameters to $this->parameters

This commit is contained in:
Philipp 2021-11-14 23:19:25 +01:00
parent 489cd0884a
commit 5879535822
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
116 changed files with 321 additions and 314 deletions

View file

@ -65,18 +65,18 @@ class Media extends BaseApi
'focus' => '', // Two floating points (x,y), comma-delimited ranging from -1.0 to 1.0
]);
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$photo = Photo::selectFirst(['resource-id'], ['id' => static::$parameters['id'], 'uid' => $uid]);
$photo = Photo::selectFirst(['resource-id'], ['id' => $this->parameters['id'], 'uid' => $uid]);
if (empty($photo['resource-id'])) {
DI::mstdnError()->RecordNotFound();
}
Photo::update(['desc' => $request['description']], ['resource-id' => $photo['resource-id']]);
System::jsonExit(DI::mstdnAttachment()->createFromPhoto(static::$parameters['id']));
System::jsonExit(DI::mstdnAttachment()->createFromPhoto($this->parameters['id']));
}
/**
@ -87,11 +87,11 @@ class Media extends BaseApi
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$id = static::$parameters['id'];
$id = $this->parameters['id'];
if (!Photo::exists(['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound();
}