mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: setting to show signatures only once in topics, closes #10071
This commit is contained in:
@@ -78,6 +78,7 @@
|
||||
"reputation:disabled": 0,
|
||||
"downvote:disabled": 0,
|
||||
"disableSignatures": 0,
|
||||
"signatures:hideDuplicates": 0,
|
||||
"upvotesPerDay": 20,
|
||||
"upvotesPerUserPerDay": 6,
|
||||
"downvotesPerDay": 10,
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
"signature.disable": "Disable signatures",
|
||||
"signature.no-links": "Disable links in signatures",
|
||||
"signature.no-images": "Disable images in signatures",
|
||||
"signature.hide-duplicates": "Hide duplicate signatures in topics",
|
||||
"signature.max-length": "Maximum Signature Length",
|
||||
"composer": "Composer Settings",
|
||||
"composer-help": "The following settings govern the functionality and/or appearance of the post composer shown\n\t\t\t\tto users when they create new topics, or reply to existing topics.",
|
||||
|
||||
@@ -40,7 +40,7 @@ define('forum/topic', [
|
||||
app.enterRoom('topic_' + tid);
|
||||
|
||||
posts.onTopicPageLoad(components.get('post'));
|
||||
|
||||
posts.signaturesShown = {};
|
||||
navigator.init('[component="post"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, utils.debounce(Topic.navigatorCallback, 500));
|
||||
|
||||
postTools.init(tid);
|
||||
|
||||
@@ -14,6 +14,8 @@ define('forum/topic/posts', [
|
||||
], function (pagination, infinitescroll, postTools, images, navigator, components, translator, hooks, helpers) {
|
||||
const Posts = { };
|
||||
|
||||
Posts.signaturesShown = {};
|
||||
|
||||
Posts.onNewPost = function (data) {
|
||||
if (
|
||||
!data ||
|
||||
@@ -282,6 +284,7 @@ define('forum/topic/posts', [
|
||||
Posts.onTopicPageLoad = function (posts) {
|
||||
handlePrivateUploads(posts);
|
||||
images.wrapImagesInLinks(posts);
|
||||
hideDuplicateSignatures(posts);
|
||||
Posts.showBottomPostBar();
|
||||
posts.find('[component="post/content"] img:not(.not-responsive)').addClass('img-responsive');
|
||||
Posts.addBlockquoteEllipses(posts);
|
||||
@@ -353,6 +356,20 @@ define('forum/topic/posts', [
|
||||
});
|
||||
}
|
||||
|
||||
function hideDuplicateSignatures(posts) {
|
||||
if (ajaxify.data['signatures:hideDuplicates']) {
|
||||
posts.each((index, el) => {
|
||||
const signatureEl = $(el).find('[component="post/signature"]');
|
||||
const uid = signatureEl.attr('data-uid');
|
||||
if (Posts.signaturesShown[uid]) {
|
||||
signatureEl.addClass('hidden');
|
||||
} else {
|
||||
Posts.signaturesShown[uid] = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function removeNecroPostMessages(removedPostEls) {
|
||||
removedPostEls.each((index, el) => {
|
||||
$(`[data-necro-post-index="${$(el).attr('data-index')}"]`).remove();
|
||||
|
||||
@@ -88,6 +88,7 @@ topicsController.get = async function getTopic(req, res, next) {
|
||||
topicData['reputation:disabled'] = meta.config['reputation:disabled'];
|
||||
topicData['downvote:disabled'] = meta.config['downvote:disabled'];
|
||||
topicData['feeds:disableRSS'] = meta.config['feeds:disableRSS'] || 0;
|
||||
topicData['signatures:hideDuplicates'] = meta.config['signatures:hideDuplicates'];
|
||||
topicData.bookmarkThreshold = meta.config.bookmarkThreshold;
|
||||
topicData.necroThreshold = meta.config.necroThreshold;
|
||||
topicData.postEditDuration = meta.config.postEditDuration;
|
||||
|
||||
@@ -259,6 +259,12 @@
|
||||
<span class="mdl-switch__label"><strong>[[admin/settings/post:signature.no-images]]</strong></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||
<input class="mdl-switch__input" type="checkbox" data-field="signatures:hideDuplicates">
|
||||
<span class="mdl-switch__label"><strong>[[admin/settings/post:signature.hide-duplicates]]</strong></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="maximumSignatureLength">[[admin/settings/post:signature.max-length]]</label>
|
||||
<input id="maximumSignatureLength" type="text" class="form-control" value="255" data-field="maximumSignatureLength">
|
||||
|
||||
Reference in New Issue
Block a user