mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Wall: Now you can comment when you're reposting (fixes #167)
This commit is contained in:
parent
1fcb5da0ae
commit
fd3ffcef08
4 changed files with 28 additions and 8 deletions
|
@ -298,7 +298,7 @@ final class WallPresenter extends OpenVKPresenter
|
|||
$nPost = new Post;
|
||||
$nPost->setOwner($this->user->id);
|
||||
$nPost->setWall($this->user->id);
|
||||
$nPost->setContent("");
|
||||
$nPost->setContent($this->postParam("text"));
|
||||
$nPost->save();
|
||||
$nPost->attach($post);
|
||||
|
||||
|
@ -306,8 +306,7 @@ final class WallPresenter extends OpenVKPresenter
|
|||
(new RepostNotification($post->getOwner(false), $post, $this->user->identity))->emit();
|
||||
};
|
||||
|
||||
$this->flash("succ", "Успешно", "Запись появится на вашей стене. <a href='/wall" . $wall . "_" . $post_id . "'>Вернуться к записи.</a>");
|
||||
$this->redirect($this->user->identity->getURL());
|
||||
exit(json_encode(["wall_owner" => $this->user->identity->getId()]));
|
||||
}
|
||||
|
||||
function renderDelete(int $wall, int $post_id): void
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
|
||||
|
||||
<div class="like_wrap">
|
||||
<a class="post-share-button" href="/wall{$post->getPrettyId()}/repost?hash={rawurlencode($csrfToken)}"
|
||||
<a class="post-share-button" href="javascript:repostPost('{$post->getPrettyId()}', '{rawurlencode($csrfToken)}')"
|
||||
class="post-like-button">
|
||||
<div class="repost-icon" style="opacity: 0.4;"></div>
|
||||
<span class="likeCnt">{$post->getRepostCount()}</span>
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
|
|
||||
{/if}
|
||||
|
||||
<a class="post-share-button" href="/wall{$post->getPrettyId()}/repost?hash={rawurlencode($csrfToken)}">
|
||||
<a class="post-share-button" href="javascript:repostPost('{$post->getPrettyId()}', '{rawurlencode($csrfToken)}')">
|
||||
{if $post->getRepostCount() > 0}
|
||||
{_"share"}
|
||||
(<b>{$post->getRepostCount()}</b>)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
function expand_wall_textarea() {
|
||||
var el = document.getElementById('post-buttons');
|
||||
var wi = document.getElementById('wall-post-input');
|
||||
|
@ -83,3 +81,26 @@ u("#_noteDelete").on("click", function(e) {
|
|||
});
|
||||
|
||||
}); //END ONREADY DECLS
|
||||
|
||||
function repostPost(id, hash) {
|
||||
uRepostMsgTxt = "Ваш комментарий: <textarea id='uRepostMsgInput_"+id+"'></textarea><br/><br/>";
|
||||
|
||||
MessageBox("Поделиться", uRepostMsgTxt, ["Отправить", "Отменить"], [
|
||||
(function() {
|
||||
text = document.querySelector("#uRepostMsgInput_"+id).value;
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/wall"+id+"/repost?hash="+hash, true);
|
||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
xhr.onload = (function() {
|
||||
if(xhr.responseText.indexOf("wall_owner") === -1)
|
||||
MessageBox("Помилка", "Не удалось поделиться записью...", ["OK"], [Function.noop]);
|
||||
else {
|
||||
let jsonR = JSON.parse(xhr.responseText);
|
||||
MessageBox("Успешно", "Запись появится на вашей стене. <a href='wall" + jsonR.wall_owner + "'>Перейти на свою стену.</a>", ["OK"], [Function.noop]);
|
||||
}
|
||||
});
|
||||
xhr.send('text=' + encodeURI(text));
|
||||
}),
|
||||
Function.noop
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue