From df18a8c540bdf71098d5799246d1a67c82beb1aa Mon Sep 17 00:00:00 2001 From: Abdulaziz57 Date: Mon, 30 Sep 2024 16:03:58 -0400 Subject: [PATCH 1/5] updated the anonymous posting checkbox for the frontend --- .../partials/composer-title-container.tpl | 93 +++++++++++-------- 1 file changed, 52 insertions(+), 41 deletions(-) diff --git a/static/templates/partials/composer-title-container.tpl b/static/templates/partials/composer-title-container.tpl index 185393f..8e6c547 100644 --- a/static/templates/partials/composer-title-container.tpl +++ b/static/templates/partials/composer-title-container.tpl @@ -1,46 +1,57 @@
- {{{ if isTopic }}} -
- -
- {{{ end }}} + {{{ if isTopic }}} +
+ +
+ {{{ end }}} - {{{ if showHandleInput }}} -
- -
- {{{ end }}} + {{{ if showHandleInput }}} +
+ +
+ {{{ end }}} -
- {{{ if isTopicOrMain }}} - - {{{ else }}} - {{{ if isEditing }}}[[topic:composer.editing-in, "{topicTitle}"]]{{{ else }}}[[topic:composer.replying-to, "{topicTitle}"]]{{{ end }}} - {{{ end }}} - -
+
+ {{{ if isTopicOrMain }}} + + {{{ else }}} + {{{ if isEditing }}}[[topic:composer.editing-in, "{topicTitle}"]]{{{ else }}}[[topic:composer.replying-to, "{topicTitle}"]]{{{ end }}} + {{{ end }}} + +
-
- - -
- -
- - -
-
-
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
From f40a7ad2b718f3dbf0d28598bb96044c079d9918 Mon Sep 17 00:00:00 2001 From: Abdulaziz57 Date: Wed, 2 Oct 2024 20:17:04 -0400 Subject: [PATCH 2/5] updated the anonymous checkbox to work --- static/templates/partials/composer-title-container.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/templates/partials/composer-title-container.tpl b/static/templates/partials/composer-title-container.tpl index 8e6c547..4baf9b9 100644 --- a/static/templates/partials/composer-title-container.tpl +++ b/static/templates/partials/composer-title-container.tpl @@ -54,4 +54,4 @@ - + \ No newline at end of file From 2a15890bd749e0f9e4f4ca1bde00e6b45ae0fc35 Mon Sep 17 00:00:00 2001 From: Bchenjamin Date: Sat, 5 Oct 2024 14:58:56 -0400 Subject: [PATCH 3/5] Added listener for the anonymous checkbox, send checked data to main repo --- static/lib/composer.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/static/lib/composer.js b/static/lib/composer.js index c519108..7f7beed 100644 --- a/static/lib/composer.js +++ b/static/lib/composer.js @@ -665,6 +665,7 @@ define('composer', [ var titleEl = postContainer.find('.title'); var bodyEl = postContainer.find('textarea'); var thumbEl = postContainer.find('input#topic-thumb-url'); + var anonymousEl = postContainer.find('#anonymousPost'); var onComposeRoute = postData.hasOwnProperty('template') && postData.template.compose === true; const submitBtn = postContainer.find('.composer-submit'); @@ -715,6 +716,10 @@ define('composer', [ return composerAlert(post_uuid, '[[error:scheduling-to-past]]'); } + // Check if the anonymous checkbox was filled in or not + var isAnonymous = anonymousEl.is(':checked'); + console.log(isAnonymous); + let composerData = { uuid: post_uuid, }; @@ -722,6 +727,7 @@ define('composer', [ let route = ''; if (action === 'topics.post') { + console.log('topics.post called'); route = '/topics'; composerData = { ...composerData, @@ -732,6 +738,7 @@ define('composer', [ cid: categoryList.getSelectedCid(), tags: tags.getTags(post_uuid), timestamp: scheduler.getTimestamp(), + anonymous: isAnonymous, // Add anonymous flag }; } else if (action === 'posts.reply') { route = `/topics/${postData.tid}`; @@ -741,6 +748,7 @@ define('composer', [ handle: handleEl ? handleEl.val() : undefined, content: bodyEl.val(), toPid: postData.toPid, + anonymous: isAnonymous, // Add anonymous flag here too }; } else if (action === 'posts.edit') { method = 'put'; @@ -754,6 +762,7 @@ define('composer', [ thumb: thumbEl.val() || '', tags: tags.getTags(post_uuid), timestamp: scheduler.getTimestamp(), + anonymous: isAnonymous, // Add anonymous flag here as well }; } var submitHookData = { From c4696295e6fa26ed20c394b579a798fd19603d60 Mon Sep 17 00:00:00 2001 From: Bchenjamin Date: Sat, 5 Oct 2024 15:49:11 -0400 Subject: [PATCH 4/5] Remove console log statements for cleanliness --- static/lib/composer.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/static/lib/composer.js b/static/lib/composer.js index 7f7beed..e6b1795 100644 --- a/static/lib/composer.js +++ b/static/lib/composer.js @@ -718,7 +718,6 @@ define('composer', [ // Check if the anonymous checkbox was filled in or not var isAnonymous = anonymousEl.is(':checked'); - console.log(isAnonymous); let composerData = { uuid: post_uuid, @@ -727,7 +726,6 @@ define('composer', [ let route = ''; if (action === 'topics.post') { - console.log('topics.post called'); route = '/topics'; composerData = { ...composerData, From a4237d1418ab9535083f276874f0be4f9bcd2887 Mon Sep 17 00:00:00 2001 From: Bchenjamin Date: Sun, 6 Oct 2024 19:42:16 -0400 Subject: [PATCH 5/5] Commented out autocomplete setup to fix creating posts --- static/lib/composer/autocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/lib/composer/autocomplete.js b/static/lib/composer/autocomplete.js index afceca0..3cccf1e 100644 --- a/static/lib/composer/autocomplete.js +++ b/static/lib/composer/autocomplete.js @@ -57,7 +57,7 @@ define('composer/autocomplete', [ $(window).trigger('composer:autocomplete:init', data); - autocomplete._active[post_uuid] = Autocomplete.setup(data); + // autocomplete._active[post_uuid] = Autocomplete.setup(data); data.element.on('textComplete:select', function () { preview.render(postContainer);