mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 17:25:40 +03:00
Check for no media descriptions when posting & boosting
This commit is contained in:
parent
10090e316a
commit
a838e30f4a
2 changed files with 20 additions and 1 deletions
|
@ -699,6 +699,17 @@ function Compose({
|
||||||
}
|
}
|
||||||
// TODO: check for URLs and use `charactersReservedPerUrl` to calculate max characters
|
// TODO: check for URLs and use `charactersReservedPerUrl` to calculate max characters
|
||||||
|
|
||||||
|
if (mediaAttachments.length > 0) {
|
||||||
|
// If there are media attachments, check if they have no descriptions
|
||||||
|
const noDescription = mediaAttachments.some(
|
||||||
|
(media) => !media.description?.trim(),
|
||||||
|
);
|
||||||
|
if (noDescription) {
|
||||||
|
const yes = confirm('Some media have no descriptions. Continue?');
|
||||||
|
if (!yes) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Post-cleanup
|
// Post-cleanup
|
||||||
spoilerText = (sensitive && spoilerText) || undefined;
|
spoilerText = (sensitive && spoilerText) || undefined;
|
||||||
status = status === '' ? undefined : status;
|
status = status === '' ? undefined : status;
|
||||||
|
|
|
@ -271,7 +271,15 @@ function Status({
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (!reblogged) {
|
if (!reblogged) {
|
||||||
const yes = confirm('Boost this post?');
|
// Check if media has no descriptions
|
||||||
|
const hasNoDescriptions = mediaAttachments.some(
|
||||||
|
(attachment) => !attachment.description?.trim?.(),
|
||||||
|
);
|
||||||
|
let confirmText = 'Boost this post?';
|
||||||
|
if (hasNoDescriptions) {
|
||||||
|
confirmText += '\n\n⚠️ Some media have no descriptions.';
|
||||||
|
}
|
||||||
|
const yes = confirm(confirmText);
|
||||||
if (!yes) {
|
if (!yes) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue