From 2bf361c64a46d575533f68f8ced88e037f887335 Mon Sep 17 00:00:00 2001 From: Nesswit Date: Tue, 22 May 2018 02:51:38 +0900 Subject: [PATCH] client/posts: fix upload error caused by anonymous node Anonymous node does not exist in view when a user without anonymous upload permission tries to post upload. So in this case we should check for the existence of anonymousNode first. --- client/js/views/post_upload_view.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/js/views/post_upload_view.js b/client/js/views/post_upload_view.js index b64fe26..b4d0c40 100644 --- a/client/js/views/post_upload_view.js +++ b/client/js/views/post_upload_view.js @@ -283,8 +283,10 @@ class PostUploadView extends events.EventTarget { uploadable.safety = safetyNode.value; } - uploadable.anonymous = - rowNode.querySelector('.anonymous input').checked; + const anonymousNode = rowNode.querySelector('.anonymous input:checked'); + if (anonymousNode) { + uploadable.anonymous = true; + } uploadable.flags = []; if (rowNode.querySelector('.loop-video input:checked')) {