Skip to content

Commit

Permalink
Merge branch '6.2' into 6
Browse files Browse the repository at this point in the history
# Conflicts:
#	yarn.lock
  • Loading branch information
GuySartorelli committed Jun 20, 2024
2 parents 96e8f39 + 8831bdb commit 6a9c1f1
Show file tree
Hide file tree
Showing 11 changed files with 466 additions and 872 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/add-prs-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Add new PRs to github project

on:
pull_request_target:
types:
- opened
- ready_for_review

permissions: {}

jobs:
addprtoproject:
name: Add PR to GitHub Project
# Only run on the silverstripe account
if: github.repository_owner == 'silverstripe'
runs-on: ubuntu-latest
steps:
- name: Add PR to github project
uses: silverstripe/gha-add-pr-to-project@v1
with:
app_id: ${{ vars.PROJECT_PERMISSIONS_APP_ID }}
private_key: ${{ secrets.PROJECT_PERMISSIONS_APP_PRIVATE_KEY }}
2 changes: 0 additions & 2 deletions .stylelintignore

This file was deleted.

2 changes: 1 addition & 1 deletion client/dist/styles/userforms-cms.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/src/styles/userforms-cms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
border-bottom: 1px solid $border-color-light;
padding: 1rem;

& button.action {
button.action {
margin-bottom: 0;
}

Expand Down Expand Up @@ -197,7 +197,7 @@
align-items: center;

.icon {
&::before {
&:before {
font-size: 16px;
line-height: inherit;
margin-right: 6px;
Expand Down
8 changes: 4 additions & 4 deletions code/Control/UserDefinedFormAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public function getfoldergrouppermissions()
private static function updateFormSubmissionFolderPermissions()
{
// ensure the FormSubmissions folder is only accessible to Administrators
$formSubmissionsFolder = Folder::find(self::config()->get('form_submissions_folder'));
$formSubmissionsFolder = Folder::find(static::config()->get('form_submissions_folder'));
$formSubmissionsFolder->CanViewType = InheritedPermissions::ONLY_THESE_USERS;
$formSubmissionsFolder->ViewerGroups()->removeAll();
$formSubmissionsFolder->ViewerGroups()->add(Group::get_one(Group::class, ['"Code"' => 'administrators']));
Expand All @@ -314,16 +314,16 @@ private static function updateFormSubmissionFolderPermissions()
*/
public static function getFormSubmissionFolder(string $subFolder = null): ?Folder
{
$folderPath = self::config()->get('form_submissions_folder');
$folderPath = static::config()->get('form_submissions_folder');
if ($subFolder) {
$folderPath .= '/' . $subFolder;
}
$formSubmissionsFolderExists = !!Folder::find(self::config()->get('form_submissions_folder'));
$formSubmissionsFolderExists = !!Folder::find(static::config()->get('form_submissions_folder'));
$folder = Folder::find_or_make($folderPath);

// Set default permissions if this is the first time we create the form submission folder
if (!$formSubmissionsFolderExists) {
self::updateFormSubmissionFolderPermissions();
UserDefinedFormAdmin::updateFormSubmissionFolderPermissions();
// Make sure we return the folder with the latest permission
$folder = Folder::find($folderPath);
}
Expand Down
4 changes: 2 additions & 2 deletions code/Control/UserDefinedFormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class UserDefinedFormController extends PageController
/**
* Size that an uploaded file must not excede for it to be attached to an email
* Follows PHP "shorthand bytes" definition rules.
* @see self::parseByteSizeString()
* @see UserDefinedFormController::parseByteSizeString()
*
* @var int
* @config
Expand Down Expand Up @@ -314,7 +314,7 @@ public function process($data, $form)
}

$file = Versioned::withVersionedMode(function () use ($field, $form) {
$stage = Injector::inst()->get(self::class)->config()->get('file_upload_stage');
$stage = Injector::inst()->get(UserDefinedFormController::class)->config()->get('file_upload_stage');
Versioned::set_stage($stage);

$foldername = $field->getFormField()->getFolderName();
Expand Down
6 changes: 3 additions & 3 deletions code/Extension/UserFormFileExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class UserFormFileExtension extends DataExtension
public function updateTrackedFormUpload(&$value): void
{
$file = $this->owner;
if ($file->UserFormUpload != self::USER_FORM_UPLOAD_UNKNOWN) {
$value = $file->UserFormUpload == self::USER_FORM_UPLOAD_TRUE;
if ($file->UserFormUpload != UserFormFileExtension::USER_FORM_UPLOAD_UNKNOWN) {
$value = $file->UserFormUpload == UserFormFileExtension::USER_FORM_UPLOAD_TRUE;
return;
}
if ($file->ClassName == Folder::class) {
Expand All @@ -71,7 +71,7 @@ private function updateDB(bool $value): void
}
$tableName = Convert::raw2sql(DataObject::getSchema()->tableName(File::class));
$column = 'UserFormUpload';
$enumVal = $value ? self::USER_FORM_UPLOAD_TRUE : self::USER_FORM_UPLOAD_FALSE;
$enumVal = $value ? UserFormFileExtension::USER_FORM_UPLOAD_TRUE : UserFormFileExtension::USER_FORM_UPLOAD_FALSE;
SQLUpdate::create()
->setTable(sprintf('"%s"', $tableName))
->addWhere(['"ID" = ?' => [$this->owner->ID]])
Expand Down
8 changes: 4 additions & 4 deletions code/Model/EditableFormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ public function getCMSFields()
$fields->fieldByName('Root.Main')->setTitle(_t('SilverStripe\\CMS\\Model\\SiteTree.TABMAIN', 'Main'));

// Custom settings
if (!empty(self::$allowed_css)) {
if (!empty(EditableFormField::$allowed_css)) {
$cssList = [];
foreach (self::$allowed_css as $k => $v) {
foreach (EditableFormField::$allowed_css as $k => $v) {
if (!is_array($v)) {
$cssList[$k]=$v;
} elseif ($k === $this->ClassName) {
Expand Down Expand Up @@ -351,7 +351,7 @@ public function requireDefaultRecords()

// make sure to migrate the class across (prior to v5.x)
DB::query("UPDATE \"EditableFormField\" SET \"ParentClass\" = 'Page' WHERE \"ParentClass\" IS NULL");
if (self::has_extension(Versioned::class)) {
if (EditableFormField::has_extension(Versioned::class)) {
DB::query("UPDATE \"EditableFormField_Live\" SET \"ParentClass\" = 'Page' WHERE \"ParentClass\" IS NULL");
DB::query("UPDATE \"EditableFormField_Versions\" SET \"ParentClass\" = 'Page' WHERE \"ParentClass\" IS NULL");
}
Expand Down Expand Up @@ -602,7 +602,7 @@ public function setAllowedCss(array $allowed)
{
if (is_array($allowed)) {
foreach ($allowed as $k => $v) {
self::$allowed_css[$k] = (!is_null($v)) ? $v : $k;
EditableFormField::$allowed_css[$k] = (!is_null($v)) ? $v : $k;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions code/Model/EditableFormField/EditableOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class EditableOption extends DataObject
*/
public static function allow_empty_values()
{
return (bool) self::$allow_empty_values;
return (bool) EditableOption::$allow_empty_values;
}

/**
Expand All @@ -65,7 +65,7 @@ public static function allow_empty_values()
*/
public static function set_allow_empty_values($allow)
{
self::$allow_empty_values = (bool) $allow;
EditableOption::$allow_empty_values = (bool) $allow;
}

/**
Expand All @@ -77,7 +77,7 @@ public static function set_allow_empty_values($allow)
public function getValue()
{
$value = $this->getField('Value');
if (empty($value) && !self::allow_empty_values()) {
if (empty($value) && !EditableOption::allow_empty_values()) {
return $this->Title;
}
return $value;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lint": "yarn lint-js && yarn lint-sass",
"lint-js": "eslint client/src",
"lint-js-fix": "eslint client/src --fix",
"lint-sass": "stylelint **/client/src/**/*.scss"
"lint-sass": "stylelint client/src"
},
"repository": {
"type": "git",
Expand All @@ -37,7 +37,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@silverstripe/eslint-config": "^1.2.1",
"@silverstripe/eslint-config": "^1.3.0",
"@silverstripe/webpack-config": "^2.1.0",
"copy-webpack-plugin": "^11.0.0",
"webpack": "^5.74.0",
Expand Down
Loading

0 comments on commit 6a9c1f1

Please sign in to comment.