Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ datadog-setup.php

# Key files
*.key

*.sql
*.sql.gz

6 changes: 3 additions & 3 deletions .tugboat/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ services:
- composer va:theme:compile
- composer va:web:install

- curl --remote-name https://dsva-vagov-prod-cms-backup-sanitized.s3-us-gov-west-1.amazonaws.com/files/cms-prod-files-latest.tgz
- tar --extract --gunzip --file cms-prod-files-latest.tgz --directory "${DOCROOT}/sites/default/files/"
- rm cms-prod-files-latest.tgz
# - curl --remote-name https://dsva-vagov-prod-cms-backup-sanitized.s3-us-gov-west-1.amazonaws.com/files/cms-prod-files-latest.tgz
# - tar --extract --gunzip --file cms-prod-files-latest.tgz --directory "${DOCROOT}/sites/default/files/"
# - rm cms-prod-files-latest.tgz

# Set file permissions such that Drupal will not complain
- chgrp -R www-data "${DOCROOT}/sites/default/files"
Expand Down
14 changes: 9 additions & 5 deletions docroot/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@
Require all denied
</Files>

#### Gung: not working on Ubuntu Apache. ####
# If requested file or directory exists, skip the next rule.
RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/$1 -d
RewriteRule (.*) - [S=1]
# RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR]
# RewriteCond %{DOCUMENT_ROOT}/$1 -d
# RewriteRule (.*) - [S=1]


#### Gung: not working on Ubuntu Apache. ####
# If requested file exists in /static, rewrite to /static
# Using only files here ensures the paths still resolve to Drupal and not to the index.html files.
RewriteCond %{DOCUMENT_ROOT}/static/$1 -f
RewriteRule (.*) /static/$1 [L]
# RewriteCond %{DOCUMENT_ROOT}/static/$1 -f
# RewriteRule (.*) /static/$1 [L]


# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$">
Expand Down
6 changes: 6 additions & 0 deletions docroot/modules/custom/va_gov_backend/va_gov_backend.module
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,12 @@ function _va_gov_backend_gtm_settings() {
if ($uid > 0) {
$sections['userId'] = Crypt::hashBase64((string) $uid);
$section_scheme = \Drupal::entityTypeManager()->getStorage('access_scheme')->load('section');

// Gung: fix the fatal error of TypeError: getUserSections().
if (!$section_scheme instanceof AccessSchemeInterface) {
return $sections;
}

$user_sections = \Drupal::service('workbench_access.user_section_storage')->getUserSections($section_scheme, $user);
if (in_array('administration', $user_sections)) {
$sections['userSections'] = 'all';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ services:
class: GuzzleHttp\HandlerStack
factory: ['Drupal\va_gov_build_trigger\Service\MiddlewareFactory', 'createHandlerStack']
arguments: ['@logger.channel.va_gov_build_trigger']
va_gov.build_trigger.environment_discovery:
class: Drupal\va_gov_build_trigger\Environment\EnvironmentDiscovery
arguments: [ '@plugin.manager.va_gov.environment' ]
va_gov_build_trigger.build_frontend:
class: Drupal\va_gov_build_trigger\Service\BuildFrontend
arguments: ['@messenger', '@logger.factory', '@va_gov.build_trigger.web_build_status', '@va_gov.build_trigger.environment_discovery', '@current_user']
Expand All @@ -35,9 +38,6 @@ services:
arguments: ['@state']
va_gov.build_trigger.web_build_link_checker:
class: Drupal\va_gov_build_trigger\WebBuildBrokenLinkChecker
va_gov.build_trigger.environment_discovery:
class: Drupal\va_gov_build_trigger\Environment\EnvironmentDiscovery
arguments: [ '@plugin.manager.va_gov.environment' ]
plugin.manager.va_gov.environment:
class: Drupal\va_gov_build_trigger\Environment\EnvironmentManager
parent: default_plugin_manager
Expand Down
12 changes: 8 additions & 4 deletions docroot/modules/custom/va_gov_migrate/va_gov_migrate.install
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,14 @@ function _va_gov_migrate_add_nodes_to_migrate_map(string $migration_name, array
// Table does not exist yet so make it.
$migration = \Drupal::getContainer()->get('plugin.manager.migration')->createInstance($migration_name);
// Migrate just 1 item so the migrate map gets built.
$executable = new MigrateExecutable($migration, new MigrateMessage(), ['limit' => 1]);
$executable->import();
// Roll it back so it does not exist.
$executable->rollback();

if($migration instanceof MigrationInterface) {

$executable = new MigrateExecutable($migration, new MigrateMessage(), ['limit' => 1]);
$executable->import();
// Roll it back so it does not exist.
$executable->rollback();
}
}

foreach ($nodes_to_be_migratized as $values) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
services:
va_gov_workflow.flagger:
class: Drupal\va_gov_workflow\Service\Flagger
arguments: ['@flag', '@entity_type.manager']
va_gov_workflow.entity_event_subscriber:
class: Drupal\va_gov_workflow\EventSubscriber\EntityEventSubscriber
arguments: [ '@va_gov_user.user_perms', '@va_gov_workflow.workflow_content_control', '@va_gov_workflow.flagger']
tags:
- { name: event_subscriber }
va_gov_workflow.flagger:
class: Drupal\va_gov_workflow\Service\Flagger
arguments: ['@flag', '@entity_type.manager']
va_gov_workflow.workflow_content_control:
class: Drupal\va_gov_workflow\Service\WorkflowContentControl
arguments: ['@va_gov_user.user_perms']
9 changes: 8 additions & 1 deletion docroot/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'password' => getenv('CMS_MARIADB_PASSWORD') ?: 'drupal8',
'prefix' => '',
// 'database' is the default DB container for Lando (local).
'host' => getenv('CMS_MARIADB_HOST') ?: 'database',
'host' => getenv('CMS_MARIADB_HOST') ?: 'localhost',
'port' => 3306,
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
);
Expand Down Expand Up @@ -248,3 +248,10 @@
$settings['container_yamls'][] = $app_root . '/' . $site_path . '/../default/services/services.memcache.yml';
$settings['memcache']['persistent'] = 'drupal';
}

$settings['trusted_host_patterns'] = [
'^loalhost$',
'^drupal-react\.test$',
];

ini_set('memory_limit', '512M');
28 changes: 28 additions & 0 deletions tests/behavioral/cypress/integration/common/i_create_a_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,34 @@ const creators = {
cy.findAllByLabelText('Parent link').select('-- CMS Knowledge Base (disabled)', { force: true });
return cy.get('form.node-form').find('input#edit-submit').click();
},
event: () => {
cy.visit('/node/add/event');
cy.scrollTo('top');
cy.findAllByLabelText('Name').type('[Test Data] ' + faker.lorem.sentence(), { force: true });
cy.get('#edit-field-datetime-range-timezone-0-value-date').type('2023-12-05', { force: true });
cy.get('#edit-field-datetime-range-timezone-0-value-time').type('12:00', { force: true });
cy.findAllByLabelText('Where should the event be listed?').select('VA Alaska health care: Events', { force: true });
cy.findAllByLabelText('Street address').type(faker.address.streetAddress(), { force: true });
cy.findAllByLabelText('City').type(faker.address.city(), { force: true });
cy.findAllByLabelText('State').select('Alabama', { force: true });
cy.findAllByLabelText('Section').select('VACO', { force: true });
cy.scrollToSelector('#edit-field-media-open-button');
cy.get('#edit-field-media-open-button').click({ force: true });
cy.get('.dropzone', {
timeout: 10000,
});
cy.get('.dropzone').attachFile('images/polygon_image.png', {
subjectType: 'drag-n-drop',
});
cy.wait(1000);
cy.findAllByLabelText('Alternative text').type(faker.lorem.sentence(), { force: true });
cy.get('[data-drupal-selector="edit-media-0-fields-field-owner"]').select('VACO', { force: true });
cy.get('button').contains('Save and insert').click({ force: true });
cy.get('div.media-library-item[data-drupal-selector="edit-field-media-selection-0"]', {
timeout: 15000,
});
return cy.get('form.node-form').find('input#edit-submit').click();
},
health_care_region_detail_page: () => {
cy.visit('/node/add/health_care_region_detail_page');
cy.scrollTo('top');
Expand Down
9 changes: 9 additions & 0 deletions tests/behavioral/cypress/integration/common/i_should_see.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ Then('I should not see an element with the xpath {string}', (expression) => cy.x

Then('I should see xpath {string}', (expression) => cy.xpath(expression).should('exist'));
Then('I should not see xpath {string}', (expression) => cy.xpath(expression).should('not.exist'));

Then('I should see an image with the selector {string}', (selector) => {
cy.get(selector)
.should('be.visible')
.and(($img) => {
expect($img[0].naturalWidth).to.be.greaterThan(0);
expect($img[0].naturalHeight).to.be.greaterThan(0);
});
});
11 changes: 11 additions & 0 deletions tests/behavioral/cypress/integration/file_upload.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@file_upload
Feature: Files can be uploaded and attached to nodes successfully
In order to reliably and predictably create content
As anybody involved in the project
I need to be able to upload and attach files to nodes.

Scenario: We should be able to attach files to event nodes.
Given I am logged in as a user with the "content_admin" role
When I create a "event" node
Then I should see "polygon_image.png"
And I should see an image with the selector 'div.field--name-image a img'