Update note modified date when favorite status changes, fix API bug preventing notes from being unfavorited
This commit is contained in:
parent
d4bcd56b90
commit
e471355637
@ -104,6 +104,7 @@ switch ($VARS['action']) {
|
||||
die($Strings->get("invalid parameters"));
|
||||
}
|
||||
$note->setFavorite(!$note->getFavorite());
|
||||
$note->setModified(date("Y-m-d H:i:s"));
|
||||
$note->saveNote();
|
||||
returnToSender("");
|
||||
break;
|
||||
|
@ -15,12 +15,14 @@ try {
|
||||
if (!$note->hasWriteAccess(getRequestUser())) {
|
||||
sendJsonResp($Strings->get("You don't have permission to edit this note.", false), "ERROR");
|
||||
}
|
||||
if (empty($VARS['favorite'])) {
|
||||
if (!isset($VARS['favorite'])) {
|
||||
$note->setFavorite(!$note->getFavorite());
|
||||
} else {
|
||||
$note->setFavorite($VARS['favorite'] == true);
|
||||
}
|
||||
|
||||
$note->setModified(date("Y-m-d H:i:s"));
|
||||
|
||||
$note->saveNote();
|
||||
|
||||
sendJsonResp($Strings->get("Note saved", false), "OK", ["note" => $note->toArray()]);
|
@ -47,7 +47,7 @@ if (empty($VARS['modified'])) {
|
||||
$note->setModified($VARS['modified']);
|
||||
}
|
||||
|
||||
if (!empty($VARS['favorite'])) {
|
||||
if (isset($VARS['favorite'])) {
|
||||
$note->setFavorite($VARS['favorite'] == true);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user