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

properly encode X-Status #438

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1735fd6
NEW: Stages differ recursive.
danaenz Feb 26, 2021
dd2674f
Update src/RecursiveStagesService.php
mfendeksilverstripe Apr 6, 2021
97d1ac6
PR fixes.
mfendeksilverstripe Apr 6, 2021
d2efe5a
PR fixes.
mfendeksilverstripe Oct 16, 2023
d6490ce
PR fixes.
mfendeksilverstripe Oct 18, 2023
76568ac
PR fixes.
mfendeksilverstripe Oct 19, 2023
5ed82fe
PR fixes.
mfendeksilverstripe Oct 19, 2023
f21edce
PR fixes.
mfendeksilverstripe Oct 19, 2023
7eddb6b
Apply suggestions from code review
mfendeksilverstripe Oct 30, 2023
79bfcc4
Merge pull request #328 from silverstripe-terraformers/feature/stages…
GuySartorelli Oct 30, 2023
6a15edb
Merge branch '2.1' into 2
github-actions[bot] Nov 3, 2023
044bdb0
ENH add CAN_DEV_BUILD to non_live_permissions
andrewandante Nov 3, 2023
4d38781
API Deprecate Versions() having parameter
emteknetnz Nov 5, 2023
cccdb23
Merge pull request #425 from creative-commoners/pulls/2.1/deprecate-h…
GuySartorelli Nov 5, 2023
2f335f5
Merge pull request #426 from andrewandante/ENH/add_CAN_DEV_BUILD_perm…
GuySartorelli Nov 10, 2023
dba1bbd
Merge branch '2.1' into 2
github-actions[bot] Nov 13, 2023
1e73253
ENH Respect new has_one config (#427)
GuySartorelli Dec 12, 2023
2d72c77
Merge branch '2.1' into 2
github-actions[bot] Dec 15, 2023
da4dac1
MNT Run module-standardiser (#430)
GuySartorelli Dec 21, 2023
96736c2
ENH Add generic types (#431)
GuySartorelli Jan 19, 2024
0e9ba51
MNT Run module-standardiser (#433)
GuySartorelli Feb 2, 2024
da1ba52
TLN Update translations (#434)
GuySartorelli Feb 6, 2024
7fc18fc
Merge branch '2.1' into 2
github-actions[bot] Feb 9, 2024
3065c13
properly encode X-Status
lekoala Feb 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Blank templates are for use by maintainers only! If you aren't a maintainer, please go back and pick one of the issue templates. -->
72 changes: 72 additions & 0 deletions .github/ISSUE_TEMPLATE/1_bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: 🪳 Bug Report
description: Tell us if something isn't working the way it's supposed to

body:
- type: markdown
attributes:
value: |
We strongly encourage you to [submit a pull request](https://docs.silverstripe.org/en/contributing/code/) which fixes the issue.
Bug reports which are accompanied with a pull request are a lot more likely to be resolved quickly.
- type: input
id: affected-versions
attributes:
label: Module version(s) affected
description: |
What version of _this module_ have you reproduced this bug on?
Run `composer info` to see the specific version of each module installed in your project.
If you don't have access to that, check inside the help menu in the bottom left of the CMS.
placeholder: x.y.z
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of the problem
validations:
required: true
- type: textarea
id: how-to-reproduce
attributes:
label: How to reproduce
description: |
⚠️ This is the most important part of the report ⚠️
Without a way to easily reproduce your issue, there is little chance we will be able to help you and work on a fix.
- Please, take the time to show us some code and/or configuration that is needed for others to reproduce the problem easily.
- If the bug is too complex to reproduce with some short code samples, please reproduce it in a public repository and provide a link to the repository along with steps for setting up and reproducing the bug using that repository.
- If part of the bug includes an error or exception, please provide a full stack trace.
- If any user interaction is required to reproduce the bug, please add an ordered list of steps that are required to reproduce it.
- Be as clear as you can, but don't miss any steps out. Simply saying "create a page" is less useful than guiding us through the steps you're taking to create a page, for example.
placeholder: |

#### Code sample
```php

```

#### Reproduction steps
1.
validations:
required: true
- type: textarea
id: possible-solution
attributes:
label: Possible Solution
description: |
*Optional: only if you have suggestions on a fix/reason for the bug*
Please consider [submitting a pull request](https://docs.silverstripe.org/en/contributing/code/) with your solution! It helps get faster feedback and greatly increases the chance of the bug being fixed.
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: "*Optional: any other context about the problem: log messages, screenshots, etc.*"
- type: checkboxes
id: validations
attributes:
label: Validations
description: "Before submitting the issue, please make sure you do the following:"
options:
- label: Check that there isn't already an issue that reports the same bug
required: true
- label: Double check that your reproduction steps work in a fresh installation of [`silverstripe/installer`](https://github.com/silverstripe/silverstripe-installer) (with any code examples you've provided)
required: true
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/2_feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 🚀 Feature Request
description: Submit a feature request (but only if you're planning on implementing it)
body:
- type: markdown
attributes:
value: |
Please only submit feature requests if you plan on implementing the feature yourself.
See the [contributing code documentation](https://docs.silverstripe.org/en/contributing/code/#make-or-find-a-github-issue) for more guidelines about submitting feature requests.
- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of the new feature, and why it belongs in core
validations:
required: true
- type: textarea
id: more-info
attributes:
label: Additional context or points of discussion
description: |
*Optional: Any additional context, points of discussion, etc that might help validate and refine your idea*
- type: checkboxes
id: validations
attributes:
label: Validations
description: "Before submitting the issue, please confirm the following:"
options:
- label: You intend to implement the feature yourself
required: true
- label: You have read the [contributing guide](https://docs.silverstripe.org/en/contributing/code/)
required: true
- label: You strongly believe this feature should be in core, rather than being its own community module
required: true
- label: You have checked for existing issues or pull requests related to this feature (and didn't find any)
required: true
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Security Vulnerability
url: https://docs.silverstripe.org/en/contributing/issues_and_bugs/#reporting-security-issues
about: ⚠️ We do not use GitHub issues to track security vulnerability reports. Click "open" on the right to see how to report security vulnerabilities.
- name: Support Question
url: https://www.silverstripe.org/community/
about: We use GitHub issues only to discuss bugs and new features. For support questions, please use one of the support options available in our community channels.
39 changes: 39 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
Thanks for contributing, you're awesome! ⭐

Please read https://docs.silverstripe.org/en/contributing/code/ if you haven't contributed to this project recently.
-->
## Description
<!--
Please describe expected and observed behaviour, and what you're fixing.
For visual fixes, please include tested browsers and screenshots.
-->

## Manual testing steps
<!--
Include any manual testing steps here which a reviewer can perform to validate your pull request works correctly.
Note that this DOES NOT replace unit or end-to-end tests.
-->

## Issues
<!--
List all issues here that this pull request fixes/resolves.
If there is no issue already, create a new one! You must link your pull request to at least one issue.
-->
- #

## Pull request checklist
<!--
PLEASE check each of these to ensure you have done everything you need to do!
If there's something in this list you need help with, please ask so that we can assist you.
-->
- [ ] The target branch is correct
- See [picking the right version](https://docs.silverstripe.org/en/contributing/code/#picking-the-right-version)
- [ ] All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
- Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
- [ ] The commit messages follow our [commit message guidelines](https://docs.silverstripe.org/en/contributing/code/#commit-messages)
- [ ] The PR follows our [contribution guidelines](https://docs.silverstripe.org/en/contributing/code/)
- [ ] Code changes follow our [coding conventions](https://docs.silverstripe.org/en/contributing/coding_conventions/)
- [ ] This change is covered with tests (or tests aren't necessary for this change)
- [ ] Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
- [ ] CI is green
4 changes: 4 additions & 0 deletions _config/versionedownership.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Name: versionedownership
SilverStripe\ORM\DataObject:
extensions:
RecursivePublishable: SilverStripe\Versioned\RecursivePublishable

SilverStripe\Core\Injector\Injector:
SilverStripe\Versioned\RecursiveStagesInterface:
class: SilverStripe\Versioned\RecursiveStagesService
---
Name: versionedownership-admin
OnlyIf:
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
],
"require": {
"php": "^8.1",
"silverstripe/framework": "^5",
"silverstripe/framework": "^5.2",
"symfony/cache": "^6.1",
"silverstripe/vendor-plugin": "^2"
},
"require-dev": {
"silverstripe/recipe-testing": "^3",
"silverstripe/graphql": "^5",
"squizlabs/php_codesniffer": "^3.7"
"squizlabs/php_codesniffer": "^3.7",
"silverstripe/standards": "^1",
"phpstan/extension-installer": "^1.3"
},
"autoload": {
"psr-4": {
Expand All @@ -44,4 +46,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parameters:
paths:
- src
9 changes: 0 additions & 9 deletions src/ChangeSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public function publish($isSynced = false)

DB::get_conn()->withTransaction(function () {
foreach ($this->Changes() as $change) {
/** @var ChangeSetItem $change */
$change->publish();
}

Expand All @@ -146,7 +145,6 @@ public function publish($isSynced = false)
// This is done as a safer alternative to deleting records on live that
// are deleted on stage.
foreach ($this->Changes() as $change) {
/** @var ChangeSetItem $change */
$change->unlinkDisownedObjects();
}

Expand Down Expand Up @@ -265,14 +263,12 @@ protected function calculateImplicit()
/** @var string[][] $references List of which explicit items reference each thing in referenced */
$references = [];

/** @var ChangeSetItem $item */
foreach ($this->Changes()->filter(['Added' => ChangeSetItem::EXPLICITLY]) as $item) {
$explicitKey = $this->implicitKey($item);
$explicit[$explicitKey] = true;

foreach ($item->findReferenced() as $referee) {
try {
/** @var DataObject $referee */
$key = $this->implicitKey($referee);

$referenced[$key] = [
Expand Down Expand Up @@ -324,7 +320,6 @@ public function sync()
$implicit = $this->calculateImplicit();

// Adjust the existing implicit ChangeSetItems for this ChangeSet
/** @var ChangeSetItem $item */
foreach ($this->Changes()->filter(['Added' => ChangeSetItem::IMPLICITLY]) as $item) {
$objectKey = $this->implicitKey($item);

Expand Down Expand Up @@ -410,7 +405,6 @@ public function canPublish($member = null)
}
// Check all explicitly added items
foreach ($this->Changes()->filter(['Added' => ChangeSetItem::EXPLICITLY]) as $change) {
/** @var ChangeSetItem $change */
if (!$change->canPublish($member)) {
return false;
}
Expand All @@ -427,7 +421,6 @@ public function canPublish($member = null)
public function hasChanges()
{
// All changes must be publishable
/** @var ChangeSetItem $change */
foreach ($this->Changes() as $change) {
if ($change->hasChange()) {
return true;
Expand All @@ -446,7 +439,6 @@ public function canRevert($member = null)
{
// All changes must be publishable
foreach ($this->Changes() as $change) {
/** @var ChangeSetItem $change */
if (!$change->canRevert($member)) {
return false;
}
Expand Down Expand Up @@ -528,7 +520,6 @@ public function getCMSFields()
public function getDetails()
{
// Check each change item
/** @var ChangeSetItem $change */
$total = 0;
$withChanges = 0;
foreach ($this->Changes() as $change) {
Expand Down
4 changes: 1 addition & 3 deletions src/ChangeSetItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ protected function getObjectLatestVersion()
/**
* Get all implicit objects for this change
*
* @return SS_List
* @return SS_List<DataObject>
*/
public function findReferenced()
{
Expand All @@ -231,7 +231,6 @@ public function findReferenced()
}

// If changed on stage, include all owned objects for publish
/** @var DataObject|RecursivePublishable $draftRecord */
$draftRecord = $this->getObjectInStage(Versioned::DRAFT);
if (!$draftRecord) {
return ArrayList::create();
Expand Down Expand Up @@ -375,7 +374,6 @@ public function canRevert($member)
}

// Just get the best version as this object may not even exist on either stage anymore.
/** @var Versioned|DataObject $object */
$object = $this->getObjectLatestVersion();
if (!$object) {
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/DataDifferencer.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ public function diffedData()
// Using relation name instead of database column name, because of FileField etc.
$setField = is_a($relSpec, Image::class, true) ? $relName : $relField;
$toTitle = '';
/** @var DataObject $relObjTo */
$relObjTo = null;
if ($this->toRecord->hasMethod($relName)) {
/** @var DataObject $relObjTo */
$relObjTo = $this->toRecord->$relName();
$toTitle = $this->getObjectDisplay($relObjTo);
}
Expand Down Expand Up @@ -204,6 +204,7 @@ protected function getObjectDisplay($object = null)
* - Diff: An HTML diff showing the changes
* - From: The older version of the field
* - To: The newer version of the field
* @return ArrayList<ArrayData>
*/
public function ChangedFields()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Dev/VersionedTestSessionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Decorates TestSession object to update get / post requests with versioned querystring arguments.
*
* @property TestSession $owner
* @extends VersionedStateExtension<TestSession>
*/
class VersionedTestSessionExtension extends VersionedStateExtension
{
Expand Down
5 changes: 3 additions & 2 deletions src/GraphQL/Resolvers/VersionFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ public function applyToReadingState(array $versioningArgs)
}

/**
* @param DataList $list
* @template T of DataObject
* @param DataList<T> $list
* @param array $versioningArgs
* @throws InvalidArgumentException
* @return DataList
* @return DataList<T>
*/
public function applyToList(DataList $list, array $versioningArgs): DataList
{
Expand Down
5 changes: 3 additions & 2 deletions src/GraphQL/Resolvers/VersionedResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ private static function getVersionsList(DataObject $object)
}

/**
* @param DataList $list
* @template T of DataObject
* @param DataList<T> $list
* @param array $args
* @param array $context
* @param ResolveInfo $info
* @return DataList
* @return DataList<T>
* @see VersionedRead
*/
public static function resolveVersionedRead(DataList $list, array $args, array $context, ResolveInfo $info)
Expand Down
Loading
Loading