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

Can't edit Admin Settings for News App #2293

Open
3 tasks done
joezimjs opened this issue Jul 22, 2023 · 3 comments
Open
3 tasks done

Can't edit Admin Settings for News App #2293

joezimjs opened this issue Jul 22, 2023 · 3 comments
Labels
bug frontend impact Javascript/Frontend code

Comments

@joezimjs
Copy link

joezimjs commented Jul 22, 2023

IMPORTANT

Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)

  • I have read the CONTRIBUTING.md and followed the provided tips
  • I accept that the issue will be closed without comment if I do not check here
  • I accept that the issue will be closed without comment if I do not fill out all items in the issue template.

Explain the Problem

When I try to go to the settings page for News (/settings/admin/news) I get an error and this is what shows up in the log at /settings/admin/logging:

Contents of Error Log
**Exception**: OCP\BackgroundJob\TimedJob::setInterval(): Argument #1 ($seconds) must be of type int, string given, called in /var/www/html/custom_apps/news/lib/Cron/UpdaterJob.php on line 55 in file '/var/www/html/lib/public/BackgroundJob/TimedJob.php' line 49

- /var/www/html/lib/private/AppFramework/App.php - line 183:OC\AppFramework\Http\Dispatcher->dispatch([ "OCA\\Sett ... "], "index")
- /var/www/html/lib/private/Route/Router.php - line 315:OC\AppFramework\App::main("OCA\\Settin ... r", "index", [ "OC\\AppFr ... "], [ "news","se ... "])
- /var/www/html/lib/base.php - line 1060:OC\Route\Router->match("/settings/admin/news")
- /var/www/html/index.php - line 36:OC::handleRequest()

**Caused by TypeError**: OCP\BackgroundJob\TimedJob::setInterval(): Argument #1 ($seconds) must be of type int, string given, called in /var/www/html/custom_apps/news/lib/Cron/UpdaterJob.php on line 55

- /var/www/html/custom_apps/news/lib/Cron/UpdaterJob.php - line 55:OCP\BackgroundJob\TimedJob->setInterval("")
- <<closure>>OCA\News\Cron\UpdaterJob->__construct([ "OC\\AppFr ... "], [ "OC\\AllConfig"], [ "OCA\\News ... "], [ "OCA\\News ... "])
- /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php - line 116:ReflectionClass->newInstanceArgs([ [ "OC\\App ... ]])
- /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php - line 124:OC\AppFramework\Utility\SimpleContainer->buildClass([ "Reflectio ... "])
- /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php - line 142:OC\AppFramework\Utility\SimpleContainer->resolve("OCA\\News\\Cron\\UpdaterJob")
- /var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 493:OC\AppFramework\Utility\SimpleContainer->query("OCA\\News\\Cron\\UpdaterJob")
- /var/www/html/lib/private/ServerContainer.php - line 155:OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback("OCA\\News\\Cron\\UpdaterJob")
- /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php - line 65:OC\ServerContainer->query("OCA\\News\\Cron\\UpdaterJob")
- /var/www/html/lib/public/Server.php - line 55:OC\AppFramework\Utility\SimpleContainer->get("OCA\\News\\Cron\\UpdaterJob")
- /var/www/html/lib/private/BackgroundJob/JobList.php - line 300:OCP\Server::get("OCA\\News\\Cron\\UpdaterJob")
- /var/www/html/lib/private/BackgroundJob/JobList.php - line 192:OC\BackgroundJob\JobList->buildJob([ 11371,"OCA ... "])
- <<closure>>OC\BackgroundJob\JobList->getJobsIterator("OCA\\News\\Cron\\UpdaterJob", 1, 0)
- /var/www/html/custom_apps/news/lib/Service/StatusService.php - line 99:Generator->current()
- /var/www/html/custom_apps/news/lib/Settings/AdminSettings.php - line 42:OCA\News\Service\StatusService->getUpdateTime()
- /var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php - line 129:OCA\News\Settings\AdminSettings->getForm()
- /var/www/html/apps/settings/lib/Controller/AdminSettingsController.php - line 83:OCA\Settings\Controller\AdminSettingsController->formatSettings([ [ [ "OCA\\ ... ]])
- /var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php - line 149:OCA\Settings\Controller\AdminSettingsController->getSettings("news")
- /var/www/html/apps/settings/lib/Controller/AdminSettingsController.php - line 68:OCA\Settings\Controller\AdminSettingsController->getIndexResponse("admin", "news")
- /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 230:OCA\Settings\Controller\AdminSettingsController->index("news")
- /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 137:OC\AppFramework\Http\Dispatcher->executeController([ "OCA\\Sett ... "], "index")
- /var/www/html/lib/private/AppFramework/App.php - line 183:OC\AppFramework\Http\Dispatcher->dispatch([ "OCA\\Sett ... "], "index")
- /var/www/html/lib/private/Route/Router.php - line 315:OC\AppFramework\App::main("OCA\\Settin ... r", "index", [ "OC\\AppFr ... "], [ "news","se ... "])
- /var/www/html/lib/base.php - line 1060:OC\Route\Router->match("/settings/admin/news")/var/www/html/index.php - line 36:OC::handleRequest()

In addition, my feed has not been fetching new posts lately. So, since the settings page is out of commission, I need to know how I can edit this value to something valid. Also, this should be validated and not allowed to happen in the first place.

Steps to Reproduce

Explain what you did to encounter the issue

  1. I believe this started because the last time I was on this settings page some copy/paste or auto-fill mistake happened and filled the cron interval field with a non-valid value.
  2. After saving that non-valid value, just visit /settings/admin/news to experience error
  3. Visit /apps/news every so often and you'll see no feeds are being updated

System Information

  • News app version: 21.2.0
  • Nextcloud version: 26.0.3
  • Cron type: system cron (I'm pretty sure)
  • PHP version: 8.1.21
  • Database and version: PostgreSQL 15.3
  • Browser and version: Multiple Browsers
  • OS and version: Win 10 and Win 11 (Using AIO Docker setup)
Contents of nextcloud/data/nextcloud.log
/* 
Not sure how to get these contents. 
That's a relative path that I don't know the root of and I have around a dozen containers running and I'm not sure which one to look at.
*/
Contents of Browser Error Console Read http://ggnome.com/wiki/Using_The_Browser_Error_Console if you are unsure what to put here
NA
@joezimjs joezimjs added the bug label Jul 22, 2023
@anoymouserver
Copy link
Contributor

I assume it's the same issue as #2289. The solution would be to correct the value manually in the database.

However the underlying problem is that the field allows strings at all and also writes them to the database, and that the field seems to be recognised as an autofill.

@joezimjs
Copy link
Author

Thanks. Missed that one, but like you said, we need a solution that prevents this issue from happening.

@Grotax
Copy link
Member

Grotax commented Aug 9, 2023

I checked this, I think the best option would be to check in the frontend if the field is valid.
Ideally you would do that for all fields.

The data that is entered there gets directly send to a nextcloud api as far as I understand.
And there it is not checked for type. I think all settings are stored as strings in the DB.

@Grotax Grotax added the frontend impact Javascript/Frontend code label Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug frontend impact Javascript/Frontend code
Projects
None yet
Development

No branches or pull requests

3 participants