chrisvel / wreeto_official

Wreeto is an open source note-taking, knowledge management and wiki system.
https://wreeto.com
GNU Affero General Public License v3.0
387 stars 13 forks source link

Projects and categories can't have same name because of slug #18

Closed AlexKalopsia closed 4 years ago

AlexKalopsia commented 4 years ago

I've found a bug by accident as I tried to create a Project that had the same name as an existing Category.

When you create a category - say My Diary - it will be assigned a my-diary slug.

If you then proceed to create a project and try to call it My Diary the page will keep loading endlessly. The problem seems to be connected to the fact that Wreeto detects that the my-diary slug aready exists.

To make things a bit worse, if you rename a category, their slug doesn't get updated.

My suggestion would be to

A) Throw a UI error if Wreeto is unable to proceed because the slug already exists, or - alternatively, make sure it automatically adds a suffix to the new slug

B) Show explicit slugs in the UI and let the user edit the assigned slug. This is fairly common practice in some tools like blogging CMSs.

chrisvel commented 4 years ago

Nice bug! Thank you for this, I am working on a fix.

The (A) is the right thing to do except the suffix part. Projects have been designed to be just a subcategory of Category as they share the same attributes, so slug will be unique between all categories (including projects).

There is no reason to add more complexity for now e.g. to add suffix or let the user edit/decide on the slug. It's just a friendly url that I believe it's barely noticed by the users.

I will release the fix along with the tags feature.