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

Adds Validation for status label creation through the API #15713

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Godmartinz
Copy link
Collaborator

@Godmartinz Godmartinz commented Oct 22, 2024

Description

Validation check:
image
image

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • PHP version:
  • MySQL version
  • Webserver version
  • OS version

Checklist:

Copy link

what-the-diff bot commented Oct 22, 2024

PR Summary

  • Enhanced Error Message Customization in Status Labels
    The update in StatuslabelsController.php allows for the specific error message "Status label type is required" to be translated into different languages, thus improving the adaptability of the application to various user language preferences.

  • New Translation String for Status Label Requirement
    A new translation string has been incorporated in the message.php file, particularly for the "Status label type is required" message, enabling easy conversion of this instruction into other languages.

@snipe
Copy link
Owner

snipe commented Oct 23, 2024

As I mentioned in the previous PR, why aren't we just using normal validation here? If we were, we'd get that for free without having to translate it.

@Godmartinz Godmartinz changed the title add translation for status label error message Adds translation and Validation for status label creation Oct 23, 2024
@Godmartinz Godmartinz changed the title Adds translation and Validation for status label creation Adds Validation for status label creation through the API Oct 23, 2024
@Godmartinz
Copy link
Collaborator Author

Validation added, and translation removed. 👍

@@ -166,7 +167,22 @@ public static function getStatuslabelTypesForDB($type)

return $statustype;
}
public function validate()
{
$validator = Validator::make($this->attributes, $this->rules);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we do it this way, we're not actually checking for type though, no? We don't have that constraint in the model $rules:

    protected $rules = [
        'name'  => 'required|string|unique_undeleted',
        'notes'   => 'string|nullable',
        'deployable' => 'required',
        'pending' => 'required',
        'archived' => 'required',
    ];

since type isn't an actual field on the table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants