[wp-trac] [WordPress Trac] #40702: Add WordCamps and meetup events to the News Dashboard widget

WordPress Trac noreply at wordpress.org
Thu May 11 23:20:14 UTC 2017


#40702: Add WordCamps and meetup events to the News Dashboard widget
-------------------------------------------------+-------------------------
 Reporter:  iandunn                              |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  4.8
Component:  Administration                       |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  needs-dev-note has-patch needs-      |     Focuses:
  unit-tests dev-feedback                        |  javascript, rest-api
-------------------------------------------------+-------------------------

Comment (by iandunn):

 I think `40702.8.diff` fixes the two errors in comment:30. I noticed a new
 one, though, which is fixed in 40702.9.diff.

 When an actual HTTP error occurs (like when testing with the mu-plugin
 mentioned in comment:30), 40702.8.diff was treating it like a
 `no_location_available` event, rather than an actual error. So, the `We
 couldn't locate...` template was being shown, instead of the error
 template.

 It seemed like an odd situation to use HTTP status codes when returning
 `WP_Error`s. I can see how it makes sense for the `401` error in
 `get_current_item_permissions_check()`, but a `503` in
 `get_current_item()` when the actual HTTP transaction succeeded seems
 misleading, and had the unintended side effect above.

 The original code treated HTTP-layer errors differently than application-
 layer "errors" on purpose.

 I need to write some QUnit tests soon, but in the meantime I these are the
 situations that need to be tested, and their expected results:

 === User-initiated requests ===
 * HTTP error - show `.community-events-error-occurred`
 * `no location found` - render `tmpl-community-events-could-not-locate`
 * location found with events - render `tmpl-community-events-event-list`
 * location found with no events - render `tmpl-community-events-no-
 upcoming-events`

 === App-initiated requests===
 * HTTP error - no error is shown, show `enter_closest_city` message
 * `no location found` result - no error is shown, show
 `enter_closest_city` message
 * location found with events - same as user-initiated, but the form is
 closed
 * location found with no events - same as user-initiated, but the form is
 closed

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40702#comment:31>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list