From f928729d6de78f29061796b85b18906d6d831b2a Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Wed, 10 Mar 2021 14:33:49 -0300 Subject: [PATCH 1/5] Improves clarity of one string --- .../tainacan-facets/facets-list/facets-list-theme-unit.vue | 2 +- src/views/gutenberg-blocks/tainacan-facets/facets-list/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme-unit.vue b/src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme-unit.vue index d6377fb09..8755a4bb6 100644 --- a/src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme-unit.vue +++ b/src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme-unit.vue @@ -110,7 +110,7 @@

- {{ $root.__( 'This facet children terms do not contain items.', 'tainacan' ) }} + {{ $root.__( 'The child terms of this facet do not contain items.', 'tainacan' ) }}

diff --git a/src/views/gutenberg-blocks/tainacan-facets/facets-list/index.js b/src/views/gutenberg-blocks/tainacan-facets/facets-list/index.js index ab2828670..2d811132e 100644 --- a/src/views/gutenberg-blocks/tainacan-facets/facets-list/index.js +++ b/src/views/gutenberg-blocks/tainacan-facets/facets-list/index.js @@ -311,7 +311,7 @@ registerBlockType('tainacan/facets-list', { return prepareFacet(aChildTermFacet); }) : -

{ __( 'This facet children terms do not contain items.', 'tainacan' )}

+

{ __( 'The child terms of this facet do not contain items.', 'tainacan' )}

} : null ) From 7aeeb5680561f684d2b33e7f127980927542c103 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Wed, 17 Mar 2021 11:37:26 -0300 Subject: [PATCH 2/5] fix: disable WP_RUN_CORE_TESTS #509 --- tests/bin/install-wp-tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/bin/install-wp-tests.sh b/tests/bin/install-wp-tests.sh index d2fde0e38..539488504 100755 --- a/tests/bin/install-wp-tests.sh +++ b/tests/bin/install-wp-tests.sh @@ -91,6 +91,7 @@ install_test_suite() { sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "$ a if ( ! defined( 'WP_RUN_CORE_TESTS' ) ) define('WP_RUN_CORE_TESTS', false);" "$WP_TESTS_DIR"/wp-tests-config.php fi } From 5444fa770a5fbdfd6321c028882b1c3db1d71fda Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Mon, 22 Mar 2021 14:49:40 -0300 Subject: [PATCH 3/5] fix: call to a member function `get_allow_comments()` on null, in items repositories --- src/classes/repositories/class-tainacan-items.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/classes/repositories/class-tainacan-items.php b/src/classes/repositories/class-tainacan-items.php index 8d8369cfc..bd255e3ca 100644 --- a/src/classes/repositories/class-tainacan-items.php +++ b/src/classes/repositories/class-tainacan-items.php @@ -525,14 +525,14 @@ class Items extends Repository { * @return bool */ public function hook_comments_open($open_comment, $post_id) { - $item = self::get_entity_by_post($post_id); + $item = self::get_entity_by_post($post_id); - if($item != false && $item instanceof Entities\Item) { - $collection = $item->get_collection(); - if( $collection->get_allow_comments() !== 'open' ) return false; - } + if($item != false && $item instanceof Entities\Item) { + $collection = $item->get_collection(); + if( $collection != null && $collection->get_allow_comments() !== 'open' ) return false; + } - return $open_comment; + return $open_comment; } /** From 2e7365d73f493a506f13719fae77955128355401 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Mon, 22 Mar 2021 16:30:41 -0300 Subject: [PATCH 4/5] fix: too check item post type to get collection --- .../class-tainacan-entity-collection-relation.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/classes/traits/class-tainacan-entity-collection-relation.php b/src/classes/traits/class-tainacan-entity-collection-relation.php index 572800f02..3b8da7091 100644 --- a/src/classes/traits/class-tainacan-entity-collection-relation.php +++ b/src/classes/traits/class-tainacan-entity-collection-relation.php @@ -36,6 +36,16 @@ trait Entity_Collection_Relation { if($this->collection instanceof Entities\Collection){ return $this->collection; } + } else { + $post_type = get_post($this->get_id())->post_type; + $matches = array(); + $regex = '/' . Collection::$db_identifier_prefix . '([a-zA-Z0-9_]*)' . Collection::$db_identifier_sufix . '/'; + preg_match($regex, $post_type, $matches); + $collection_id = $matches[1]; + if (is_numeric($collection_id)) { + $this->set_collection_id($collection_id); + return $this->get_collection(); + } } return null; From a6a9a71a2272976b9bb7adde96f3b9aca4fc4a40 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Mon, 22 Mar 2021 18:19:34 -0300 Subject: [PATCH 5/5] fix test if post is null on `get_collection()` --- .../traits/class-tainacan-entity-collection-relation.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/classes/traits/class-tainacan-entity-collection-relation.php b/src/classes/traits/class-tainacan-entity-collection-relation.php index 3b8da7091..a36628de6 100644 --- a/src/classes/traits/class-tainacan-entity-collection-relation.php +++ b/src/classes/traits/class-tainacan-entity-collection-relation.php @@ -37,7 +37,10 @@ trait Entity_Collection_Relation { return $this->collection; } } else { - $post_type = get_post($this->get_id())->post_type; + $post = get_post($this->get_id()); + if (!$post || !$post->post_type) + return null; + $post_type = $post->post_type; $matches = array(); $regex = '/' . Collection::$db_identifier_prefix . '([a-zA-Z0-9_]*)' . Collection::$db_identifier_sufix . '/'; preg_match($regex, $post_type, $matches);