@@ -109,11 +109,15 @@ public function add_rest_actions() {
109
109
*/
110
110
public function render_metabox () {
111
111
global $ post ;
112
+
112
113
$ post_id = $ post ->ID ? $ post ->ID : 0 ;
113
- $ run_tests_checked = ! empty ( Test::get_item_id ( $ post_id ) );
114
+ $ test_id = Test::get_item_id ( $ post_id );
115
+ $ test = (object ) Test::get_item ( $ test_id );
114
116
115
- $ alert_id = Test::get_alert_id ( $ post_id );
117
+ $ run_tests_checked = ! is_null ( $ test_id );
118
+ $ alert_id = $ test ->current_alert_id ?? null ;
116
119
$ testing_status_instructions = '' ;
120
+
117
121
if ( $ alert_id ) {
118
122
$ alert_link = Url_Helpers::get_alert_page ( $ alert_id );
119
123
$ testing_status_instructions .= sprintf (
@@ -124,9 +128,6 @@ public function render_metabox() {
124
128
);
125
129
}
126
130
127
- $ test_id = Test::get_item_id ( $ post_id );
128
- $ test = (object ) Test::get_item ( $ test_id );
129
-
130
131
vrts ()->component ('metabox-classic-editor ' , [
131
132
'post_id ' => $ post_id ,
132
133
'nonce ' => $ this ->nonce ,
@@ -135,7 +136,7 @@ public function render_metabox() {
135
136
'field_test_status_key ' => self ::$ field_test_status_key ,
136
137
'has_post_alert ' => isset ( $ test ->current_alert_id ) ? ! is_null ( $ test ->current_alert_id ) : false ,
137
138
'base_screenshot_url ' => Image_Helpers::get_screenshot_url ( $ test , 'base ' ),
138
- 'base_screenshot_date ' => Date_Time_Helpers::get_formatted_date_time ( $ test ->base_screenshot_date ),
139
+ 'base_screenshot_date ' => Date_Time_Helpers::get_formatted_date_time ( $ test ->base_screenshot_date ?? null ),
139
140
'testing_status_instructions ' => $ testing_status_instructions ,
140
141
'is_new_test ' => self ::is_new_test ( $ post_id ),
141
142
'remaining_tests ' => Subscription::get_remaining_tests (),
0 commit comments