mirror of
https://github.com/openvk/openvk
synced 2025-07-05 15:29:57 +03:00
Compare commits
1 commit
a6e2a9b2cb
...
2ba3f02e63
Author | SHA1 | Date | |
---|---|---|---|
|
2ba3f02e63 |
14 changed files with 26 additions and 112 deletions
|
@ -1487,11 +1487,6 @@ class User extends RowModel
|
|||
return $this->isClosed();
|
||||
}
|
||||
|
||||
public function HideGlobalFeed(): bool
|
||||
{
|
||||
return (bool) $this->getRecord()->hide_global_feed;
|
||||
}
|
||||
|
||||
public function getRealId()
|
||||
{
|
||||
return $this->getId();
|
||||
|
|
|
@ -119,7 +119,6 @@ final class AdminPresenter extends OpenVKPresenter
|
|||
$user->setLast_Name($this->postParam("last_name"));
|
||||
$user->setPseudo($this->postParam("nickname"));
|
||||
$user->setStatus($this->postParam("status"));
|
||||
$user->setHide_Global_Feed(empty($this->postParam("hide_global_feed") ? 0 : 1));
|
||||
if (!$user->setShortCode(empty($this->postParam("shortcode")) ? null : $this->postParam("shortcode"))) {
|
||||
$this->flash("err", tr("error"), tr("error_shorturl_incorrect"));
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ final class InternalAPIPresenter extends OpenVKPresenter
|
|||
private function fail(int $code, string $message): void
|
||||
{
|
||||
header("HTTP/1.1 400 Bad Request");
|
||||
header("Content-Type: application/x-msgpack");
|
||||
|
||||
exit(MessagePack::pack([
|
||||
"brpc" => 1,
|
||||
"error" => [
|
||||
|
@ -27,7 +25,6 @@ final class InternalAPIPresenter extends OpenVKPresenter
|
|||
|
||||
private function succ($payload): void
|
||||
{
|
||||
header("Content-Type: application/x-msgpack");
|
||||
exit(MessagePack::pack([
|
||||
"brpc" => 1,
|
||||
"result" => $payload,
|
||||
|
|
|
@ -210,7 +210,7 @@ final class WallPresenter extends OpenVKPresenter
|
|||
$pPage = min((int) ($_GET["posts"] ?? OPENVK_DEFAULT_PER_PAGE), 50);
|
||||
|
||||
$queryBase = "FROM `posts` LEFT JOIN `groups` ON GREATEST(`posts`.`wall`, 0) = 0 AND `groups`.`id` = ABS(`posts`.`wall`) LEFT JOIN `profiles` ON LEAST(`posts`.`wall`, 0) = 0 AND `profiles`.`id` = ABS(`posts`.`wall`)";
|
||||
$queryBase .= "WHERE (`groups`.`hide_from_global_feed` = 0 OR `groups`.`name` IS NULL) AND ((`profiles`.`profile_type` = 0 AND `profiles`.`hide_global_feed` = 0) OR `profiles`.`first_name` IS NULL) AND `posts`.`deleted` = 0 AND `posts`.`suggested` = 0";
|
||||
$queryBase .= "WHERE (`groups`.`hide_from_global_feed` = 0 OR `groups`.`name` IS NULL) AND (`profiles`.`profile_type` = 0 OR `profiles`.`first_name` IS NULL) AND `posts`.`deleted` = 0 AND `posts`.`suggested` = 0";
|
||||
|
||||
if ($this->user->identity->getNsfwTolerance() === User::NSFW_INTOLERANT) {
|
||||
$queryBase .= " AND `nsfw` = 0";
|
||||
|
|
|
@ -60,10 +60,6 @@
|
|||
<label for="city">{_admin_verification}</label>
|
||||
<input class="toggle-large" type="checkbox" id="verify" name="verify" value="1" {if $user->isVerified()} checked {/if} />
|
||||
</div>
|
||||
<div class="field-group">
|
||||
<label for="city">{_admin_hide_global_feed}</label>
|
||||
<input class="toggle-large" type="checkbox" id="hide_global_feed" name="hide_global_feed" value="1" n:attr="checked => $user->HideGlobalFeed()" />
|
||||
</div>
|
||||
<div class="field-group">
|
||||
<label for="city">{_admin_user_online}</label>
|
||||
<select name="online" class="select">
|
||||
|
|
|
@ -56,6 +56,29 @@
|
|||
>
|
||||
{_changes_history}
|
||||
</a>
|
||||
<a n:if="$canReport ?? false" class="profile_link" style="display:block;width:96%;" href="javascript:reportPost({$post->getId()})">{_report}</a>
|
||||
<a n:if="$canReport ?? false" class="profile_link" style="display:block;width:96%;" href="javascript:reportPost()">{_report}</a>
|
||||
</div>
|
||||
<script n:if="$canReport ?? false">
|
||||
function reportPost() {
|
||||
uReportMsgTxt = tr("going_to_report_post");
|
||||
uReportMsgTxt += "<br/>"+tr("report_question_text");
|
||||
uReportMsgTxt += "<br/><br/><b>"+tr("report_reason")+"</b>: <input type='text' id='uReportMsgInput' placeholder='" + tr("reason") + "' />"
|
||||
|
||||
MessageBox(tr("report_question"), uReportMsgTxt, [tr("confirm_m"), tr("cancel")], [
|
||||
(function() {
|
||||
res = document.querySelector("#uReportMsgInput").value;
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "/report/" + {$post->getId()} + "?reason=" + res + "&type=post", true);
|
||||
xhr.onload = (function() {
|
||||
if(xhr.responseText.indexOf("reason") === -1)
|
||||
MessageBox(tr("error"), tr("error_sending_report"), ["OK"], [Function.noop]);
|
||||
else
|
||||
MessageBox(tr("action_successfully"), tr("will_be_watched"), ["OK"], [Function.noop]);
|
||||
});
|
||||
xhr.send(null);
|
||||
}),
|
||||
Function.noop
|
||||
]);
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
<span n:if="$post->isPinned()" class="nobold">{_pinned}</span>
|
||||
|
||||
<a n:if="$canBeDeleted && !($forceNoDeleteLink ?? false) && $compact == false" class="delete" href="/wall{$post->getPrettyId()}/delete"></a>
|
||||
<a n:if="!$canBeDeleted" class="report" title="{_report}" href="javascript:reportPost({$post->getId()})"></a>
|
||||
|
||||
{if $canBePinned && !($forceNoPinLink ?? false) && $compact == false}
|
||||
{if $post->isPinned()}
|
||||
|
|
|
@ -133,16 +133,8 @@
|
|||
|
||||
{if !($forceNoDeleteLink ?? false) && $canBeDeleted}
|
||||
<a href="/wall{$post->getPrettyId()}/delete">{_delete}</a> |
|
||||
{/if}
|
||||
|
||||
{if $feedIgnoreButton && !$canBeDeleted}
|
||||
<a id="__ignoreSomeoneFeed" data-val='1' data-id="{$wallOwner->getRealId()}">{_feed_ignore}</a> |
|
||||
{/if}
|
||||
|
||||
{if !$canBeDeleted}
|
||||
<a href="javascript:reportPost({$post->getId()})">{_report}</a> |
|
||||
{/if}
|
||||
|
||||
|
||||
{if !($forceNoPinLink ?? false) && $canBePinned}
|
||||
{if $post->isPinned()}
|
||||
<a href="/wall{$post->getPrettyId()}/pin?act=unpin&hash={rawurlencode($csrfToken)}">{_unpin}</a>
|
||||
|
|
|
@ -86,20 +86,6 @@
|
|||
background-color: rgb(240, 240, 240);
|
||||
}
|
||||
|
||||
.report {
|
||||
float: right;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
overflow: auto;
|
||||
background: url("/assets/packages/static/openvk/img/report.png") no-repeat 0 0;
|
||||
opacity: 0.1;
|
||||
transition-duration: 0.3s;
|
||||
}
|
||||
|
||||
.report:hover {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.post-author .delete {
|
||||
float: right;
|
||||
height: 16px;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 169 B |
|
@ -43,53 +43,6 @@ u(document).on("click", "#__ignoreSomeone", async (e) => {
|
|||
}
|
||||
})
|
||||
|
||||
u(document).on("click", "#__ignoreSomeoneFeed", async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
const TARGET = u(e.target)
|
||||
const ENTITY_ID = Number(e.target.dataset.id)
|
||||
const VAL = Number(e.target.dataset.val)
|
||||
const ACT = VAL == 1 ? 'ignore' : 'unignore'
|
||||
const METHOD_NAME = ACT == 'ignore' ? 'addBan' : 'deleteBan'
|
||||
const PARAM_NAME = ENTITY_ID < 0 ? 'group_ids' : 'user_ids'
|
||||
const ENTITY_NAME = ENTITY_ID < 0 ? 'club' : 'user'
|
||||
const URL = `/method/newsfeed.${METHOD_NAME}?auth_mechanism=roaming&${PARAM_NAME}=${Math.abs(ENTITY_ID)}`
|
||||
|
||||
TARGET.closest('.post').addClass('lagged')
|
||||
const REQ = await fetch(URL)
|
||||
const RES = await REQ.json()
|
||||
TARGET.closest('.post').removeClass('lagged')
|
||||
|
||||
if(RES.error_code) {
|
||||
switch(RES.error_code) {
|
||||
case -10:
|
||||
fastError(';/')
|
||||
break
|
||||
case -50:
|
||||
fastError(tr('ignored_sources_limit'))
|
||||
break
|
||||
default:
|
||||
fastError(res.error_msg)
|
||||
break
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if(RES.response == 1) {
|
||||
if(ACT == 'unignore') {
|
||||
TARGET.closest('.scroll_node').find('.post').removeClass('post-hidden');
|
||||
TARGET.closest('.ignore-message').remove()
|
||||
} else {
|
||||
TARGET.closest('.post').addClass('post-hidden');
|
||||
TARGET.closest('.scroll_node').append(`
|
||||
<div class="ignore-message" width="100%">
|
||||
${tr(`feed_${ENTITY_NAME}_ignored`)} <a id="__ignoreSomeoneFeed" data-val='0' data-id='${ENTITY_ID}' href="#">${tr('feed_unignore')}</a>
|
||||
</div>
|
||||
`)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
u(document).on('click', '#__feed_settings_link', (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
|
@ -353,26 +306,3 @@ function openJsSettings() {
|
|||
</tr>
|
||||
`)
|
||||
}
|
||||
|
||||
|
||||
function reportPost(postId) {
|
||||
uReportMsgTxt = tr("going_to_report_post");
|
||||
uReportMsgTxt += "<br/>"+tr("report_question_text");
|
||||
uReportMsgTxt += "<br/><br/><b>"+tr("report_reason")+"</b>: <input type='text' id='uReportMsgInput' placeholder='" + tr("reason") + "' />"
|
||||
|
||||
MessageBox(tr("report_question"), uReportMsgTxt, [tr("confirm_m"), tr("cancel")], [
|
||||
(function() {
|
||||
res = document.querySelector("#uReportMsgInput").value;
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "/report/" + postId + "?reason=" + res + "&type=post", true);
|
||||
xhr.onload = (function() {
|
||||
if(xhr.responseText.indexOf("reason") === -1)
|
||||
MessageBox(tr("error"), tr("error_sending_report"), ["OK"], [Function.noop]);
|
||||
else
|
||||
MessageBox(tr("action_successfully"), tr("will_be_watched"), ["OK"], [Function.noop]);
|
||||
});
|
||||
xhr.send(null);
|
||||
}),
|
||||
Function.noop
|
||||
]);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `profiles` ADD COLUMN `hide_global_feed` boolean DEFAULT 0 NOT NULL AFTER `deleted`;
|
|
@ -1679,7 +1679,6 @@
|
|||
"admin_first_known_ip" = "First known IP";
|
||||
"admin_shortcode" = "Short code";
|
||||
"admin_verification" = "Verification";
|
||||
"admin_hide_global_feed" = "Hide global feed";
|
||||
"admin_banreason" = "Ban reason";
|
||||
"admin_banned" = "banned";
|
||||
"admin_gender" = "Sex";
|
||||
|
|
|
@ -1582,7 +1582,6 @@
|
|||
"admin_first_known_ip" = "Первый IP";
|
||||
"admin_shortcode" = "Короткий адрес";
|
||||
"admin_verification" = "Верификация";
|
||||
"admin_hide_global_feed" = "Не отображать в глобальной ленте";
|
||||
"admin_banreason" = "Причина блокировки";
|
||||
"admin_banned" = "заблокирован";
|
||||
"admin_actions" = "Действия";
|
||||
|
|
Loading…
Reference in a new issue