mirror of
https://github.com/openvk/openvk
synced 2024-11-14 19:19:14 +03:00
self-review
This commit is contained in:
parent
55bc872046
commit
de937f65a1
7 changed files with 114 additions and 95 deletions
|
@ -24,7 +24,7 @@ final class Video extends VKAPIRequestHandler
|
|||
$items = [];
|
||||
|
||||
$video = (new VideosRepo)->getByOwnerAndVID(intval($id[0]), intval($id[1]));
|
||||
if($video) {
|
||||
if($video && !$video->isDeleted()) {
|
||||
$out_video = $video->getApiStructure($this->getUser())->video;
|
||||
$items[] = $out_video;
|
||||
if($out_video['owner_id']) {
|
||||
|
|
|
@ -1026,7 +1026,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
}
|
||||
}
|
||||
|
||||
if(empty($message) && empty($attachments))
|
||||
if(empty($message) && sizeof($final_attachments) < 1)
|
||||
$this->fail(100, "Required parameter 'message' missing.");
|
||||
|
||||
if(!$comment || $comment->isDeleted())
|
||||
|
|
|
@ -366,7 +366,7 @@
|
|||
</div>
|
||||
|
||||
<div id="ajloader" class="loader">
|
||||
<img src="/assets/packages/static/openvk/img/loading_mini.gif" style="width: 40px;">
|
||||
<img src="/assets/packages/static/openvk/img/loading_mini.gif">
|
||||
</div>
|
||||
|
||||
{include "components/cookies.xml"}
|
||||
|
@ -428,7 +428,7 @@
|
|||
window.openvk = {
|
||||
"audio_genres": {\openvk\Web\Models\Entities\Audio::genres},
|
||||
"at_search": {$atSearch ?? false},
|
||||
"max_attachments": {\OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"]},
|
||||
"max_attachments": {\OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"] ?? 10},
|
||||
"max_filesize_mb": 5,
|
||||
"current_id": {$thisUser ? $thisUser->getId() : 0},
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class='post-edit'></div>
|
||||
<div n:if="!($compact ?? false)" class="post-menu">
|
||||
{if is_null($thisUser)}
|
||||
{var $forceNoDeleteLink = true}
|
||||
|
|
|
@ -727,7 +727,7 @@ u(document).on("click", "#editPost", async (e) => {
|
|||
|
||||
target.removeClass('lagged')
|
||||
|
||||
edit_place.find('.edit_menu #__edit_save').on('click', async (e) => {
|
||||
edit_place.find('.edit_menu #__edit_save').on('click', async (ev) => {
|
||||
const text_node = edit_place.find('.edit_menu textarea')
|
||||
const nsfw_mark = edit_place.find(`.edit_menu input[name='nsfw']`)
|
||||
const as_group = edit_place.find(`.edit_menu input[name='as_group']`)
|
||||
|
@ -756,7 +756,7 @@ u(document).on("click", "#editPost", async (e) => {
|
|||
params['copyright'] = copyright.nodes[0].value
|
||||
}
|
||||
|
||||
u(e.target).addClass('lagged')
|
||||
u(ev.target).addClass('lagged')
|
||||
// больше двух запросов !
|
||||
try {
|
||||
if(type == 'post') {
|
||||
|
@ -767,16 +767,18 @@ u(document).on("click", "#editPost", async (e) => {
|
|||
}
|
||||
} catch(e) {
|
||||
fastError(e.message)
|
||||
u(e.target).removeClass('lagged')
|
||||
u(ev.target).removeClass('lagged')
|
||||
return
|
||||
}
|
||||
|
||||
const new_post_html = await (await fetch(`/iapi/getPostTemplate/${id[0]}_${id[1]}?type=${type}`, {
|
||||
'method': 'POST'
|
||||
})).text()
|
||||
u(e.target).removeClass('lagged')
|
||||
u(ev.target).removeClass('lagged')
|
||||
post.removeClass('editing')
|
||||
post.nodes[0].outerHTML = new_post_html
|
||||
|
||||
bsdnHydrate()
|
||||
})
|
||||
|
||||
edit_place.find('.edit_menu #__edit_cancel').on('click', (e) => {
|
||||
|
@ -1139,6 +1141,11 @@ u(document).on('click', '#__videoAttachment', async (e) => {
|
|||
|
||||
u("#gif_loader").remove()
|
||||
const pages_count = Math.ceil(Number(videos.count) / per_page)
|
||||
|
||||
if(pages_count < 1) {
|
||||
insert_place.append(query == '' ? tr('no_videos') : tr('no_videos_results'))
|
||||
}
|
||||
|
||||
videos.items.forEach(video => {
|
||||
const pretty_id = `${video.owner_id}_${video.id}`
|
||||
const is_attached = (form.find(`.upload-item[data-type='video'][data-id='${video.owner_id}_${video.id}']`)).length > 0
|
||||
|
@ -1294,6 +1301,11 @@ u(document).on('click', '#__notesAttachment', async (e) => {
|
|||
|
||||
u("#gif_loader").remove()
|
||||
const pages_count = Math.ceil(Number(notes.count) / per_page)
|
||||
|
||||
if(notes.count < 1) {
|
||||
insert_place.append(tr('no_notes'))
|
||||
}
|
||||
|
||||
notes.notes.forEach(note => {
|
||||
is_attached = (form.find(`.upload-item[data-type='note'][data-id='${note.owner_id}_${note.id}']`)).length > 0
|
||||
insert_place.append(`
|
||||
|
@ -1583,7 +1595,10 @@ async function repost(id, repost_type = 'post') {
|
|||
const repostsCount = u(`#repostsCount${id}`)
|
||||
const previousVal = repostsCount.length > 0 ? Number(repostsCount.html()) : 0;
|
||||
|
||||
MessageBox(tr('share'), `
|
||||
const msg = new CMessageBox({
|
||||
title: tr('share'),
|
||||
unique_name: 'repost_modal',
|
||||
body: `
|
||||
<div class='display_flex_column' style='gap: 1px;'>
|
||||
<b>${tr('auditory')}</b>
|
||||
|
||||
|
@ -1611,7 +1626,9 @@ async function repost(id, repost_type = 'post') {
|
|||
<label><input type='checkbox' name="signed">${tr('add_signature')}</label>
|
||||
</div>
|
||||
</div>
|
||||
`, [tr('send'), tr('cancel')], [
|
||||
`,
|
||||
buttons: [tr('send'), tr('cancel')],
|
||||
callbacks: [
|
||||
async () => {
|
||||
const message = u('#repostMsgInput').nodes[0].value
|
||||
const type = u(`input[name='repost_type']:checked`).nodes[0].value
|
||||
|
@ -1672,7 +1689,8 @@ async function repost(id, repost_type = 'post') {
|
|||
}
|
||||
},
|
||||
Function.noop
|
||||
]);
|
||||
]
|
||||
});
|
||||
|
||||
u('.ovk-diag-body').attr('style', 'padding: 14px;')
|
||||
u('.ovk-diag-body').on('change', `input[name='repost_type']`, (e) => {
|
||||
|
|
|
@ -235,7 +235,7 @@ function ovk_is_ssl(): bool
|
|||
function parseAttachments($attachments, array $allow_types = ['photo', 'video', 'note', 'audio']): array
|
||||
{
|
||||
$exploded_attachments = is_array($attachments) ? $attachments : explode(",", $attachments);
|
||||
$exploded_attachments = array_slice($exploded_attachments, 0, OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"]);
|
||||
$exploded_attachments = array_slice($exploded_attachments, 0, OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"] ?? 10);
|
||||
$imploded_types = implode('|', $allow_types);
|
||||
$output_attachments = [];
|
||||
$repositories = [
|
||||
|
|
Loading…
Reference in a new issue