mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
22
js/script.js
22
js/script.js
@@ -204,14 +204,14 @@ View.prototype = {
|
||||
this._editableId(note.id);
|
||||
this._editableTitle(note.title);
|
||||
this._editableContent(note.content);
|
||||
this._editablePinned(note.ispinned);
|
||||
this._editablePinned(note.isPinned);
|
||||
this._editableColor(note.color);
|
||||
this._editableShares(note.shared_with);
|
||||
this._editableShares(note.sharedWith);
|
||||
this._editableTags(note.tags);
|
||||
this._editableAttachts(note.attachts, !note.is_shared);
|
||||
this._editableAttachts(note.attachments, !note.sharedBy.length);
|
||||
|
||||
// Create medium div editor.
|
||||
this._isEditable(!note.is_shared);
|
||||
this._isEditable(!note.sharedBy.length);
|
||||
|
||||
// Show modal editor
|
||||
this._showEditor(id);
|
||||
@@ -222,11 +222,11 @@ View.prototype = {
|
||||
id: this._editableId(),
|
||||
title: this._editableTitle(),
|
||||
content: this._editableContent(),
|
||||
attachts: this._editableAttachts(),
|
||||
attachments: this._editableAttachts(),
|
||||
color: this._editableColor(),
|
||||
pinned: this._editablePinned(),
|
||||
isPinned: this._editablePinned(),
|
||||
tags: this._editableTags(),
|
||||
shared_with: this._editableShares()
|
||||
sharedWith: this._editableShares()
|
||||
};
|
||||
var self = this;
|
||||
this._notes.update(fakeNote).done(function (note) {
|
||||
@@ -390,7 +390,7 @@ View.prototype = {
|
||||
var id = parseInt(gridNote.data('id'), 10);
|
||||
|
||||
var note = self._notes.read(id);
|
||||
note.pinned = true;
|
||||
note.isPinned = true;
|
||||
|
||||
self._notes.update(note).done(function () {
|
||||
icon.removeClass("hide-header-icon");
|
||||
@@ -413,7 +413,7 @@ View.prototype = {
|
||||
var id = parseInt(gridNote.data('id'), 10);
|
||||
|
||||
var note = self._notes.read(id);
|
||||
note.pinned = false;
|
||||
note.isPinned = false;
|
||||
|
||||
self._notes.update(note).done(function () {
|
||||
icon.removeClass("fixed-header-icon");
|
||||
@@ -851,7 +851,7 @@ View.prototype = {
|
||||
};
|
||||
});
|
||||
} else {
|
||||
var html = Handlebars.templates['shares']({shared_with: shared_with});
|
||||
var html = Handlebars.templates['shares']({sharedWith: shared_with});
|
||||
$("#modal-note-div .note-shares").replaceWith(html);
|
||||
}
|
||||
},
|
||||
@@ -878,7 +878,7 @@ View.prototype = {
|
||||
};
|
||||
});
|
||||
} else {
|
||||
var html = Handlebars.templates['attachts']({ attachts: attachts, can_delete: can_delete});
|
||||
var html = Handlebars.templates['attachts']({ attachments: attachts, can_delete: can_delete});
|
||||
$("#modal-note-div .note-attachts").replaceWith(html);
|
||||
|
||||
lozad('.attach-preview').observe();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class='note-attachts'>
|
||||
{{#each attachts}}
|
||||
{{#each attachments}}
|
||||
<div class='note-attach-grid'>
|
||||
<a target="_blank" href="{{redirect_url}}">
|
||||
<div class="attach-preview note-attach" attach-file-id="{{file_id}}" data-background-image="{{preview_url}}"/>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="note-grid-item">
|
||||
<div class="quicknote noselect {{#if is_shared}}shared{{/if}} {{#if shared_with.length}}shareowner{{/if}}" style="background-color: {{color}}" data-id="{{ id }}" data-timestamp="{{ timestamp }}" >
|
||||
<div class="quicknote noselect {{#if sharedBy.length}}shared{{/if}} {{#if sharedWith.length}}shareowner{{/if}}" style="background-color: {{color}}" data-id="{{ id }}" data-timestamp="{{ timestamp }}" >
|
||||
<div class='note-header'>
|
||||
<div class='note-attachts'>
|
||||
{{#each attachts}}
|
||||
{{#each attachments}}
|
||||
<div class='note-attach-grid'>
|
||||
<div class="attach-preview note-attach" attach-file-id="{{file_id}}" data-background-image="{{preview_url}}"/>
|
||||
</div>
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div class='note-body'>
|
||||
<div>
|
||||
{{#if ispinned}}
|
||||
{{#if isPinned}}
|
||||
<div class="icon-header-note icon-pinned fixed-header-icon" title="{{t "quicknotes" "Unpin note"}}"></div>
|
||||
{{else}}
|
||||
<div class="icon-header-note icon-pin hide-header-icon" title="{{t "quicknotes" "Pin note"}}"></div>
|
||||
@@ -25,7 +25,7 @@
|
||||
{{{ content }}}
|
||||
</div>
|
||||
<div class='note-shares'>
|
||||
{{#each shared_with}}
|
||||
{{#each sharedWith}}
|
||||
<div class="icon-user slim-share" share-id="{{ shared_user }}" title="Shared with {{ shared_user }}">{{{ shared_user }}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<div id="notes-grid-div" class="notes-grid">
|
||||
{{#each notes}}
|
||||
<div class="note-grid-item">
|
||||
<div class="quicknote noselect {{#if is_shared}}shared{{/if}} {{#if shared_with.length}}shareowner{{/if}}" style="background-color: {{color}}" data-id="{{ id }}" data-timestamp="{{ timestamp }}" >
|
||||
<div class="quicknote noselect {{#if sharedBy.length}}shared{{/if}} {{#if sharedWith.length}}shareowner{{/if}}" style="background-color: {{color}}" data-id="{{ id }}" data-timestamp="{{ timestamp }}" >
|
||||
<div class='note-header'>
|
||||
<div class='note-attachts'>
|
||||
{{#each attachts}}
|
||||
{{#each attachments}}
|
||||
<div class='note-attach-grid'>
|
||||
<div class="attach-preview note-attach" attach-file-id="{{file_id}}" data-background-image="{{preview_url}}"/>
|
||||
</div>
|
||||
@@ -14,11 +14,11 @@
|
||||
</div>
|
||||
<div class='note-body'>
|
||||
<div>
|
||||
{{#if is_shared}}
|
||||
<div class="icon-header-note icon-share" title="{{tSB userid }}"></div>
|
||||
<div class="icon-header-note icon-delete hide-header-icon icon-delete-note" title="{{t "quicknotes" "Delete note"}}"></div>
|
||||
{{#if sharedBy}}
|
||||
<div class="icon-header-note icon-share" title="{{tSB sharedBy.user_id }}"></div>
|
||||
<div class="icon-header-note icon-delete hide-header-icon icon-delete-note" title="{{t "quicknotes" "Delete shared note"}}"></div>
|
||||
{{else}}
|
||||
{{#if ispinned}}
|
||||
{{#if isPinned}}
|
||||
<div class="icon-header-note icon-pinned fixed-header-icon" title="{{t "quicknotes" "Unpin note"}}"></div>
|
||||
{{else}}
|
||||
<div class="icon-header-note icon-pin hide-header-icon" title="{{t "quicknotes" "Pin note"}}"></div>
|
||||
@@ -33,7 +33,7 @@
|
||||
{{{ content }}}
|
||||
</div>
|
||||
<div class='note-shares'>
|
||||
{{#each shared_with}}
|
||||
{{#each sharedWith}}
|
||||
<div class="icon-user slim-share" share-id="{{ shared_user }}" title="{{tSW shared_user}}">{{{ shared_user }}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class='note-shares'>
|
||||
{{#each shared_with}}
|
||||
{{#each sharedWith}}
|
||||
<div class="icon-user slim-share" share-id="{{ shared_user }}" title="{{tSW shared_user}}">{{{ shared_user }}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
@@ -32,14 +32,18 @@ use OCP\IServerContainer;
|
||||
class Application extends App {
|
||||
|
||||
/** @var string */
|
||||
public const APP_NAME = 'quicknotes';
|
||||
public const APP_ID = 'quicknotes';
|
||||
|
||||
/** @var string */
|
||||
public const API_VERSION = '1.0';
|
||||
|
||||
public function __construct(array $urlParams = []) {
|
||||
parent::__construct(self::APP_NAME, $urlParams);
|
||||
parent::__construct(self::APP_ID, $urlParams);
|
||||
}
|
||||
|
||||
public function register(): void {
|
||||
$this->registerNavigationEntry();
|
||||
$this->registerCapabilities();
|
||||
}
|
||||
|
||||
private function registerNavigationEntry(): void {
|
||||
@@ -59,4 +63,9 @@ class Application extends App {
|
||||
});
|
||||
}
|
||||
|
||||
private function registerCapabilities(): void {
|
||||
$container = $this->getContainer();
|
||||
$container->registerCapability(Capabilities::class);
|
||||
}
|
||||
|
||||
}
|
||||
47
lib/AppInfo/Capabilities.php
Normal file
47
lib/AppInfo/Capabilities.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* @copyright 2016-2020 Matias De lellis <mati86dl@gmail.com>
|
||||
*
|
||||
* @author 2016 Matias De lellis <mati86dl@gmail.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\QuickNotes\AppInfo;
|
||||
|
||||
use OCP\Capabilities\ICapability;
|
||||
use OCP\App\IAppManager;
|
||||
|
||||
class Capabilities implements ICapability {
|
||||
|
||||
/** @var IAppManager */
|
||||
private $appManager;
|
||||
|
||||
public function __construct(IAppManager $appManager) {
|
||||
$this->appManager = $appManager;
|
||||
}
|
||||
|
||||
public function getCapabilities() {
|
||||
return [
|
||||
Application::APP_ID => [
|
||||
'version' => $this->appManager->getAppVersion(Application::APP_ID),
|
||||
'api_version' => Application::API_VERSION,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class NoteApiController extends ApiController {
|
||||
private $userId;
|
||||
|
||||
public function __construct($AppName,
|
||||
IRequest $request,
|
||||
IRequest $request,
|
||||
NoteService $noteService,
|
||||
$userId)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ class NoteApiController extends ApiController {
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function show($id): JSONResponse {
|
||||
public function show(int $id): JSONResponse {
|
||||
$note = $this->noteService->get($this->userId, $id);
|
||||
if (is_null($note)) {
|
||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||
@@ -96,9 +96,27 @@ class NoteApiController extends ApiController {
|
||||
* @param string $title
|
||||
* @param string $content
|
||||
* @param string $color
|
||||
* @param bool $isPinned
|
||||
* @param array $sharedWith
|
||||
* @param array $tags
|
||||
* @param array $attachments
|
||||
*/
|
||||
public function create($title, $content, $color = "#F7EB96") {
|
||||
$note = $this->noteService->create($this->userId, $title, $content, $color);
|
||||
public function create(string $title,
|
||||
string $content,
|
||||
string $color = null,
|
||||
bool $isPinned = false,
|
||||
array $sharedWith = [],
|
||||
array $tags = [],
|
||||
array $attachments = [])
|
||||
{
|
||||
$note = $this->noteService->create($this->userId,
|
||||
$title,
|
||||
$content,
|
||||
$color,
|
||||
$isPinned,
|
||||
$sharedWith,
|
||||
$tags,
|
||||
$attachments);
|
||||
|
||||
$etag = md5(json_encode($note));
|
||||
|
||||
@@ -116,13 +134,31 @@ class NoteApiController extends ApiController {
|
||||
* @param int $id
|
||||
* @param string $title
|
||||
* @param string $content
|
||||
* @param array $attachts
|
||||
* @param bool $pinned
|
||||
* @param array $tags
|
||||
* @param string $color
|
||||
* @param bool $isPinned
|
||||
* @param array $tags
|
||||
* @param array $attachments
|
||||
* @param array $sharedWith
|
||||
*/
|
||||
public function update(int $id, string $title, string $content, array $attachts, bool $pinned, array $tags, string $color = "#F7EB96"): JSONResponse {
|
||||
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachts, $pinned, $tags, $color);
|
||||
public function update(int $id,
|
||||
string $title,
|
||||
string $content,
|
||||
string $color,
|
||||
bool $isPinned,
|
||||
array $tags,
|
||||
array $attachments,
|
||||
array $sharedWith): JSONResponse
|
||||
{
|
||||
$note = $this->noteService->update($this->userId,
|
||||
$id,
|
||||
$title,
|
||||
$content,
|
||||
$color,
|
||||
$isPinned,
|
||||
$tags,
|
||||
$attachments,
|
||||
$sharedWith);
|
||||
|
||||
if (is_null($note)) {
|
||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class NoteController extends Controller {
|
||||
private $userId;
|
||||
|
||||
public function __construct($AppName,
|
||||
IRequest $request,
|
||||
IRequest $request,
|
||||
NoteService $noteService,
|
||||
$userId)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ class NoteController extends Controller {
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function show($id): JSONResponse {
|
||||
public function show(int $id): JSONResponse {
|
||||
$note = $this->noteService->get($this->userId, $id);
|
||||
if (is_null($note)) {
|
||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||
@@ -90,9 +90,27 @@ class NoteController extends Controller {
|
||||
* @param string $title
|
||||
* @param string $content
|
||||
* @param string $color
|
||||
* @param bool $isPinned
|
||||
* @param array $sharedWith
|
||||
* @param array $tags
|
||||
* @param array $attachments
|
||||
*/
|
||||
public function create($title, $content, $color = NULL) {
|
||||
$note = $this->noteService->create($this->userId, $title, $content, $color);
|
||||
public function create(string $title,
|
||||
string $content,
|
||||
string $color = null,
|
||||
bool $isPinned = false,
|
||||
array $sharedWith = [],
|
||||
array $tags = [],
|
||||
array $attachments = [])
|
||||
{
|
||||
$note = $this->noteService->create($this->userId,
|
||||
$title,
|
||||
$content,
|
||||
$color,
|
||||
$isPinned,
|
||||
$sharedWith,
|
||||
$tags,
|
||||
$attachments);
|
||||
|
||||
$etag = md5(json_encode($note));
|
||||
|
||||
@@ -108,14 +126,31 @@ class NoteController extends Controller {
|
||||
* @param int $id
|
||||
* @param string $title
|
||||
* @param string $content
|
||||
* @param array $attachts
|
||||
* @param bool $pinned
|
||||
* @param array $tags
|
||||
* @param array $shared_with
|
||||
* @param string $color
|
||||
* @param bool $isPinned
|
||||
* @param array $tags
|
||||
* @param array $attachments
|
||||
* @param array $sharedWith
|
||||
*/
|
||||
public function update(int $id, string $title, string $content, array $attachts, bool $pinned, array $tags, array $shared_with, string $color = "#F7EB96"): JSONResponse {
|
||||
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachts, $pinned, $tags, $shared_with, $color);
|
||||
public function update(int $id,
|
||||
string $title,
|
||||
string $content,
|
||||
string $color,
|
||||
bool $isPinned,
|
||||
array $tags,
|
||||
array $attachments,
|
||||
array $sharedWith): JSONResponse
|
||||
{
|
||||
$note = $this->noteService->update($this->userId,
|
||||
$id,
|
||||
$title,
|
||||
$content,
|
||||
$color,
|
||||
$isPinned,
|
||||
$tags,
|
||||
$attachments,
|
||||
$sharedWith);
|
||||
|
||||
if (is_null($note)) {
|
||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
@@ -137,4 +172,5 @@ class NoteController extends Controller {
|
||||
$this->noteService->destroy($this->userId, $id);
|
||||
return new JSONResponse([]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ class Note extends Entity implements JsonSerializable {
|
||||
protected $userId;
|
||||
protected $sharedWith = [];
|
||||
protected $sharedBy = [];
|
||||
protected $isShared;
|
||||
protected $tags;
|
||||
protected $attachts;
|
||||
|
||||
@@ -32,20 +31,16 @@ class Note extends Entity implements JsonSerializable {
|
||||
|
||||
public function jsonSerialize() {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'content' => $this->content,
|
||||
'pinned' => $this->pinned,
|
||||
'ispinned' => $this->isPinned,
|
||||
'timestamp' => $this->timestamp,
|
||||
'colorid' => $this->colorId,
|
||||
'color' => $this->color,
|
||||
'userid' => $this->userId,
|
||||
'shared_with' => $this->sharedWith,
|
||||
'shared_by' => $this->sharedBy,
|
||||
'is_shared' => $this->isShared,
|
||||
'tags' => $this->tags,
|
||||
'attachts' => $this->attachts
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'content' => $this->content,
|
||||
'isPinned' => $this->isPinned,
|
||||
'timestamp' => $this->timestamp,
|
||||
'color' => $this->color,
|
||||
'sharedWith' => $this->sharedWith,
|
||||
'sharedBy' => $this->sharedBy,
|
||||
'tags' => $this->tags,
|
||||
'attachments' => $this->attachts
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ class NoteService {
|
||||
|
||||
// Set shares with others.
|
||||
foreach($notes as $note) {
|
||||
$note->setIsShared(false);
|
||||
$note->setSharedWith($this->noteShareMapper->getSharesForNote($note->getId()));
|
||||
}
|
||||
|
||||
@@ -90,8 +89,6 @@ class NoteService {
|
||||
$sharedEntries = $this->noteShareMapper->findForUser($userId);
|
||||
foreach($sharedEntries as $sharedEntry) {
|
||||
$sharedNote = $this->notemapper->findShared($sharedEntry->getNoteId());
|
||||
$sharedNote->setIsShared(true);
|
||||
|
||||
$sharedEntry->setUserId($sharedNote->getUserId());
|
||||
$sharedNote->setSharedBy([$sharedEntry]);
|
||||
$shares[] = $sharedNote;
|
||||
@@ -155,9 +152,21 @@ class NoteService {
|
||||
* @param string $userId
|
||||
* @param string $title
|
||||
* @param string $content
|
||||
* @param string $color
|
||||
* @param string $color optional color.
|
||||
* @param bool $isPinned optional if note must be pinned
|
||||
* @param array $sharedWith optional list of shares
|
||||
* @param array $tags optional list of tags
|
||||
* @param array $attachments optional list of attachments
|
||||
*/
|
||||
public function create(string $userId, string $title, string $content, string $color = NULL): Note {
|
||||
public function create(string $userId,
|
||||
string $title,
|
||||
string $content,
|
||||
string $color = null,
|
||||
bool $isPinned = false,
|
||||
array $sharedWith = [],
|
||||
array $tags = [],
|
||||
array $attachments = []): ?Note
|
||||
{
|
||||
if (is_null($color)) {
|
||||
$color = $this->settingsService->getColorForNewNotes();
|
||||
}
|
||||
@@ -171,20 +180,24 @@ class NoteService {
|
||||
$hcolor = $this->colormapper->insert($hcolor);
|
||||
}
|
||||
|
||||
|
||||
// Create note and insert it
|
||||
$note = new Note();
|
||||
|
||||
$note->setTitle($title);
|
||||
$note->setContent($content);
|
||||
$note->setPinned($isPinned ? 1 : 0);
|
||||
$note->setTimestamp(time());
|
||||
$note->setColorId($hcolor->id);
|
||||
$note->setUserId($userId);
|
||||
|
||||
$newNote = $this->notemapper->insert($note);
|
||||
|
||||
// TODO: Insert optional shares, tags and attachments.
|
||||
|
||||
// Insert true color pin and tags to response
|
||||
$newNote->setColor($hcolor->getColor());
|
||||
$newNote->setIsPinned(false);
|
||||
$newNote->setIsPinned($isPinned);
|
||||
$newNote->setTags([]);
|
||||
$newNote->setAttachts([]);
|
||||
|
||||
@@ -193,24 +206,24 @@ class NoteService {
|
||||
|
||||
/**
|
||||
* @param string userId
|
||||
* @param int $id
|
||||
* @param int $id
|
||||
* @param string $title
|
||||
* @param string $content
|
||||
* @param array $attachts
|
||||
* @param bool $pinned
|
||||
* @param array $tags
|
||||
* @param array $shares
|
||||
* @param string $color
|
||||
* @param bool $isPinned
|
||||
* @param array $tags
|
||||
* @param array $attachments
|
||||
* @param array $sharedWith
|
||||
*/
|
||||
public function update(string $userId,
|
||||
int $id,
|
||||
string $title,
|
||||
string $content,
|
||||
array $attachts,
|
||||
bool $pinned,
|
||||
string $color,
|
||||
bool $isPinned,
|
||||
array $tags,
|
||||
array $shares,
|
||||
string $color): ?Note
|
||||
array $attachments,
|
||||
array $sharedWith): ?Note
|
||||
{
|
||||
// Get current Note and Color.
|
||||
$note = $this->get($userId, $id);
|
||||
@@ -244,7 +257,7 @@ class NoteService {
|
||||
}
|
||||
|
||||
// Add new attachts
|
||||
foreach ($attachts as $attach) {
|
||||
foreach ($attachments as $attach) {
|
||||
if (!$this->attachMapper->fileAttachExists($userId, $id, $attach['file_id'])) {
|
||||
$hAttach = new Attach();
|
||||
$hAttach->setUserId($userId);
|
||||
@@ -259,7 +272,7 @@ class NoteService {
|
||||
$dbShares = $this->noteShareMapper->getSharesForNote($id);
|
||||
foreach ($dbShares as $dbShare) {
|
||||
$delete = true;
|
||||
foreach ($shares as $share) {
|
||||
foreach ($sharedWith as $share) {
|
||||
if ($dbShare->getSharedUser() === $share['shared_user']) {
|
||||
$delete = false;
|
||||
break;
|
||||
@@ -271,7 +284,7 @@ class NoteService {
|
||||
}
|
||||
|
||||
// Add new shares
|
||||
foreach ($shares as $share) {
|
||||
foreach ($sharedWith as $share) {
|
||||
if (!$this->noteShareMapper->existsByNoteAndUser($id, $share['shared_user'])) {
|
||||
$hShare = new NoteShare();
|
||||
$hShare->setNoteId($id);
|
||||
@@ -320,7 +333,7 @@ class NoteService {
|
||||
// Set new info on Note
|
||||
$note->setTitle($title);
|
||||
$note->setContent($content);
|
||||
$note->setPinned($pinned ? 1 : 0);
|
||||
$note->setPinned($isPinned ? 1 : 0);
|
||||
$note->setTimestamp(time());
|
||||
$note->setColorId($hcolor->id);
|
||||
|
||||
@@ -329,7 +342,7 @@ class NoteService {
|
||||
|
||||
// Insert true color and pin to response
|
||||
$newnote->setColor($hcolor->getColor());
|
||||
$newnote->setIsPinned($note->getPinned() ? true : false);
|
||||
$newnote->setIsPinned($isPinned);
|
||||
|
||||
// Fill new tags
|
||||
$newnote->setTags($this->tagmapper->getTagsForNote($userId, $newnote->getId()));
|
||||
@@ -343,7 +356,6 @@ class NoteService {
|
||||
$newnote->setAttachts($attachts);
|
||||
|
||||
// Fill shared with with others
|
||||
$newnote->setIsShared(false);
|
||||
$newnote->setSharedWith($this->noteShareMapper->getSharesForNote($newnote->getId()));
|
||||
|
||||
// Remove old color if necessary
|
||||
@@ -363,7 +375,7 @@ class NoteService {
|
||||
* @param string $userId
|
||||
* @param int $id
|
||||
*/
|
||||
public function destroy($userId, $id) {
|
||||
public function destroy (string $userId, int $id) {
|
||||
// Get Note and Color
|
||||
try {
|
||||
$note = $this->notemapper->find($id, $userId);
|
||||
|
||||
@@ -55,11 +55,11 @@ class SettingsService {
|
||||
|
||||
|
||||
public function getColorForNewNotes(): string {
|
||||
return $this->config->getUserValue($this->userId, Application::APP_NAME, self::COLOR_FOR_NEW_NOTES_KEY, self::DEFAULT_COLOR_FOR_NEW_NOTES);
|
||||
return $this->config->getUserValue($this->userId, Application::APP_ID, self::COLOR_FOR_NEW_NOTES_KEY, self::DEFAULT_COLOR_FOR_NEW_NOTES);
|
||||
}
|
||||
|
||||
public function setColorForNewNotes(string $color) {
|
||||
$this->config->setUserValue($this->userId, Application::APP_NAME, self::COLOR_FOR_NEW_NOTES_KEY, $color);
|
||||
$this->config->setUserValue($this->userId, Application::APP_ID, self::COLOR_FOR_NEW_NOTES_KEY, $color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user