Skip to content

Commit

Permalink
Merge pull request #3294 from CityOfBoston/develop
Browse files Browse the repository at this point in the history
(stage) ModState Log Update, MNL Update, Drupal Maintenance
  • Loading branch information
davidrkupton authored Jan 11, 2024
2 parents 1ac64f0 + 140a6db commit 178cfd6
Show file tree
Hide file tree
Showing 14 changed files with 1,532 additions and 547 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@
"drupal/console-extend-plugin": false,
"oomphinc/composer-installers-extender": true,
"simplesamlphp/composer-module-installer": false,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"php-http/discovery": true
}
},
"autoload": {
Expand Down
1,813 changes: 1,326 additions & 487 deletions composer.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ public function beginUpdateImport(string $operation = "") {
case "import":
$payload = $this->request->getCurrentRequest()->getContent();
$payload = json_decode(strip_tags($payload), TRUE);

if (empty($payload)) {
return new CacheableJsonResponse([
'status' => 'Require a payload.',
'response' => 'error'
], 400);
}

try {
$this->queuePayload("mnl_${operation}", $payload);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@ class MNLProcessImport extends QueueWorkerBase {
*
* @var array
*/
private $stats = [];
private $stats = [
"cache" => 0,
"pre-entities" => 0,
"post-entities" => 0,
"processed" => 0,
"updated" => 0,
"inserted" => 0,
"unchanged" => 0,
"baddata" => 0,
"duplicateSAM" => 0,
"duplicateNID" => 0,
"queue" => NULL,
"starttime" => NULL,
];

/**
* Property indicating if a purger invalidation queue exists
Expand Down Expand Up @@ -67,6 +80,8 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition

// If the queue is not empty, then prepare to process the queue
if ($this->queue->numberOfItems() > 0) {
$this->stats["queue"] = $this->queue->numberOfItems();
$this->stats["starttime"] = strtotime("now");

if ($this->settings->get("{$plugin_id}_import_status") == MnlUtilities::MNL_IMPORT_READY) {

Expand All @@ -86,20 +101,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
->condition("n.type", "neighborhood_lookup");
$query->addExpression("count(n.nid)", "count");
$result = $query->execute()->fetch();
$this->stats = [
"queue" => $this->queue->numberOfItems(),
"cache" => 0,
"pre-entities" => $result ? $result->count : 0,
"post-entities" => 0,
"processed" => 0,
"updated" => 0,
"inserted" => 0,
"unchanged" => 0,
"baddata" => 0,
"duplicateSAM" => 0,
"duplicateNID" => 0,
"starttime" => strtotime("now"),
];
$this->stats["pre-entities"] = $result ? $result->count : 0;
$this->settings->set('tmp_import', json_encode($this->stats));
$this->settings->save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@ class MNLProcessUpdate extends QueueWorkerBase {
*
* @var array
*/
private $stats = [];
private $stats = [
"cache" => 0,
"pre-entities" => 0,
"post-entities" => 0,
"processed" => 0,
"updated" => 0,
"inserted" => 0,
"unchanged" => 0,
"baddata" => 0,
"duplicateSAM" => 0,
"duplicateNID" => 0,
"queue" => NULL,
"starttime" => NULL,
];

/**
* Property indicating if a purger invalidation queue exists
Expand Down Expand Up @@ -68,6 +81,9 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
// If the queue is not empty, then prepare to process the queue
if ($this->queue->numberOfItems() > 0) {

$this->stats["queue"] = $this->queue->numberOfItems();
$this->stats["starttime"] = strtotime("now");

if ($this->settings->get("{$plugin_id}_import_status") == MnlUtilities::MNL_IMPORT_READY) {

if ($this->settings->get("mnl_import_import_status") == MnlUtilities::MNL_IMPORT_PROCESSING) {
Expand All @@ -86,20 +102,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
->condition("n.type", "neighborhood_lookup");
$query->addExpression("count(n.nid)", "count");
$result = $query->execute()->fetch();
$this->stats = [
"queue" => $this->queue->numberOfItems(),
"cache" => 0,
"pre-entities" => $result ? $result->count : 0,
"post-entities" => 0,
"processed" => 0,
"updated" => 0,
"inserted" => 0,
"unchanged" => 0,
"baddata" => 0,
"duplicateSAM" => 0,
"duplicateNID" => 0,
"starttime" => strtotime("now"),
];
$this->stats["pre-entities"] = $result ? $result->count : 0;
$this->settings->set('tmp_update', json_encode($this->stats));
$this->settings->save();
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const configProps = {
"cards": {
"polling_information": {
"display": true,
// DU DIG-2904 & DIG-3820
"redistricting": false,
},
"mayor": {
"display": true,
Expand All @@ -20,7 +22,7 @@ const configProps = {
"url": "/departments/mayors-office",
},
"city_councilor": {
"display": false, // DU DIG-2904 09/2023
"display": true, // DU DIG-2904 & DIG-3820
},
"neighborhood_contact": {
"display": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Representation extends React.Component {
];
}
let contentPollingArray;
let contentPolingArrayRedistrict;
if (this.props.ward == null || this.props.precinct == null) {
contentPollingArray = [
{
Expand All @@ -70,27 +71,28 @@ class Representation extends React.Component {
heading: this.props.voting_location,
content: this.props.voting_address
},*/
// DU DIG-2904 09/2023
// temp remove Polling information adn replace with a message.
// {
// heading: "Ward",
// content: this.props.ward
// },
// {
// heading: "Precinct",
// content: this.props.precinct
// },
// {
// content: <div><a href={"https://www.sec.state.ma.us/VoterRegistrationSearch/MyVoterRegStatus.aspx"} target="_blank" rel="noreferrer" className="mnl-link">Check the state's website</a> to find out if you are registered to vote, and where your polling location is.</div>
// },
//
// {
// content: <ul class="ul"><li><a href={"https://boston.maps.arcgis.com/apps/webappviewer/index.html?id=72a95777f7e842eaae3671c0d67acce0&find=" + this.props.sam_id} target="_blank" rel="noreferrer" className="mnl-link">Explore the City's wards and precincts</a></li></ul>
// }
{
content: <div>Due to redistricting, your District City Councilor may change as of January 1, 2024. To find out which race you are voting for in the 2023 Municipal Election, <a href={"/departments/elections/find-out-who-you-are-voting-2023-district-city-council-race"}>please refer to our informational website.</a></div>
heading: "Ward",
content: this.props.ward
},
{
heading: "Precinct",
content: this.props.precinct
},
{
content: <div><a href={"https://www.sec.state.ma.us/VoterRegistrationSearch/MyVoterRegStatus.aspx"} target="_blank" rel="noreferrer" className="mnl-link">Check the state's website</a> to find out if you are registered to vote, and where your polling location is.</div>
},

{
content: <ul class="ul"><li><a href={"https://boston.maps.arcgis.com/apps/webappviewer/index.html?id=72a95777f7e842eaae3671c0d67acce0&find=" + this.props.sam_id} target="_blank" rel="noreferrer" className="mnl-link">Explore the City's wards and precincts</a></li></ul>
}
];
// DU DIG-2904 & DIG-3820
contentPolingArrayRedistrict = [
{
content: <div>Due to redistricting, your District City Councilor may change as of January 1, 2024. To find out which race you are voting for in the 2023 Municipal Election, <a href={"/departments/elections/find-out-who-you-are-voting-2023-district-city-council-race"}>please refer to our informational website.</a></div>
}
]

}
let contentEarlyVotingArray;
Expand Down Expand Up @@ -146,14 +148,19 @@ class Representation extends React.Component {
// Content for Councilors at Large
const contentCouncilorsatLargeReps = [
{
// DU DIG-2904 & DIG-3820
content: (
<div class="councilor-at-large">
<div class="intro">The four at-large councilors that represent the entire city:</div>
<div>
<a href={"/departments/city-council/michael-flaherty"} className={"mnl-link link_underline"}>Michael Flaherty</a>
<a href={"/departments/city-council/ruthzee-louijeune"} className={"mnl-link link_underline"}>Ruthzee Louijeune</a>
<a href={"/departments/city-council/julia-mejia"} className={"mnl-link link_underline"}>Julia Mejia</a>
<a href={"/departments/city-council/erin-murphy"} className={"mnl-link link_underline"}>Erin Murphy</a>
<a href={'/departments/city-council/ruthzee-louijeune'}
className={'mnl-link link_underline'}>Ruthzee Louijeune</a>
<a href={'/departments/city-council/julia-mejia'}
className={'mnl-link link_underline'}>Julia Mejia</a>
<a href={'/departments/city-council/erin-murphy'}
className={'mnl-link link_underline'}>Erin Murphy</a>
<a href={'/departments/city-council/henry-santana'}
className={'mnl-link link_underline'}>Henry Santana</a>
</div>
</div>
)
Expand All @@ -174,12 +181,12 @@ class Representation extends React.Component {
{/* Polling Info */}
{(configCards.polling_information.display) ? (
<MnlCard
// DU DIG-2904 title={"Your Polling Information"}
title={"City Council and Voting Information"}
// DU DIG-2904 & DIG-3820
title={configCards.polling_information.redistricting ? "City Council and Voting Information": "Your Polling Information"}
image_header={
configProps.globals.pathImage+"voting_ballot.svg"
}
content_array={contentPollingArray}
content_array={configCards.polling_information.redistricting ? contentPolingArrayRedistrict :contentPollingArray}
/>
) : null}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"name": "cob_webapps",
"version": "1.0.0",
"dependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "7.9.0",
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
"@babel/plugin-transform-arrow-functions": "^7.8.3",
"@babel/plugin-transform-async-to-generator": "^7.8.3",
"@babel/plugin-transform-block-scoping": "^7.8.3",
"@babel/plugin-transform-classes": "^7.9.5",
"@babel/plugin-transform-destructuring": "^7.9.5",
"@babel/plugin-transform-parameters": "^7.9.5",
"@babel/plugin-transform-shorthand-properties": "^7.8.3",
"@babel/plugin-transform-spread": "^7.8.3",
"@babel/plugin-transform-template-literals": "^7.8.3",
"@babel/polyfill": "^7.8.7",
"@babel/preset-env": "7.9.0",
"@babel/preset-react": "^7.8.3",
"@babel/register": "^7.8.6",
"@react-mock/localstorage": "^0.1.2",
"@storybook/addon-actions": "^5.3.14",
"@storybook/addon-docs": "^5.3.17",
"@storybook/addon-links": "^5.3.14",
"@storybook/addons": "^5.3.14",
"@storybook/react": "^5.3.14",
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^10.0.0",
"autoprefixer": "^9.7.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.6",
"babel-plugin-syntax-async-functions": "^6.13.0",
"bootstrap": "^4.4.1",
"change-case": "^4.1.1",
"codecov": "^3.7.0",
"concurrently": "^3.5.1",
"copy-webpack-plugin": "^5.1.1",
"core-js": "^3.6.5",
"css-loader": "^3.4.2",
"cssnano": "^4.1.10",
"dotenv": "^8.2.0",
"dotenv-webpack": "^1.7.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-hughx": "^0.0.3",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-react": "^7.19.0",
"glob": "^7.1.6",
"gulp": "^4.0.0",
"gulp-babel": "^8.0.0",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.6.1",
"gulp-postcss": "^8.0.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.0.2",
"gulp-sourcemaps": "^2.6.5",
"gulp-uglify": "^3.0.2",
"html-webpack-plugin": "^3.2.0",
"jest": "^25.4.0",
"moment": "^2.24.0",
"msw": "^0.19.5",
"ncp": "^2.0.0",
"node-fetch": "^2.6.0",
"node-sass": "^4.13.1",
"postcss-loader": "^3.0.0",
"prop-types": "^15.7.2",
"raw-loader": "^4.0.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-number-format": "^4.4.1",
"react-router-dom": "^5.1.2",
"react-transition-group": "^4.3.0",
"regenerator-runtime": "^0.13.5",
"replace-in-file": "^5.0.2",
"rimraf": "^3.0.2",
"rucksack-css": "^1.0.2",
"sass-loader": "^8.0.2",
"sass-rem": "^2.0.1",
"string-replace-loader": "^2.3.0",
"style-loader": "^1.1.3",
"stylus": "^0.54.7",
"stylus-loader": "^3.0.2",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"webpack-manifest-plugin": "^2.2.0",
"webpack-merge": "^4.2.2",
"whatwg-fetch": "^3.0.0",
"xxhash": "^0.3.0"
},
"scripts": {
"dev": "concurrently \"npx http-server -p${WEBAPP_PORT} -c-1 --no-dotfiles\"",
"start-container": "concurrently \"npm run dev\" \"cd /app/patterns && npm run dev\""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ metrolist:
- core/drupalSettings

my_neighborhood:
version: my_neighborhood.2023.09.06
version: my_neighborhood.1704913367566.09.06
js:
#MNL REACT application and config
apps/my_neighborhood/dist/index.js: {attributes: {type: text/javascript}}
Expand Down
5 changes: 5 additions & 0 deletions docroot/modules/custom/bos_core/bos_core.libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
moderation_sidebar:
js:
js/bos_core_mod_sidebar.js: {attributes: {id: "mod_sidebar_code"}}
dependencies:
- core/jquery
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,7 @@ function bos_core_moderation_sidebar_alter(array &$build, EntityInterface $entit
$build["actions"]["quick_draft_form"]["submit_for_review"]["#attributes"]["class"][] = "button--review clearfix";
}

$build["actions"]["primary"]["quick_draft_form"]["revision_log_toggle"]["#value"] = TRUE;
$build["actions"]["primary"]["quick_draft_form"]["revision_log_toggle"]["#checked"] = TRUE;
$build["actions"]["primary"]["quick_draft_form"]["#attached"]["library"] = ['bos_core/moderation_sidebar'];
}
19 changes: 19 additions & 0 deletions docroot/modules/custom/bos_core/js/bos_core_mod_sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @file
* A JavaScript file for moderation sidebar textarea.
*/
(function ($, Drupal, window, document) {
$(document).on('click', '.moderation-sidebar-quick-transition-form input.button', chkSubmit);

function chkSubmit() {
var msg = $('.moderation-sidebar-revision-log');
if (msg.val() != null && msg.val() != '') {
$('.moderation-sidebar-revision-log').css('border', 'transparent');
}
else {
$('.moderation-sidebar-revision-log').css('border', '3px solid red');
$('.moderation-sidebar-revision-log').attr('placeholder','Please provide a revision log message.')
return false;
}
}
})(jQuery, Drupal, this, this.document);
File renamed without changes.

0 comments on commit 178cfd6

Please sign in to comment.