Skip to content

Commit e0b77bf

Browse files
committed
Merge remote-tracking branch 'origin/issue-1048' into issue-1048
2 parents 163f4f0 + be7df32 commit e0b77bf

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

admin/class-admin-apple-themes.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public static function render_field( $theme, $option_name ) {
163163
* Return a Theme object loaded with db values based on the theme name string.
164164
*
165165
* @param string $theme_str The name of theme.
166-
*
166+
*
167167
* @return \Apple_Exporter\Theme $theme_object A Theme object loaded with db config.
168168
*/
169169
public static function get_theme_by_name( $theme_str ) {
@@ -574,7 +574,9 @@ public function theme_nag() {
574574
__( 'It looks like you are using the default theme. You can choose a new theme or customize your theme on the %1$sthemes page%2$s.', 'apple-news' ),
575575
'<a href="' . esc_url( admin_url( 'admin.php?page=apple-news-themes' ) ) . '">',
576576
'</a>'
577-
)
577+
),
578+
get_current_user_id(),
579+
true
578580
);
579581
}
580582

assets/js/pluginsidebar/sidebar.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,14 @@ function Sidebar() {
201201

202202
// Display notices whenever they change.
203203
useEffect(() => {
204-
notices.forEach((notice) => displayNotification(notice.message, notice.type));
204+
/* Adding a conditional here to prevent a sporadic error.
205+
Leaving a console log in place in case we need to debug this further.
206+
See: https://github.com/alleyinteractive/apple-news/issues/1030 */
207+
if (Array.isArray(notices) && notices.length) {
208+
notices.forEach((notice) => displayNotification(notice.message, notice.type));
209+
} else {
210+
console.log('Notices dispatched, but none to display.'); // eslint-disable-line no-console
211+
}
205212
}, [displayNotification, notices]);
206213

207214
return (

0 commit comments

Comments
 (0)