Merged in feature/314-dev-dev01 (pull request #24)
auto-patch 314-dev-dev01-2024-01-25T04_09_02 * auto-patch 314-dev-dev01-2024-01-25T04_09_02
This commit is contained in:
@@ -10,9 +10,9 @@ use Yoast\WP\SEO\Introductions\Domain\Invalid_User_Id_Exception;
|
||||
*/
|
||||
class Introductions_Seen_Repository {
|
||||
|
||||
const USER_META_KEY = '_yoast_wpseo_introductions';
|
||||
public const USER_META_KEY = '_yoast_wpseo_introductions';
|
||||
|
||||
const DEFAULT_VALUE = [];
|
||||
public const DEFAULT_VALUE = [];
|
||||
|
||||
/**
|
||||
* Holds the User_Helper instance.
|
||||
@@ -35,9 +35,9 @@ class Introductions_Seen_Repository {
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
*
|
||||
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
|
||||
*
|
||||
* @return array The introductions.
|
||||
*
|
||||
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
|
||||
*/
|
||||
public function get_all_introductions( $user_id ): array {
|
||||
$seen_introductions = $this->user_helper->get_meta( $user_id, self::USER_META_KEY, true );
|
||||
@@ -76,9 +76,9 @@ class Introductions_Seen_Repository {
|
||||
* @param int $user_id User ID.
|
||||
* @param string $introduction_id The introduction ID.
|
||||
*
|
||||
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
|
||||
*
|
||||
* @return bool Whether the introduction is seen.
|
||||
*
|
||||
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
|
||||
*/
|
||||
public function is_introduction_seen( $user_id, string $introduction_id ): bool {
|
||||
$introductions = $this->get_all_introductions( $user_id );
|
||||
@@ -97,9 +97,9 @@ class Introductions_Seen_Repository {
|
||||
* @param string $introduction_id The introduction ID.
|
||||
* @param bool $is_seen Whether the introduction is seen. Defaults to true.
|
||||
*
|
||||
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
|
||||
*
|
||||
* @return bool False on failure. Not having to update is a success.
|
||||
*
|
||||
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
|
||||
*/
|
||||
public function set_introduction( $user_id, string $introduction_id, bool $is_seen = true ): bool {
|
||||
$introductions = $this->get_all_introductions( $user_id );
|
||||
|
||||
@@ -12,9 +12,9 @@ use Yoast\WP\SEO\Helpers\User_Helper;
|
||||
*/
|
||||
class Wistia_Embed_Permission_Repository {
|
||||
|
||||
const USER_META_KEY = '_yoast_wpseo_wistia_embed_permission';
|
||||
public const USER_META_KEY = '_yoast_wpseo_wistia_embed_permission';
|
||||
|
||||
const DEFAULT_VALUE = false;
|
||||
public const DEFAULT_VALUE = false;
|
||||
|
||||
/**
|
||||
* Holds the User_Helper instance.
|
||||
@@ -37,9 +37,9 @@ class Wistia_Embed_Permission_Repository {
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
*
|
||||
* @throws Exception If an invalid user ID is supplied.
|
||||
*
|
||||
* @return bool The current value.
|
||||
*
|
||||
* @throws Exception If an invalid user ID is supplied.
|
||||
*/
|
||||
public function get_value_for_user( $user_id ) {
|
||||
$value = $this->user_helper->get_meta( $user_id, self::USER_META_KEY, true );
|
||||
@@ -66,9 +66,9 @@ class Wistia_Embed_Permission_Repository {
|
||||
* @param int $user_id The user ID.
|
||||
* @param bool $value The value.
|
||||
*
|
||||
* @throws Exception If an invalid user ID is supplied.
|
||||
*
|
||||
* @return bool Whether the update was successful.
|
||||
*
|
||||
* @throws Exception If an invalid user ID is supplied.
|
||||
*/
|
||||
public function set_value_for_user( $user_id, $value ) {
|
||||
// The value is stored as a string because otherwise we can not see the difference between false and an invalid user ID.
|
||||
|
||||
Reference in New Issue
Block a user