enhance(frontend): 共有ページで、titleとtextに同じ内容が入っていた際の削除ロジックを強化 (#16226)

* enhance(frontend): 共有ページで、titleとtextに同じ内容が入っていた際の削除ロジックを強化
Fix #16224

* fix

* +→*

* fix

* use RegExp.test

* Update packages/frontend/src/pages/share.vue

Co-authored-by: zyoshoka <107108195+zyoshoka@users.noreply.github.com>

---------

Co-authored-by: zyoshoka <107108195+zyoshoka@users.noreply.github.com>
This commit is contained in:
tamaina 2025-07-03 18:00:43 +09:00 committed by GitHub
parent 706244925d
commit ccbc4cffaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 4 deletions

View File

@ -59,10 +59,21 @@ const visibleUsers = ref([] as Misskey.entities.UserDetailed[]);
async function init() { async function init() {
let noteText = ''; let noteText = '';
if (title.value) noteText += `[ ${title.value} ]\n`; if (title.value) {
// Google noteText += `[ ${title.value} ]\n`;
if (text?.startsWith(`${title.value}.\n`)) noteText += text.replace(`${title.value}.\n`, '');
else if (text && title.value !== text) noteText += `${text}\n`; //#region add text to note text
if (text?.startsWith(title.value)) {
// For the Google app https://github.com/misskey-dev/misskey/issues/16224
noteText += text.replace(title.value, '').trimStart();
} else if (text) {
noteText += `${text}\n`;
}
//#endregion
} else if (text) {
noteText += `${text}\n`;
}
if (url) { if (url) {
try { try {
// Normalize the URL to URL-encoded and puny-coded from with the URL constructor. // Normalize the URL to URL-encoded and puny-coded from with the URL constructor.