From 99d33dc52646985bc5014903628ae9c70729cb23 Mon Sep 17 00:00:00 2001 From: dgold Date: Fri, 8 Jun 2018 17:32:59 +0100 Subject: [PATCH 1/2] Added null-coalescing check for published date --- models.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models.php b/models.php index f5bf3d3..3daa6be 100644 --- a/models.php +++ b/models.php @@ -22,7 +22,8 @@ public function __construct($mention) { class WebmentionStore { public function add_mention($mention) { $file_path = APP_DATA_DIR . DIRECTORY_SEPARATOR . $mention->mentionId . ".json"; - file_put_contents( + $mention->data['published'] = $mention->data['published'] ?? $mention->data['wm-received']; + file_put_contents( $file_path, json_encode($mention->data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ); From 7f8433ce9a0b73f50b7bbceb7f49bc0f62b11f19 Mon Sep 17 00:00:00 2001 From: Marty McGuire Date: Fri, 8 Jun 2018 14:22:02 -0500 Subject: [PATCH 2/2] Match whitespace w/ my (oops terrible) whitespace --- models.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models.php b/models.php index 3daa6be..d6233a2 100644 --- a/models.php +++ b/models.php @@ -22,8 +22,8 @@ public function __construct($mention) { class WebmentionStore { public function add_mention($mention) { $file_path = APP_DATA_DIR . DIRECTORY_SEPARATOR . $mention->mentionId . ".json"; - $mention->data['published'] = $mention->data['published'] ?? $mention->data['wm-received']; - file_put_contents( + $mention->data['published'] = $mention->data['published'] ?? $mention->data['wm-received']; + file_put_contents( $file_path, json_encode($mention->data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) );