mirror of
https://github.com/openvk/openvk
synced 2025-05-05 08:36:38 +03:00
fix: resolve issues related to API listens field, anonymous notifications, and UX bugs (#1279)
- Исправлено #1278 по идее - Добавил поле listens в апи (показывается только для своих треков) - Исправлен старинный баг, связанный с анонимкой (в уведомлении виден реальный автор) - Было неправильно добавлять ссылку на "избранное" в навигационное меню, поэтому она перенесена в настройки на довольно логичное место - Удалены некоторые импульсивности в коде и некоторые баги ux --------- Co-authored-by: Alexander Minkin <weryskok@gmail.com>
This commit is contained in:
parent
c54ccf6e28
commit
1d06a41b39
15 changed files with 48 additions and 23 deletions
|
@ -722,7 +722,7 @@ final class Wall extends VKAPIRequestHandler
|
||||||
$post->attach($attachment);
|
$post->attach($attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($owner_id > 0 && $owner_id !== $this->user->identity->getId()) {
|
if ($owner_id > 0 && $owner_id !== $this->getUser()->getId()) {
|
||||||
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1176,8 +1176,9 @@ final class Wall extends VKAPIRequestHandler
|
||||||
if ($from_group == 1 && $wallOwner instanceof Club && $wallOwner->canBeModifiedBy($this->getUser())) {
|
if ($from_group == 1 && $wallOwner instanceof Club && $wallOwner->canBeModifiedBy($this->getUser())) {
|
||||||
$flags |= 0b10000000;
|
$flags |= 0b10000000;
|
||||||
}
|
}
|
||||||
/*if($signed == 1)
|
if ($post->isSigned() && $from_group == 1) {
|
||||||
$flags |= 0b01000000;*/
|
$flags |= 0b01000000;
|
||||||
|
}
|
||||||
|
|
||||||
$post->setFlags($flags);
|
$post->setFlags($flags);
|
||||||
$post->save(true);
|
$post->save(true);
|
||||||
|
|
|
@ -435,6 +435,10 @@ class Audio extends Media
|
||||||
$obj->keys = $this->getKeys();
|
$obj->keys = $this->getKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($obj->editable) {
|
||||||
|
$obj->listens = $this->getListens();
|
||||||
|
}
|
||||||
|
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,14 +168,13 @@ class Notification
|
||||||
case 19:
|
case 19:
|
||||||
$info["type"] = "comment_video";
|
$info["type"] = "comment_video";
|
||||||
$info["parent"] = $this->getModel(0)->toNotifApiStruct();
|
$info["parent"] = $this->getModel(0)->toNotifApiStruct();
|
||||||
$info["feedback"] = null; # айди коммента не сохраняется в бд( ну пиздец блять
|
$info["feedback"] = null; # comment id is not saving at db
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
$info["type"] = "comment_photo";
|
$info["type"] = "comment_photo";
|
||||||
$info["parent"] = $this->getModel(0)->toNotifApiStruct();
|
$info["parent"] = $this->getModel(0)->toNotifApiStruct();
|
||||||
$info["feedback"] = null;
|
$info["feedback"] = null;
|
||||||
break;
|
break;
|
||||||
# unstandart (vk forgor about notes)
|
|
||||||
case 10:
|
case 10:
|
||||||
$info["type"] = "comment_note";
|
$info["type"] = "comment_note";
|
||||||
$info["parent"] = $this->getModel(0)->toVkApiStruct();
|
$info["parent"] = $this->getModel(0)->toVkApiStruct();
|
||||||
|
|
|
@ -508,7 +508,7 @@ final class AudioPresenter extends OpenVKPresenter
|
||||||
$title = $this->postParam("title");
|
$title = $this->postParam("title");
|
||||||
$description = $this->postParam("description");
|
$description = $this->postParam("description");
|
||||||
$is_unlisted = (int) $this->postParam('is_unlisted');
|
$is_unlisted = (int) $this->postParam('is_unlisted');
|
||||||
$new_audios = !empty($this->postParam("audios")) ? explode(",", rtrim($this->postParam("audios"), ",")) : [];
|
$new_audios = !empty($this->postParam("audios")) ? explode(",", rtrim($this->postParam("audios"), ",")) : null;
|
||||||
|
|
||||||
if (empty($title) || iconv_strlen($title) < 1) {
|
if (empty($title) || iconv_strlen($title) < 1) {
|
||||||
$this->flashFail("err", tr("error"), tr("set_playlist_name"));
|
$this->flashFail("err", tr("error"), tr("set_playlist_name"));
|
||||||
|
@ -538,6 +538,7 @@ final class AudioPresenter extends OpenVKPresenter
|
||||||
"collection" => $playlist->getId(),
|
"collection" => $playlist->getId(),
|
||||||
])->delete();
|
])->delete();
|
||||||
|
|
||||||
|
if (!is_null($new_audios)) {
|
||||||
foreach ($new_audios as $new_audio) {
|
foreach ($new_audios as $new_audio) {
|
||||||
$audio = (new Audios())->get((int) $new_audio);
|
$audio = (new Audios())->get((int) $new_audio);
|
||||||
if (!$audio || $audio->isDeleted()) {
|
if (!$audio || $audio->isDeleted()) {
|
||||||
|
@ -546,6 +547,7 @@ final class AudioPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$playlist->add($audio);
|
$playlist->add($audio);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($is_ajax) {
|
if ($is_ajax) {
|
||||||
$this->returnJson([
|
$this->returnJson([
|
||||||
|
|
|
@ -165,7 +165,7 @@ final class InternalAPIPresenter extends OpenVKPresenter
|
||||||
if ($type == 'post') {
|
if ($type == 'post') {
|
||||||
$this->template->_template = 'components/post.xml';
|
$this->template->_template = 'components/post.xml';
|
||||||
$this->template->post = $post;
|
$this->template->post = $post;
|
||||||
$this->template->commentSection = false;
|
$this->template->commentSection = true;
|
||||||
} elseif ($type == 'comment') {
|
} elseif ($type == 'comment') {
|
||||||
$this->template->_template = 'components/comment.xml';
|
$this->template->_template = 'components/comment.xml';
|
||||||
$this->template->comment = $post;
|
$this->template->comment = $post;
|
||||||
|
|
|
@ -321,7 +321,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$photos = [];
|
$photos = [];
|
||||||
if ((int) $this->postParam("count") > 10) {
|
if ((int) $this->postParam("count") > 10) {
|
||||||
$this->flashFail("err", tr("no_photo"), "ты еблан", 500, true);
|
$this->flashFail("err", tr("no_photo"), "Too many photos (max is 7-8)", 500, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $this->postParam("count"); $i++) {
|
for ($i = 0; $i < $this->postParam("count"); $i++) {
|
||||||
|
|
|
@ -42,7 +42,6 @@ final class SearchPresenter extends OpenVKPresenter
|
||||||
$page = (int) ($this->queryParam("p") ?? 1);
|
$page = (int) ($this->queryParam("p") ?? 1);
|
||||||
|
|
||||||
# https://youtu.be/pSAWM5YuXx8
|
# https://youtu.be/pSAWM5YuXx8
|
||||||
# https://youtu.be/FfNZRhIn2Vk
|
|
||||||
|
|
||||||
$repos = [
|
$repos = [
|
||||||
"groups" => "clubs",
|
"groups" => "clubs",
|
||||||
|
|
|
@ -409,7 +409,12 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($wall > 0 && $wall !== $this->user->identity->getId()) {
|
if ($wall > 0 && $wall !== $this->user->identity->getId()) {
|
||||||
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
$disturber = $this->user->identity;
|
||||||
|
if ($anon) {
|
||||||
|
$disturber = $post->getOwner();
|
||||||
|
}
|
||||||
|
|
||||||
|
(new WallPostNotification($wallOwner, $post, $disturber))->emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$excludeMentions = [$this->user->identity->getId()];
|
$excludeMentions = [$this->user->identity->getId()];
|
||||||
|
|
|
@ -198,11 +198,11 @@
|
||||||
</a>
|
</a>
|
||||||
<a href="/settings" class="link">{_my_settings}</a>
|
<a href="/settings" class="link">{_my_settings}</a>
|
||||||
|
|
||||||
{if $thisUser->getLeftMenuItemStatus('docs') || $thisUser->getLeftMenuItemStatus('apps') || $thisUser->getLeftMenuItemStatus('fave')}
|
{if $thisUser->getLeftMenuItemStatus('docs') || $thisUser->getLeftMenuItemStatus('apps')}
|
||||||
<div class="menu_divider"></div>
|
<div class="menu_divider"></div>
|
||||||
<a n:if="$thisUser->getLeftMenuItemStatus('apps')" href="/apps?act=installed" class="link">{_apps}</a>
|
<a n:if="$thisUser->getLeftMenuItemStatus('apps')" href="/apps?act=installed" class="link">{_apps}</a>
|
||||||
<a n:if="$thisUser->getLeftMenuItemStatus('docs')" href="/docs" class="link">{_my_documents}</a>
|
<a n:if="$thisUser->getLeftMenuItemStatus('docs')" href="/docs" class="link">{_my_documents}</a>
|
||||||
<a n:if="$thisUser->getLeftMenuItemStatus('fave')" href="/fave" class="link">{_bookmarks_tab}</a>
|
{*<a n:if="$thisUser->getLeftMenuItemStatus('fave')" href="/fave" class="link">{_bookmarks_tab}</a>*}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{var $canAccessAdminPanel = $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
|
{var $canAccessAdminPanel = $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
|
||||||
|
|
|
@ -120,6 +120,10 @@
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<div class="settings_delete">
|
<div class="settings_delete">
|
||||||
|
<a href="/fave">{_bookmarks_tab}</a>
|
||||||
|
•
|
||||||
|
<a href="/search?section=posts&from_me=1">{_s_posts}</a>
|
||||||
|
<br><br>
|
||||||
{_you_can_also} <a onClick="showProfileDeactivateDialog({$csrfToken})">{_delete_your_page}</a>.
|
{_you_can_also} <a onClick="showProfileDeactivateDialog({$csrfToken})">{_delete_your_page}</a>.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -707,7 +711,7 @@
|
||||||
<span class="nobold">{_my_documents}</span>
|
<span class="nobold">{_my_documents}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr style="display:none;">
|
||||||
<td width="120" valign="top" align="right" align="right">
|
<td width="120" valign="top" align="right" align="right">
|
||||||
<input
|
<input
|
||||||
n:attr="checked => $user->getLeftMenuItemStatus('fave')"
|
n:attr="checked => $user->getLeftMenuItemStatus('fave')"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{if !$attachment->isDeleted()}
|
{if !$attachment->isDeleted()}
|
||||||
{var $link = "/photo" . ($attachment->isAnonymous() ? ("s/" . base_convert((string) $attachment->getId(), 10, 32)) : $attachment->getPrettyId())}
|
{var $link = "/photo" . ($attachment->isAnonymous() ? ("s/" . base_convert((string) $attachment->getId(), 10, 32)) : $attachment->getPrettyId())}
|
||||||
<a href="{$link}" onclick="OpenMiniature(event, {$attachment->getURLBySizeId('larger')}, {$parent->getPrettyId()}, {$attachment->getPrettyId()}, {$parentType})">
|
<a href="{$link}" onclick="OpenMiniature(event, {$attachment->getURLBySizeId('larger')}, {$parent->getPrettyId()}, {$attachment->getPrettyId()}, {$parentType})">
|
||||||
<img class="media media_makima" src="{$attachment->getURLBySizeId('normal')}" alt="{$attachment->getDescription()}" loading=lazy />
|
<img n:class="media, $tilesCount > 1 ? media_makima" src="{$attachment->getURLBySizeId('normal')}" alt="{$attachment->getDescription()}" loading=lazy />
|
||||||
</a>
|
</a>
|
||||||
{else}
|
{else}
|
||||||
<a href="javascript:alert('{_attach_no_longer_available}');">
|
<a href="javascript:alert('{_attach_no_longer_available}');">
|
||||||
|
|
|
@ -11,6 +11,7 @@ body {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
line-height: 1.19;
|
||||||
}
|
}
|
||||||
|
|
||||||
body, .ovk-fullscreen-dimmer, .ovk-photo-view-dimmer {
|
body, .ovk-fullscreen-dimmer, .ovk-photo-view-dimmer {
|
||||||
|
|
|
@ -330,8 +330,10 @@ window.player = new class {
|
||||||
this.__updateFace()
|
this.__updateFace()
|
||||||
u(this.audioPlayer).trigger('volumechange')
|
u(this.audioPlayer).trigger('volumechange')
|
||||||
|
|
||||||
|
if(this.isAtAudiosPage()) {
|
||||||
document.title = ovk_proc_strtr(escapeHtml(`${window.player.currentTrack.performer} — ${window.player.currentTrack.name}`), 255)
|
document.title = ovk_proc_strtr(escapeHtml(`${window.player.currentTrack.performer} — ${window.player.currentTrack.name}`), 255)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hasContext() {
|
hasContext() {
|
||||||
return this.context.object && this.context.object.url
|
return this.context.object && this.context.object.url
|
||||||
|
|
|
@ -2471,7 +2471,6 @@ u(document).on('click', '#__sourceAttacher', (e) => {
|
||||||
const __checkCopyrightLinkRes = await fetch(`/method/wall.checkCopyrightLink?auth_mechanism=roaming&link=${encodeURIComponent(source_value)}`)
|
const __checkCopyrightLinkRes = await fetch(`/method/wall.checkCopyrightLink?auth_mechanism=roaming&link=${encodeURIComponent(source_value)}`)
|
||||||
const checkCopyrightLink = await __checkCopyrightLinkRes.json()
|
const checkCopyrightLink = await __checkCopyrightLinkRes.json()
|
||||||
|
|
||||||
// todo переписать блять мессенджбоксы чтоб они классами были
|
|
||||||
if(checkCopyrightLink.error_code) {
|
if(checkCopyrightLink.error_code) {
|
||||||
__removeDialog()
|
__removeDialog()
|
||||||
switch(checkCopyrightLink.error_code) {
|
switch(checkCopyrightLink.error_code) {
|
||||||
|
|
|
@ -674,3 +674,12 @@ ul {
|
||||||
.ovk-modal-player-window #ovk-player-info {
|
.ovk-modal-player-window #ovk-player-info {
|
||||||
background: #0e0b1a;
|
background: #0e0b1a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header_navigation #search_box #searchBoxFastTips {
|
||||||
|
background: #181826;
|
||||||
|
border-color: #2c2640;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header_navigation #search_box #searchBoxFastTips a:hover, .header_navigation #search_box #searchBoxFastTips a:focus {
|
||||||
|
background: #111322;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue