Making WordPress.org


Ignore:
Timestamp:
05/16/2017 10:39:37 PM (7 years ago)
Author:
iandunn
Message:

Events: Restore no_location_available behavior

r5491 introduced a new condition where the client might receive an unsuccesful location lookup, but it wasn't consistent with prior behavior. This commit applies the prior behavior to the new case, so that clients can expect a consistent no_location_available error if the location wasn't found.

See #2823

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r5492 r5493  
    103103 */
    104104function build_response( $location ) {
    105     if ( false === $location ) {
    106         // No location was determined for the request. Bail with an error.
    107         $events = array();
    108         $error = 'no_location_available';
    109     } else {
     105    $events = array();
     106
     107    if ( $location ) {
    110108        $event_args = array();
    111109
     
    130128            $location = rebuild_location_from_event_source( $events );
    131129        }
     130    }
     131
     132    if ( false === $location ) {
     133        $error = 'no_location_available';
    132134    }
    133135
     
    410412 * @param array $events
    411413 *
    412  * @return array
     414 * @return array|false
    413415 */
    414416function rebuild_location_from_event_source( $events ) {
    415     $location = array();
     417    $location = false;
    416418
    417419    foreach ( $events as $event ) {
Note: See TracChangeset for help on using the changeset viewer.