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

Do not allow empty category names #292

Merged
merged 1 commit into from
Sep 14, 2023
Merged

Do not allow empty category names #292

merged 1 commit into from
Sep 14, 2023

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Sep 14, 2023

It was allowed to use an empty string like "" or " " for a category name.

From now on, it's not allowed.

If there were some empty names in the database, they were not renamed. Admins must optionally do that. Names were anyway UNIQUE.

A migration to rename empty names was not added because there can be more than one category, for example:

  • ""
  • " "
  • " "
  • Etcetera

We could have generated names like "no category 1", "no category 2", but it's not likely that admins have created empty categories.

@josecelano josecelano temporarily deployed to coverage September 14, 2023 15:06 — with GitHub Actions Inactive
@josecelano josecelano linked an issue Sep 14, 2023 that may be closed by this pull request
@josecelano josecelano temporarily deployed to coverage September 14, 2023 15:06 — with GitHub Actions Inactive
It was allowed to use an empty string like "" or " " for a category name.

From now on, it's not allowed.

If there were some empty names in the database, they were not renamed. Admins must optionally do that. Names were anyway UNIQUE.

A migration to rename empty names was not added because there can be more than one category, for example:

- ""
- " "
- "  "
- Etcetera

We could have generated names like "no category 1", "no category 2", but it's not likely that admins have created empty categories.
@josecelano josecelano temporarily deployed to coverage September 14, 2023 15:07 — with GitHub Actions Inactive
@josecelano josecelano added the Bug Incorrect Behavior label Sep 14, 2023
@josecelano josecelano temporarily deployed to coverage September 14, 2023 15:08 — with GitHub Actions Inactive
@josecelano
Copy link
Member Author

ACK c2b7488

@josecelano josecelano changed the title Do not allw empty category names Do not allow empty category names Sep 14, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #292 (c2b7488) into develop (cbe1fc3) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #292      +/-   ##
===========================================
+ Coverage    43.56%   43.63%   +0.06%     
===========================================
  Files           77       77              
  Lines         4320     4325       +5     
===========================================
+ Hits          1882     1887       +5     
  Misses        2438     2438              
Files Changed Coverage Δ
src/errors.rs 16.78% <100.00%> (+1.23%) ⬆️
src/services/category.rs 82.60% <100.00%> (+1.21%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@josecelano josecelano merged commit 15ac77d into torrust:develop Sep 14, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect Behavior
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

The API allows adding categories with empty name
2 participants