Skip to content

Commit

Permalink
Merge pull request #1517 from publishpress/release-4.0.0-rc
Browse files Browse the repository at this point in the history
Release 4.0.0 rc
  • Loading branch information
olatechpro authored Dec 20, 2023
2 parents 78a4b7f + 62f3722 commit 9fdd188
Show file tree
Hide file tree
Showing 19 changed files with 649 additions and 13,327 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ node_modules
builder.yml
builder.yml.dist
.editorconfig
/cache

!tests/_support/.gitkeep
tests/_support/*
Expand Down
2 changes: 1 addition & 1 deletion dev-workspace/build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

DOCKER_HOST_IP=$(php ./scripts/getip) docker compose -f docker/compose.yaml build
docker compose -f docker/compose.yaml build
2 changes: 1 addition & 1 deletion dev-workspace/build-push
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This command requires to be logged in on Docker Hub. Check `docker login --help` for more information.

DOCKER_HOST_IP=$(php ./scripts/getip) docker buildx build --platform linux/amd64,linux/arm64 --push -t publishpress/dev-workspace-terminal:planner-free-2 ./docker
docker buildx build --platform linux/amd64,linux/arm64 --push -t publishpress/dev-workspace-terminal:planner-free-2 ./docker
6 changes: 1 addition & 5 deletions dev-workspace/docker/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: devworkspace_planner_free
services:
terminal:
build: ./docker
build: ./
image: publishpress/dev-workspace-terminal:planner-free-2
command: ["zsh"]
stdin_open: true
Expand All @@ -17,7 +17,3 @@ services:
- ../cache/.composer/cache:/root/.composer/cache
- ../cache/.composer/auth.json:/root/.composer/auth.json
- /var/run/docker.sock:/var/run/docker.sock
extra_hosts:
- "dockerhost:${DOCKER_HOST_IP}"
environment:
- DOCKER_HOST_IP=${DOCKER_HOST_IP}
7 changes: 5 additions & 2 deletions dev-workspace/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

# Make sure we are inside dev-workspace subdirectory. If not, enter it.
if [[ ! "$PWD" =~ dev-workspace$ ]]; then
cd dev-workspace
fi

# Create empty cache files if not exists.
[[ -d cache/.npm/_cacache ]] || mkdir -p cache/.npm/_cacache
[[ -d cache/.npm/_logs ]] || mkdir -p cache/.npm/_logs
Expand All @@ -9,8 +14,6 @@
[[ -f cache/.bash_history ]] || touch cache/.bash_history
[[ -f cache/.composer/auth.json ]] || echo '{}' > cache/.composer/auth.json

export DOCKER_HOST_IP=$(php ./scripts/getip)

is_online() {
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1

Expand Down
69 changes: 0 additions & 69 deletions dev-workspace/scripts/getip

This file was deleted.

32 changes: 17 additions & 15 deletions modules/calendar/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ public function enqueue_admin_scripts()
true
);

// TODO: Replace react and react-dom with the wp.element dependency
wp_enqueue_script(
'publishpress-async-calendar-js',
$this->module_url . 'lib/async-calendar/js/index.min.js',
Expand All @@ -665,6 +666,7 @@ public function enqueue_admin_scripts()
'jquery-ui-droppable',
'jquery-inputmask',
'wp-i18n',
'wp-element',
'date_i18n',
],
PUBLISHPRESS_VERSION,
Expand Down Expand Up @@ -725,7 +727,7 @@ public function enqueue_admin_scripts()
$calendar_request_filter['post_type'] = $postType;
}
}

if (isset($userFilters['weeks'])) {
$weeks = sanitize_key($userFilters['weeks']);

Expand Down Expand Up @@ -2260,7 +2262,7 @@ public function getCalendarDataForMultipleWeeks($args = [], $context = 'dashboar
if (isset($this->module->options->sort_by)) {
add_filter('posts_orderby', [$this, 'filterPostsOrderBy'], 10);
}

$post_results = new WP_Query($args);

$posts = [];
Expand Down Expand Up @@ -2741,22 +2743,22 @@ public function settings_show_posts_publish_time_option()
if (empty($customStatuses)) {
foreach ($statuses as $status) {
$id = esc_attr($status) . '-display-publish-time';

echo '<div><label for="' . $id . '">';
echo '<input id="' . $id . '" name="' . $field_name . '[' . esc_attr($status) . ']"';

if (isset($this->module->options->show_posts_publish_time[$status])) {
checked($this->module->options->show_posts_publish_time[$status], 'on');
}

// Defining post_type_supports in the functions.php file or similar should disable the checkbox
disabled(post_type_supports($status, $this->module->post_type_support), true);

echo ' type="checkbox" value="on" />&nbsp;'
. esc_html($status)
. '</span>'
. '</label>';

echo '</div>';
}
} else {
Expand All @@ -2776,11 +2778,11 @@ public function settings_show_posts_publish_time_option()

// Defining post_type_supports in the functions.php file or similar should disable the checkbox
disabled(post_type_supports($status, $this->module->post_type_support), true);

echo ' type="checkbox" value="on" />&nbsp;';

echo '<span class="dashicons ' . esc_html($arr_status['status_obj']->icon) . '"></span>&nbsp;';

$style = 'background:' . $arr_status['status_obj']->color . '; color:white';

echo '<span class="pp-status-color pp-status-color-title" style="' . esc_attr($style) . '">'
Expand All @@ -2801,7 +2803,7 @@ public function settings_show_posts_publish_time_option()
$_args
)
);

echo ' <a href="' . $item_edit_link . '">' . __('edit') . '</a>';
}

Expand Down Expand Up @@ -3157,8 +3159,8 @@ public function searchAuthors()
* @param array $args
*/
$results = apply_filters(
'publishpress_search_authors_with_args_results_pre_search',
[],
'publishpress_search_authors_with_args_results_pre_search',
[],
['search' => $queryText, 'role__in' => $user_roles]
);
}
Expand Down Expand Up @@ -3415,7 +3417,7 @@ public function fetchCalendarDataJson()
* Update the current user's filters for calendar display with the filters in $_GET($request_filter). The filters
* in $_GET($request_filter) take precedence over the current users filters if they exist.
* @param array $request_filter
*
*
* @return array $filters updated filter
*/
public function update_user_filters($request_filter)
Expand Down Expand Up @@ -3614,7 +3616,7 @@ public function getPostData()
public function getPostTypeFields()
{
global $publishpress;

if (! wp_verify_nonce(sanitize_text_field($_GET['nonce']), 'publishpress-calendar-get-data')) {
wp_send_json([], 403);
}
Expand Down
8 changes: 4 additions & 4 deletions modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function AsyncCalendar(props) {
let statusValue = (props.requestFilter.post_status) ? props.requestFilter.post_status : '';
let typesValue = (props.requestFilter.post_type) ? props.requestFilter.post_type : '';
let weeksValue = (props.requestFilter.weeks) ? props.requestFilter.weeks : props.numberOfWeeksToDisplay;

let categoryValue = '';
if (props.requestFilter.category && props.requestFilter.category.value) {
categoryValue = props.requestFilter.category.value;
Expand All @@ -25,12 +25,12 @@ export default function AsyncCalendar(props) {
if (props.requestFilter.post_tag && props.requestFilter.post_tag.value) {
postTagValue = props.requestFilter.post_tag.value;
}

let authorValue = '';
if (props.requestFilter.post_author && props.requestFilter.post_author.value) {
authorValue = props.requestFilter.post_author.value;
}

const [firstDateToDisplay, setFirstDateToDisplay] = React.useState(getBeginDateOfWeekByDate(props.firstDateToDisplay, props.weekStartsOnSunday));
const [numberOfWeeksToDisplay, setNumberOfWeeksToDisplay] = React.useState(weeksValue);
const [itemsByDate, setItemsByDate] = React.useState(props.items);
Expand Down Expand Up @@ -454,7 +454,7 @@ export default function AsyncCalendar(props) {
if (dayIndexInTheRow === 7) {
dayIndexInTheRow = 0;
tableRows.push(
<tr>{rowCells}</tr>
<tr key={`calendar-row-${tableRows.length}`}>{rowCells}</tr>
);
}

Expand Down
1 change: 0 additions & 1 deletion modules/calendar/lib/async-calendar/js/DayCell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default function DayCell(props) {

return (
<a
href="javascript:void(0);"
className={className}
onClick={toggleUncollapseItems}><span className={'dashicons dashicons-' + iconClass}/> {label}</a>
);
Expand Down
4 changes: 2 additions & 2 deletions modules/calendar/lib/async-calendar/js/Functions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ export function getDateWithNoTimezoneOffset(dateString) {

export function getPostLinksElement(linkData, handleOnClick) {
if (linkData.url) {
return (<a href={linkData.url}>{linkData.label}</a>);
return (<a key={`link-${linkData.url}-${linkData.label}`} href={linkData.url}>{linkData.label}</a>);
} else if (linkData.action) {
return (<a href="javascript:void(0);" onClick={(e) => handleOnClick(e, linkData)}>{linkData.label}</a>);
return (<a key={`link-${linkData.url}-${linkData.label}`} onClick={(e) => handleOnClick(e, linkData)}>{linkData.label}</a>);
}
}

Expand Down
6 changes: 3 additions & 3 deletions modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export default function ItemFormPopup(props) {
}

fieldRows.push(
<tr>
<tr key={`field-rows-${fieldRows.length}`}>
<th><label htmlFor={fieldId}>{dataProperty.label}:</label></th>
<td>{field}</td>
</tr>
Expand Down Expand Up @@ -389,11 +389,11 @@ export default function ItemFormPopup(props) {
linkData = formLinks[linkName];

if (savingLink === linkData.id) {
links.push(<span>{linkData.labelLoading}</span>);
links.push(<span key={linkData.id}>{linkData.labelLoading}</span>);
} else {
links.push(getPostLinksElement(linkData, handleLinkOnClick));
}
links.push(<span>|</span>);
links.push(<span key={`link-separator-${links.length}`}>|</span>);
}

links.pop();
Expand Down
8 changes: 4 additions & 4 deletions modules/calendar/lib/async-calendar/js/ItemPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function ItemPopup(props) {
}

fieldRows.push(
<tr>
<tr key={`field-rows-popup-${fieldRows.length}`}>
<th>{dataProperty.label}:</th>
<td>{field}</td>
</tr>
Expand Down Expand Up @@ -155,15 +155,15 @@ export default function ItemPopup(props) {

if (linkData.url) {
links.push(
<a href={linkData.url}>{linkData.label}</a>
<a key={`links-popup-${links.length}`} href={linkData.url}>{linkData.label}</a>
);
} else if (linkData.action) {
links.push(
<a href="javascript:void(0);" onClick={(e) => handleOnClick(e, linkData)}>{linkData.label}</a>
<a key={`links-popup-${links.length}`} onClick={(e) => handleOnClick(e, linkData)}>{linkData.label}</a>
);
}

links.push(<span>|</span>);
links.push(<span key={`links-popup-${links.length}`}>|</span>);
}

links.pop();
Expand Down
3 changes: 2 additions & 1 deletion modules/calendar/lib/async-calendar/js/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function Select(props) {

if (props.options) {
options = props.options.map(option => {
return <option value={option.value} selected={option.value === props.value}>{option.text}</option>
return <option key={`select-option-${option.value}`} value={option.value}>{option.text}</option>
});
}

Expand All @@ -98,6 +98,7 @@ export default function Select(props) {
className += props.metadata ? 'pp-calendar-form-metafied ' + props.post_types : '';
return (
<select className={className}
defaultValue={props.value}
type="select"
name={props.name}
id={props.id}
Expand Down
Loading

0 comments on commit 9fdd188

Please sign in to comment.