Skip to content
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

Merged
merged 3 commits into from
Jun 6, 2017
Merged

add API to change the category #87

merged 3 commits into from
Jun 6, 2017

Conversation

korelstar
Copy link
Member

@korelstar korelstar commented May 5, 2017

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.

@korelstar korelstar added feature: API Related to the API for 3rd-party apps, i.e. Android or iOS enhancement New feature or request labels May 5, 2017
Copy link
Member

@Henni Henni left a 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.

}
}
return implode('/', $cleanedFolders);
}
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

@Henni Henni left a 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.

if($currentFilePath !== $newFilePath) {
$file->move($newFilePath);
}
} catch(\Exception $e) {
}
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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 😃

@Henni
Copy link
Member

Henni commented Jun 6, 2017

Awesome job @korelstar !

@Henni Henni merged commit da4f9cc into master Jun 6, 2017
@Henni Henni deleted the update-category branch June 6, 2017 18:58
@stefan-niedermann
Copy link
Member

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?

@korelstar
Copy link
Member Author

Thanks :-)
Please test the branch of the Android app. Maybe, there are some cosmetic issues.

korelstar added a commit that referenced this pull request Apr 24, 2020
Enhancing removeMarkDown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature: API Related to the API for 3rd-party apps, i.e. Android or iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants