summaryrefslogtreecommitdiff
path: root/plugins/note
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-19 17:15:22 +0300
committerAndrew Dolgov <[email protected]>2021-02-19 17:15:22 +0300
commitd445530fa08cdbe2088150a3e7d23596eab9b142 (patch)
tree0c9e9a44cfd5f38835857fd961ee17c11e9e54f9 /plugins/note
parent4fa8450d38ccafdfa1117aa8a6fa570ce9fecb09 (diff)
format note on the client
Diffstat (limited to 'plugins/note')
-rw-r--r--plugins/note/init.php9
-rw-r--r--plugins/note/note.js14
2 files changed, 9 insertions, 14 deletions
diff --git a/plugins/note/init.php b/plugins/note/init.php
index 278cfe6c3..f4bdf45bc 100644
--- a/plugins/note/init.php
+++ b/plugins/note/init.php
@@ -55,17 +55,14 @@ class Note extends Plugin {
}
function setNote() {
- $id = $_REQUEST["id"];
- $note = trim(strip_tags($_REQUEST["note"]));
+ $id = (int)clean($_REQUEST["id"]);
+ $note = clean($_REQUEST["note"]);
$sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET note = ?
WHERE ref_id = ? AND owner_uid = ?");
$sth->execute([$note, $id, $_SESSION['uid']]);
- $formatted_note = Article::_format_note_html($id, $note);
-
- print json_encode(array("note" => $formatted_note,
- "raw_length" => mb_strlen($note)));
+ print json_encode(["id" => $id, "note" => $note]);
}
function api_version() {
diff --git a/plugins/note/note.js b/plugins/note/note.js
index d42fca2c1..a46acb355 100644
--- a/plugins/note/note.js
+++ b/plugins/note/note.js
@@ -13,16 +13,14 @@ Plugins.Note = {
dialog.hide();
if (reply) {
- const elem = App.byId("POSTNOTE-" + id);
+ App.findAll(`div[data-note-for="${reply.id}"]`).forEach((elem) => {
+ elem.querySelector(".body").innerHTML = reply.note;
- if (elem) {
- elem.innerHTML = reply.note;
-
- if (reply.raw_length != 0)
- Element.show(elem);
+ if (reply.note)
+ elem.show();
else
- Element.hide(elem);
- }
+ elem.hide();
+ });
}
});
}