mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 03:15:56 +00:00
format note on the client
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user