mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 14:00:29 +01:00
feat: add new setting to control posts uploads being shown as thumbs
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
"maximumTagLength": 15,
|
"maximumTagLength": 15,
|
||||||
"undoTimeout": 0,
|
"undoTimeout": 0,
|
||||||
"allowTopicsThumbnail": 1,
|
"allowTopicsThumbnail": 1,
|
||||||
|
"showPostUploadsAsThumbnails": 1,
|
||||||
"registrationType": "normal",
|
"registrationType": "normal",
|
||||||
"registrationApprovalType": "normal",
|
"registrationApprovalType": "normal",
|
||||||
"allowAccountDelete": 1,
|
"allowAccountDelete": 1,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
"reject-image-height": "Maximum Image Height (in pixels)",
|
"reject-image-height": "Maximum Image Height (in pixels)",
|
||||||
"reject-image-height-help": "Images taller than this value will be rejected.",
|
"reject-image-height-help": "Images taller than this value will be rejected.",
|
||||||
"allow-topic-thumbnails": "Allow users to upload topic thumbnails",
|
"allow-topic-thumbnails": "Allow users to upload topic thumbnails",
|
||||||
|
"show-post-uploads-as-thumbnails": "Show post uploads as thumbnails",
|
||||||
"topic-thumb-size": "Topic Thumb Size",
|
"topic-thumb-size": "Topic Thumb Size",
|
||||||
"allowed-file-extensions": "Allowed File Extensions",
|
"allowed-file-extensions": "Allowed File Extensions",
|
||||||
"allowed-file-extensions-help": "Enter comma-separated list of file extensions here (e.g. <code>pdf,xls,doc</code>). An empty list means all extensions are allowed.",
|
"allowed-file-extensions-help": "Enter comma-separated list of file extensions here (e.g. <code>pdf,xls,doc</code>). An empty list means all extensions are allowed.",
|
||||||
|
|||||||
@@ -33,8 +33,9 @@ Thumbs.load = async function (topicData) {
|
|||||||
|
|
||||||
const topicsWithThumbs = topicData.filter((tid, idx) => hasThumbs[idx]);
|
const topicsWithThumbs = topicData.filter((tid, idx) => hasThumbs[idx]);
|
||||||
const tidsWithThumbs = topicsWithThumbs.map(t => t.tid);
|
const tidsWithThumbs = topicsWithThumbs.map(t => t.tid);
|
||||||
|
const thumbs = await loadFromTopicData(topicsWithThumbs, {
|
||||||
const thumbs = await loadFromTopicData(topicsWithThumbs);
|
thumbsOnly: meta.config.showPostUploadsAsThumbnails !== 1,
|
||||||
|
});
|
||||||
|
|
||||||
const tidToThumbs = _.zipObject(tidsWithThumbs, thumbs);
|
const tidToThumbs = _.zipObject(tidsWithThumbs, thumbs);
|
||||||
return topicData.map(t => (t && t.tid ? (tidToThumbs[t.tid] || []) : []));
|
return topicData.map(t => (t && t.tid ? (tidToThumbs[t.tid] || []) : []));
|
||||||
|
|||||||
@@ -88,6 +88,11 @@
|
|||||||
<label for="allowTopicsThumbnail" class="form-check-label">[[admin/settings/uploads:allow-topic-thumbnails]]</label>
|
<label for="allowTopicsThumbnail" class="form-check-label">[[admin/settings/uploads:allow-topic-thumbnails]]</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check form-switch mb-3">
|
||||||
|
<input class="form-check-input" type="checkbox" id="showPostUploadsAsThumbnails" data-field="showPostUploadsAsThumbnails">
|
||||||
|
<label for="showPostUploadsAsThumbnails" class="form-check-label">[[admin/settings/uploads:show-post-uploads-as-thumbnails]]</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="topicThumbSize">[[admin/settings/uploads:topic-thumb-size]]</label>
|
<label class="form-label" for="topicThumbSize">[[admin/settings/uploads:topic-thumb-size]]</label>
|
||||||
<input id="topicThumbSize" type="text" class="form-control" value="120" data-field="topicThumbSize">
|
<input id="topicThumbSize" type="text" class="form-control" value="120" data-field="topicThumbSize">
|
||||||
|
|||||||
Reference in New Issue
Block a user