-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add API to change the category #87
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff!
Just a single change request and afterwards this can be merged.
service/notesservice.php
Outdated
} | ||
} | ||
return implode('/', $cleanedFolders); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can drop this.
As discussed with @LukasReschke all paths containing /../
are denied by core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just tested removing this method. Then, the core throws a NotPermittedException
. This currently results in not accepting the whole change (i.e. also content changes) and in creating two (!) empty notes. In order to improve the user-experience (a respective category name could be entered by accident), we should handle this exception.
Of course, this can be easily done, but we have to think about, which behavior is desired:
a) Remove problematic parts from the new category name and perform changing the category to this adjusted name (my current approach).
b) Don't prepare category name; check for Exception by core; and ignore category change if Exception happens.
From the user perspective, I would prefer a). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only occur with a comment containing /../
right? So I really doubt that any user would enter such a category. I would probably go with b.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've removed the category name preparation and introduced an exception handling. Please review again, @Henni
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final change request. Afterwards this will be merged.
service/notesservice.php
Outdated
if($currentFilePath !== $newFilePath) { | ||
$file->move($newFilePath); | ||
} | ||
} catch(\Exception $e) { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we specify a stricter Exception than the generic \Exception
?
Also it would be great to at least give some kind of feedback in form of a server log entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that's reasonable. I will change this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done; ready for merging, now 😃
Awesome job @korelstar ! |
Great work as always! So i guess we can continue nextcloud/notes-android#210 as soon as it has been tested with combination old/new? |
Thanks :-) |
Since #6 introduced notes from subdirectories and exposes this in the 3rd-party API as
category
(see also #8), we've implemented read-only categories in the Android client (see nextcloud/notes-android#181). However, there is the demand to change the category from the client.Therefore, I extended the API to be capable of doing this (fully backward compatible). The implementation on the client-side is already finished (for now in a simple approach, this will be improved later) and the integration can be tested: nextcloud/notes-android#210
Of course, the web app should be able to display and change categories, too. But my AngularJS skills are limited and there is no agreement on how to layout this new feature. However, this implementation is realized in the
notesservice
, so it can be used by the web app, too.