Show 'one contributor' instead of '1 contributors', hide thank you note if this is configured

This commit is contained in:
Pieter Vander Vennet 2024-01-06 17:19:57 +01:00
parent 2407530f86
commit 68e63f8e39
2 changed files with 12 additions and 4 deletions

View file

@ -42,6 +42,10 @@ export interface MapCompleteUsageOverview {
* If omitted: show all themes * If omitted: show all themes
*/ */
themeWhitelist?: string[] themeWhitelist?: string[]
/**
* Show a thank you note
*/
showThankYou?: boolean | true
} }
@ -64,4 +68,6 @@ export default interface Config {
dryrun?: boolean dryrun?: boolean
}, },
actions: MapCompleteUsageOverview [] actions: MapCompleteUsageOverview []
} }

View file

@ -157,13 +157,15 @@ export class Postbuilder {
const images = await imageUploader.attemptToUpload(4) const images = await imageUploader.attemptToUpload(4)
const authors = Array.from(new Set(imageUploader.getCurrentAuthors())) const authors = Array.from(new Set(imageUploader.getCurrentAuthors()))
if (authors.length > 0) { if (authors.length > 0) {
let imageCount = totalImagesCreated === 1 ? "one image" : totalImagesCreated + " images"
let contributors = totalImageContributorCount === 1 ? "One contributor": totalImageContributorCount+" contributors"
let contributorCountMultiple = `${contributors} uploaded ${imageCount}.`
let thankYou = (this._config.showThankYou ?? true) ? "\nA big thanks to everyone who is contributing!\n\n" : ""
await this._poster.writeMessage([ await this._poster.writeMessage([
"In total, " + totalImageContributorCount + " different contributors uploaded " + totalImagesCreated + " images.\n", contributorCountMultiple + "\n",
"Images in this thread are randomly selected from them and were made by: ", "Images in this thread are randomly selected from them and were made by: ",
...authors, ...authors,
"", thankYou,
"A big thanks to everyone who is contributing!",
"",
"All changes were made on " + date + (this._config.numberOfDays > 1 ? ` or at most ${this._config.numberOfDays} days before` : "") "All changes were made on " + date + (this._config.numberOfDays > 1 ? ` or at most ${this._config.numberOfDays} days before` : "")
].join("\n"), { ].join("\n"), {