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

Set a default status code for new redirects (#360) #361

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

Conversation

timfeskens
Copy link

Fixes #360

Proposed Changes

  • Set a default status code in your config by setting 'defaultStatus' => 307 for example

Copy link
Owner

@distantnative distantnative left a comment

Choose a reason for hiding this comment

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

Sorry for the late reply and thanks for the contribution. I like it. I would just simplify the option name to simply status.

@@ -24,6 +25,9 @@ public function load(): array
{
$fields = $this->fields();

// remove default value for status
$fields['status'] = A::merge($fields['status'], ['default' => null]);
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
$fields['status'] = A::merge($fields['status'], ['default' => null]);
unset($fields['status']['default']);

@@ -58,6 +58,7 @@ protected function fields(): array
'label' => I18n::translate('retour.redirects.status'),
'options' => $codes,
'width' => '1/2',
'default' => Retour::instance()->option('defaultStatus'),
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
'default' => Retour::instance()->option('defaultStatus'),
'default' => Retour::instance()->option('status'),

Comment on lines +34 to +35
// Default: null (which disables the redirect)
'defaultStatus' => ...,
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
// Default: null (which disables the redirect)
'defaultStatus' => ...,
// Default: `null` (which disables the redirect)
'status' => 308,

@distantnative distantnative changed the base branch from main to dev November 23, 2024 09:00
@distantnative distantnative added this to the 5.4.0 milestone Nov 23, 2024
@distantnative distantnative modified the milestones: 5.4.0, 5.5.0 Jan 22, 2025
@distantnative
Copy link
Owner

@timfeskens Would you be able to make the suggested changes or should I take it from here? :)

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.

Set a default redirect status in the config
2 participants