From f58079e12edd3c4dcc3f8b8dab572207b235aeff Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Mon, 13 Sep 2021 14:24:07 -0400 Subject: [PATCH] client/upload: force enable 'upload anonymously' for anon users Fixes #425 --- client/html/post_upload_row.tpl | 1 + client/js/views/post_upload_view.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/html/post_upload_row.tpl b/client/html/post_upload_row.tpl index c7cc5dba..2885e3d7 100644 --- a/client/html/post_upload_row.tpl +++ b/client/html/post_upload_row.tpl @@ -61,6 +61,7 @@ text: 'Upload anonymously', name: 'anonymous', checked: ctx.uploadable.anonymous, + readonly: ctx.uploadable.forceAnonymous, }) %> <% } %> diff --git a/client/js/views/post_upload_view.js b/client/js/views/post_upload_view.js index b92a9aef..7fdd4a4f 100644 --- a/client/js/views/post_upload_view.js +++ b/client/js/views/post_upload_view.js @@ -1,6 +1,7 @@ "use strict"; const events = require("../events.js"); +const api = require("../api.js"); const views = require("../util/views.js"); const FileDropperControl = require("../controls/file_dropper_control.js"); @@ -34,7 +35,8 @@ class Uploadable extends events.EventTarget { this.flags = []; this.tags = []; this.relations = []; - this.anonymous = false; + this.anonymous = !api.isLoggedIn(); + this.forceAnonymous = !api.isLoggedIn(); } destroy() {}