| @@ -84,9 +84,9 @@ | ||
| 84 | 84 | if ( ! empty( $errors ) ) { |
| 85 | 85 | return $this->error( 'login_error', $errors, 'login', 400 ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $query = 'status, message, user{ id, name, first_name, last_name, display_name, email, profile_photo, joined, is_verified, api_key, plan, plan_expire_at, my_cloud{ limit, usages, last_pushed }, favourites{ id, type }, show_notice, reviews{ type, type_id, rating } }'; | |
| 88 | + $query = 'status, message, user{ id, name, first_name, last_name, display_name, email, profile_photo, joined, is_verified, api_key, plan, plan_expire_at, my_cloud{ limit, usages, last_pushed }, favourites{ id, type }, show_notice }'; | |
| 89 | 89 | |
| 90 | 90 | $response = $this->http()->mutation( |
| 91 | 91 | $viaAPI ? 'connectWithApiKey' : 'connect', |
| 92 | 92 | $query, |
| @@ -125,16 +125,8 @@ | ||
| 125 | 125 | unset( $response['user']['favourites'] ); |
| 126 | 126 | $meta['favourites'] = $_favourites; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ( ! empty( $response['user']['reviews'] ) ) { | |
| 130 | - $_reviews = $this->utils( 'helper' )->normalizeReviews( $response['user']['reviews'] ); | |
| 131 | - $this->utils( 'options' )->set( 'reviews', $_reviews ); | |
| 132 | - | |
| 133 | - unset( $response['user']['reviews'] ); | |
| 134 | - $meta['reviews'] = $_reviews; | |
| 135 | - } | |
| 136 | - | |
| 137 | 129 | $this->utils( 'options' )->set( 'user', $response['user'] ); |
| 138 | 130 | $response['user']['meta'] = $this->user_meta( $meta ); |
| 139 | 131 | |
| 140 | 132 | return $response; |
| @@ -176,16 +168,14 @@ | ||
| 176 | 168 | public function delete(){ |
| 177 | 169 | $this->utils( 'options' ) |
| 178 | 170 | ->remove( 'user' ) |
| 179 | 171 | ->remove( 'favourites' ) |
| 180 | - ->remove( 'reviews' ) | |
| 181 | 172 | ->remove( 'cloud_activity' ) |
| 182 | 173 | ->remove( 'api_key' ) |
| 183 | 174 | ->remove( 'global_login' ) |
| 184 | - ->remove( 'total_download_counts' ) | |
| 185 | 175 | ->remove( 'templates_in_clouds' ); |
| 186 | 176 | |
| 187 | - if ( $this->utils( 'options' )->who_am_i() === 'global' ) { | |
| 177 | + if ( $this->utils( 'options' )->whoami() === 'global' ) { | |
| 188 | 178 | $this->utils( 'options' )->remove_global_login(); |
| 189 | 179 | } |
| 190 | 180 | |
| 191 | 181 | $global_user_id = $this->utils( 'options' )->is_global(); |
| @@ -201,9 +191,9 @@ | ||
| 201 | 191 | |
| 202 | 192 | return $global_user; |
| 203 | 193 | } |
| 204 | 194 | |
| 205 | - public static function is_signed(): array { | |
| 195 | + public static function is_signed() { | |
| 206 | 196 | $_response = [ |
| 207 | 197 | 'status' => 'success' |
| 208 | 198 | ]; |
| 209 | 199 | |
| @@ -221,9 +211,9 @@ | ||
| 221 | 211 | |
| 222 | 212 | return $_response; |
| 223 | 213 | } |
| 224 | 214 | |
| 225 | - public function user_meta( $meta = [] ): array { | |
| 215 | + public function user_meta( $meta = [] ) { | |
| 226 | 216 | $_meta = [ |
| 227 | 217 | 'link_account' => self::utils( 'options' )->link_account(), |
| 228 | 218 | 'unlink_account' => self::utils( 'options' )->unlink_account(), |
| 229 | 219 | 'is_globally_signed' => Login::is_globally_signed(), |
| @@ -228,9 +218,8 @@ | ||
| 228 | 218 | 'unlink_account' => self::utils( 'options' )->unlink_account(), |
| 229 | 219 | 'is_globally_signed' => Login::is_globally_signed(), |
| 230 | 220 | 'signed_as_global' => Login::signed_as_global(), |
| 231 | 221 | 'starred' => self::utils( 'options' )->get( 'favourites' ), |
| 232 | - 'reviews' => self::utils( 'options' )->get( 'reviews' ), | |
| 233 | 222 | 'cloud_activity' => self::utils( 'options' )->get( 'cloud_activity' ), |
| 234 | 223 | 'has_api' => rest_sanitize_boolean( self::utils( 'options' )->get( 'api_key' ) ) |
| 235 | 224 | ]; |
| 236 | 225 | |
| @@ -236,12 +225,12 @@ | ||
| 236 | 225 | |
| 237 | 226 | return array_merge( $_meta, $meta ); |
| 238 | 227 | } |
| 239 | 228 | |
| 240 | - public static function is_globally_signed(): bool { | |
| 229 | + public static function is_globally_signed() { | |
| 241 | 230 | return rest_sanitize_boolean( ( new static )->utils( 'options' )->is_globally_signed() ); |
| 242 | 231 | } |
| 243 | 232 | |
| 244 | - public static function signed_as_global(): bool { | |
| 233 | + public static function signed_as_global() { | |
| 245 | 234 | return rest_sanitize_boolean( ( new static )->utils( 'options' )->signed_as_global() ); |
| 246 | 235 | } |
| 247 | 236 | } |