aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
authorGravatar knasdk <kim@knas-webdesign.dk> 2020-10-06 23:15:02 +0200
committerGravatar GitHub <noreply@github.com> 2020-10-06 23:15:02 +0200
commite43b7ecd093058f28dcce51b1e2cd604d5efa7a9 (patch)
tree12e2b8df17ada9987a50b8841b8f1007569fdc94 /app/Controllers
parent76523693592a58c7b15c2860ad95133f551d86a5 (diff)
Use of existing tag name via input field (#3213)
* Use of existing tag name via input field Use existing tag name, when tag name is typed into tag list's text field * Indentation mistake Just an indentation correction * Final correction Missed line 35.
Diffstat (limited to 'app/Controllers')
-rw-r--r--app/Controllers/tagController.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php
index c49a3fcc4..75f276d19 100644
--- a/app/Controllers/tagController.php
+++ b/app/Controllers/tagController.php
@@ -33,8 +33,13 @@ class FreshRSS_tag_Controller extends Minz_ActionController {
if ($id_entry != false) {
$tagDAO = FreshRSS_Factory::createTagDao();
if ($id_tag == 0 && $name_tag != '' && $checked) {
- //Create new tag
- $id_tag = $tagDAO->addTag(array('name' => $name_tag));
+ if ($existing_tag = $tagDAO->searchByName($name_tag)) {
+ // Use existing tag
+ $tagDAO->tagEntry($existing_tag->id(), $id_entry, $checked);
+ } else {
+ //Create new tag
+ $id_tag = $tagDAO->addTag(array('name' => $name_tag));
+ }
}
if ($id_tag != 0) {
$tagDAO->tagEntry($id_tag, $id_entry, $checked);