Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use absolute icon url (fix #280) #281

Merged
merged 2 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: cd ${{ env.APP_NAME }} && make appstore

- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}.tar.gz
path: ${{ env.APP_NAME }}/build/artifacts/appstore/${{ env.APP_NAME }}.tar.gz
392 changes: 220 additions & 172 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/BackgroundJobs/ProcessFileJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function run($argument) : void {
$this->ocrService->runOcrProcess($fileId, $uid, $settings);
} catch (\Throwable $ex) {
$this->logger->error($ex->getMessage(), ['exception' => $ex]);
$this->notificationService->createErrorNotification($uid, 'An error occured while executing the OCR process ('.$ex->getMessage().'). Please have a look at your servers logfile for more details.');
$this->notificationService->createErrorNotification($uid, 'An error occured while executing the OCR process (' . $ex->getMessage() . '). Please have a look at your servers logfile for more details.');
}

$this->logger->debug('ENDED -- Run ' . self::class . ' job. Argument: {argument}.', ['argument' => $argument]);
Expand Down
2 changes: 1 addition & 1 deletion lib/Listener/RegisterFlowOperationsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public function handle(Event $event): void {
$event->registerOperation($this->container->get(Operation::class));

// Register webpack bundled script 'js/workflow_ocr-main.js'
Util::addScript(Application::APP_NAME, Application::APP_NAME. '-main');
Util::addScript(Application::APP_NAME, Application::APP_NAME . '-main');
}
}
2 changes: 1 addition & 1 deletion lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function prepare(INotification $notification, string $languageCode): INot
$message = $notification->getSubjectParameters()['message'];
$notification
->setParsedMessage($message)
->setIcon($this->urlGenerator->imagePath(Application::APP_NAME, 'app-dark.svg'));
->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath(Application::APP_NAME, 'app-dark.svg')));

return $notification;
}
Expand Down
1 change: 1 addition & 0 deletions tests/Integration/AppTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright Copyright (c) 2020 Robin Windey <ro.windey@gmail.com>
*
Expand Down
1 change: 1 addition & 0 deletions tests/Integration/Notification/AppFake.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright Copyright (c) 2023 Robin Windey <ro.windey@gmail.com>
*
Expand Down
1 change: 1 addition & 0 deletions tests/Integration/Notification/NotificationTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright Copyright (c) 2023 Robin Windey <ro.windey@gmail.com>
*
Expand Down
1 change: 1 addition & 0 deletions tests/TestUtils.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Nextcloud - Files_PhotoSpheres
*
Expand Down
16 changes: 16 additions & 0 deletions tests/Unit/Notification/NotifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ public function testPrepareConstructsOcrErrorCorrectlyWithFileId() {
$this->urlGenerator->expects($this->once())
->method('imagePath')
->with('workflow_ocr', 'app-dark.svg')
->willReturn('apps/workflow_ocr/app-dark.svg');
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with('apps/workflow_ocr/app-dark.svg')
->willReturn('http://localhost/index.php/apps/workflow_ocr/app-dark.svg');
$this->urlGenerator->expects($this->once())
->method('linkToRouteAbsolute')
Expand Down Expand Up @@ -204,6 +208,10 @@ public function testPrepareConstructsOcrErrorCorrectlyWithoutFile() {
$this->urlGenerator->expects($this->once())
->method('imagePath')
->with('workflow_ocr', 'app-dark.svg')
->willReturn('apps/workflow_ocr/app-dark.svg');
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with('apps/workflow_ocr/app-dark.svg')
->willReturn('http://localhost/index.php/apps/workflow_ocr/app-dark.svg');
$this->urlGenerator->expects($this->never())
->method('linkToRouteAbsolute');
Expand Down Expand Up @@ -251,6 +259,10 @@ public function testSendsFallbackNotificationWithoutFileInfoIfFileNotFoundWasThr
$this->urlGenerator->expects($this->once())
->method('imagePath')
->with('workflow_ocr', 'app-dark.svg')
->willReturn('apps/workflow_ocr/app-dark.svg');
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with('apps/workflow_ocr/app-dark.svg')
->willReturn('http://localhost/index.php/apps/workflow_ocr/app-dark.svg');
$this->logger->expects($this->once())
->method('error')
Expand Down Expand Up @@ -297,6 +309,10 @@ public function testSendsFallbackNotificationWithoutFileInfoIfReturnedFileArrayW
$this->urlGenerator->expects($this->once())
->method('imagePath')
->with('workflow_ocr', 'app-dark.svg')
->willReturn('apps/workflow_ocr/app-dark.svg');
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with('apps/workflow_ocr/app-dark.svg')
->willReturn('http://localhost/index.php/apps/workflow_ocr/app-dark.svg');
$this->logger->expects($this->once())
->method('warning')
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/OcrProcessors/PdfOcrProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public function testRemoveBackgroundIsNotAppliedIfOcrModeIsRedoOcr() {
}));

$processor = new PdfOcrProcessor($this->command, $this->logger, $this->sidecarFileAccessor);
$processor->ocrFile($this->fileBefore, new WorkflowSettings('{"ocrMode": ' . WorkflowSettings::OCR_MODE_REDO_OCR .', "removeBackground": true}'), $this->defaultGlobalSettings);
$processor->ocrFile($this->fileBefore, new WorkflowSettings('{"ocrMode": ' . WorkflowSettings::OCR_MODE_REDO_OCR . ', "removeBackground": true}'), $this->defaultGlobalSettings);
}

public function dataProvider_testAppliesOcrModeParameter() {
Expand Down
Loading