Skip to content

Commit

Permalink
Merge branch 'master' into merge_modes
Browse files Browse the repository at this point in the history
  • Loading branch information
nagmat84 committed Oct 23, 2022
2 parents 368ee0e + b4cbfc4 commit 7c92d41
Show file tree
Hide file tree
Showing 27 changed files with 157 additions and 4,326 deletions.
7 changes: 6 additions & 1 deletion app/Http/Controllers/PhotoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,14 @@ public function setPublic(SetPhotoPublicRequest $request): void
public function setTags(SetPhotosTagsRequest $request): void
{
$tags = $request->tags();

/** @var Photo $photo */
foreach ($request->photos() as $photo) {
$photo->tags = $tags;
if ($request->shallOverride) {
$photo->tags = $tags;
} else {
$photo->tags = array_unique(array_merge($photo->tags, $tags));
}
$photo->save();
}
}
Expand Down
6 changes: 6 additions & 0 deletions app/Http/Requests/Photo/SetPhotosTagsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ class SetPhotosTagsRequest extends BaseApiRequest implements HasPhotos, HasTags
use HasTagsTrait;
use AuthorizeCanEditPhotosTrait;

public const SHALL_OVERRIDE_ATTRIBUTE = 'shall_override';

public bool $shallOverride;

/**
* {@inheritDoc}
*/
public function rules(): array
{
return [
self::SHALL_OVERRIDE_ATTRIBUTE => 'required|boolean',
HasPhotos::PHOTO_IDS_ATTRIBUTE => 'required|array|min:1',
HasPhotos::PHOTO_IDS_ATTRIBUTE . '.*' => ['required', new RandomIDRule(false)],
HasTags::TAGS_ATTRIBUTE => 'present|array',
Expand All @@ -37,5 +42,6 @@ protected function processValidatedValues(array $values, array $files): void
{
$this->photos = Photo::query()->findOrFail($values[HasPhotos::PHOTO_IDS_ATTRIBUTE]);
$this->tags = $values[HasTags::TAGS_ATTRIBUTE];
$this->shallOverride = $values[self::SHALL_OVERRIDE_ATTRIBUTE];
}
}
2 changes: 2 additions & 0 deletions app/Locale/ChineseSimplified.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => '搜索功能已在设置中停用。',
'SUCCESS' => 'OK',
'RETRY' => '重试',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => '登录信息已更新.',
'SETTINGS_SUCCESS_SORT' => '排序顺序已更新。',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/ChineseTraditional.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => '搜索功能已在設為停用。',
'SUCCESS' => '',
'RETRY' => '重試',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => '登錄信息已更新',
'SETTINGS_SUCCESS_SORT' => '排序順序已更新。',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Czech.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Funkce hledání byla v nastavení deaktivována.',
'SUCCESS' => 'OK',
'RETRY' => 'Opakovat',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Přihlašovací údaje byly aktualizovány.',
'SETTINGS_SUCCESS_SORT' => 'Stav řazení byl aktulizován.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Dutch.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Search functionality has been deactivated under settings.',
'SUCCESS' => 'OK',
'RETRY' => 'Probeer opnieuw',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Login Info updated.',
'SETTINGS_SUCCESS_SORT' => 'Sorting order updated.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/English.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Search functionality has been deactivated under settings.',
'SUCCESS' => 'OK',
'RETRY' => 'Retry',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Login Info updated.',
'SETTINGS_SUCCESS_SORT' => 'Sorting order updated.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/French.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'La recherche a été désactivée dans les paramètres.',
'SUCCESS' => 'OK',
'RETRY' => 'Réessayer',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Informations de connexions mise à jour.',
'SETTINGS_SUCCESS_SORT' => 'Ordre d’affichage mis à jour.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/German.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Suchfunktion wurde unter Einstellungen deaktiviert.',
'SUCCESS' => 'OK',
'RETRY' => 'Noch einmal versuchen',
'OVERRIDE' => 'Überschreiben',
'TAGS_OVERRIDE_INFO' => 'Wenn das nicht aktiviert ist, werden die Tags zu den vorhandenen Tags des Fotos hinzugefügt.',

'SETTINGS_SUCCESS_LOGIN' => 'Benutzerdaten aktualisiert',
'SETTINGS_SUCCESS_SORT' => 'Sortierreihenfolge aktualisiert',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Greek.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Search functionality has been deactivated under settings.',
'SUCCESS' => 'OK',
'RETRY' => 'Προσπάθεια ξανά',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Τα στοιχεία εισόδου ενημερώθηκαν.',
'SETTINGS_SUCCESS_SORT' => 'Η Ταξινόμηση ενημερώθηκε.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Italian.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Search functionality has been deactivated under settings.',
'SUCCESS' => 'OK',
'RETRY' => 'Riprova',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Informazioni di Login Aggiornate.',
'SETTINGS_SUCCESS_SORT' => 'Modalità di ordinamento aggiornate.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/NorwegianBokmal.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Søkefunksjoner har blitt deaktivert under innstillinger',
'SUCCESS' => 'OK',
'RETRY' => 'Prøv igjen',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Innlogging oppdatert.',
'SETTINGS_SUCCESS_SORT' => 'Sorteringsrekkefølge oppdatert.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Polish.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Funkcja wyszkukiwania została wyłączona w ustawieniach.',
'SUCCESS' => 'OK',
'RETRY' => 'Ponów',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Zaktualizowano informacje o loginie.',
'SETTINGS_SUCCESS_SORT' => 'Zaktualizowano kolejność sortowania.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Portuguese.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'A funcionalidade de procura foi desativada nas configurações.',
'SUCCESS' => 'OK',
'RETRY' => 'Tentar de novo',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Informação de Login atualizada.',
'SETTINGS_SUCCESS_SORT' => 'Ordenação atualizada.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Russian.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Search functionality has been deactivated under settings.',
'SUCCESS' => 'Ок',
'RETRY' => 'Повторить',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Учётные данные обновлены.',
'SETTINGS_SUCCESS_SORT' => 'Порядок сортировки обновлён.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Slovak.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Search functionality has been deactivated under settings.',
'SUCCESS' => 'OK',
'RETRY' => 'Opakovať',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Užívateľské dáta aktualizované',
'SETTINGS_SUCCESS_SORT' => 'Triedenie aktualizované',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Spanish.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'La función de búsqueda se ha desactivado en la configuración.',
'SUCCESS' => 'Vale',
'RETRY' => 'Procesar de nuevo',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Información de inicio de sesión actualizada',
'SETTINGS_SUCCESS_SORT' => 'Orden de clasificación actualizado',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Swedish.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Search functionality has been deactivated under settings.',
'SUCCESS' => 'OK',
'RETRY' => 'Försök igen',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Login Info updated.',
'SETTINGS_SUCCESS_SORT' => 'Sorting order updated.',
Expand Down
2 changes: 2 additions & 0 deletions app/Locale/Vietnamese.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ public function get_locale(): array
'ERROR_SEARCH_DEACTIVATED' => 'Tính năng tìm kiếm đã tắt trong phần cài đặt',
'SUCCESS' => 'OK',
'RETRY' => 'Thử lại',
'OVERRIDE' => 'Override',
'TAGS_OVERRIDE_INFO' => 'If this is unchecked, the tags will be added to the existing tags of the photo.',

'SETTINGS_SUCCESS_LOGIN' => 'Thông tin đăng nhập đã được cập nhật.',
'SETTINGS_SUCCESS_SORT' => 'Thứ tự sắp xếp đã được cập nhật.',
Expand Down
2 changes: 1 addition & 1 deletion public/dist/frontend.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/dist/frontend.html
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,5 @@
</div>

<script async defer type="text/javascript" src="dist/frontend.js"></script>
<script async defer type="text/javascript" src="dist/Larapass.js"></script>
</body>
</html>
443 changes: 104 additions & 339 deletions public/dist/frontend.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/dist/main.css

This file was deleted.

3,981 changes: 0 additions & 3,981 deletions public/dist/view.js

This file was deleted.

3 changes: 3 additions & 0 deletions tests/Feature/Lib/PhotosUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,21 @@ public function set_star(
*
* @param string[] $ids
* @param string[] $tags
* @param bool $override
* @param int $expectedStatusCode
* @param string|null $assertSee
*/
public function set_tag(
array $ids,
array $tags,
bool $override = true,
int $expectedStatusCode = 204,
?string $assertSee = null
): void {
$response = $this->testCase->postJson('/api/Photo::setTags', [
'photoIDs' => $ids,
'tags' => $tags,
'shall_override' => $override,
]);
$response->assertStatus($expectedStatusCode);
if ($assertSee) {
Expand Down
3 changes: 2 additions & 1 deletion tests/Feature/PhotosOperationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function testManyFunctionsAtOnce(): void
$this->photos_tests->set_description($id, 'A night photography');
$this->photos_tests->set_star([$id], true);
$this->photos_tests->set_tag([$id], ['night']);
$this->photos_tests->set_tag([$id], ['trees'], false);
$this->photos_tests->set_public($id, true);
$this->photos_tests->set_license($id, 'WTFPL', 422, 'license must be one out of');
$this->photos_tests->set_license($id, 'CC0');
Expand Down Expand Up @@ -141,7 +142,7 @@ public function testManyFunctionsAtOnce(): void
'license' => 'reserved',
'is_public' => 1,
'is_starred' => true,
'tags' => ['night'],
'tags' => ['night', 'trees'],
]);

/**
Expand Down

0 comments on commit 7c92d41

Please sign in to comment.