aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-06-21 10:30:12 +0200
committerGravatar GitHub <noreply@github.com> 2020-06-21 10:30:12 +0200
commit051f1649f705dd77febd39c8f4a53c97f4c1115f (patch)
treec9da7a9de33103fb5efff4af19d53127681f958a /app/Controllers/feedController.php
parent17d7fd46ee5055c7f845a15f67ce4b1ef885b2d3 (diff)
FeedMe table manage feeds + fix warning addFeed (#3075)
FeedMe is able to add/remove subscriptions. Fix minor bug introduced by https://github.com/FreshRSS/FreshRSS/pull/1731 If the category ID is provided, we must first search for the existing category before trying to add a category with the provided name. Fix: ``` SQL error addCategory: ["23000",19,"UNIQUE constraint failed: category.name"] ```
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index fda6ddfcd..c0843ffba 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -54,11 +54,12 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
}
$cat = null;
- if ($new_cat_name != '') {
+ if ($cat_id > 0) {
+ $cat = $catDAO->searchById($cat_id);
+ }
+ if ($cat == null && $new_cat_name != '') {
$new_cat_id = $catDAO->addCategory(array('name' => $new_cat_name));
$cat_id = $new_cat_id > 0 ? $new_cat_id : $cat_id;
- }
- if ($cat_id > 0) {
$cat = $catDAO->searchById($cat_id);
}
if ($cat == null) {