dont remove repost when editin'

This commit is contained in:
mrilyew 2024-11-12 15:05:21 +03:00
parent 49d8bc39a1
commit 51276d66cc
6 changed files with 18 additions and 3 deletions

View file

@ -1003,7 +1003,12 @@ final class Wall extends VKAPIRequestHandler
$post->save(true);
if($attachments == 'remove' || sizeof($final_attachments) > 0) {
$post->unwire();
foreach($post->getChildren() as $att) {
if(!($att instanceof Post)) {
$post->detach($att);
}
}
foreach($final_attachments as $attachment) {
$post->attach($attachment);
}

View file

@ -109,7 +109,7 @@
</span>
</div>
</div>
<div class='post-edit'></div>
<div class='post-edit' n:if='!$compact'></div>
<div class="post-menu" n:if="$compact == false">
<a href="{if !$suggestion}/wall{$post->getPrettyId()}{else}javascript:void(0){/if}" class="date">{$post->getPublicationTime()}
<span n:if="$post->getEditTime()" class="edited editedMark">({_edited_short})</span>

View file

@ -111,7 +111,7 @@
</span>
</div>
</div>
<div class='post-edit'></div>
<div class='post-edit' n:if='!$compact'></div>
<div n:if="!($compact ?? false)" class="post-menu">
{if is_null($thisUser)}
{var $forceNoDeleteLink = true}

View file

@ -630,6 +630,7 @@ u(document).on("click", "#editPost", async (e) => {
<div class='post-buttons'>
<div class="post-horizontal"></div>
<div class="post-vertical"></div>
<div class="post-repost"></div>
<div class="post-source"></div>
<div class='post-opts'>
@ -695,6 +696,13 @@ u(document).on("click", "#editPost", async (e) => {
edit_place.find(`input[name='source']`).attr('value', 'remove')
})
}
if(api_post.copy_history && api_post.copy_history.length > 0) {
edit_place.find('.post-repost').html(`
<span>${tr('has_repost')}.</span>
`)
}
// horizontal attachments
api_post.attachments.forEach(att => {
const type = att.type

View file

@ -257,6 +257,7 @@
"others_posts" = "Others posts";
"show_more" = "Show more";
"has_repost" = "Has repost";
/* Friends */

View file

@ -236,6 +236,7 @@
"clubs_posts" = "Записи сообщества";
"others_posts" = "Чужие записи";
"show_more" = "Показать больше";
"has_repost" = "Содержит репост";
/* Friends */