From c26e6420b4d2b3761a2be4422abb5900446335b4 Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 12:33:26 +0300 Subject: [PATCH 01/12] feat(FeedIgnore): added draft of ignore feature to the feed posts --- Web/Presenters/WallPresenter.php | 3 ++- Web/Presenters/templates/components/post/microblogpost.xml | 3 ++- Web/Presenters/templates/components/post/oldpost.xml | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index f4a8e898..aa238d65 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -102,7 +102,7 @@ final class WallPresenter extends OpenVKPresenter break; } - $this->template->owner = $user; + $this->template->owner = $user; $this->template->canPost = $canPost; $this->template->count = $count; $this->template->type = $type; @@ -113,6 +113,7 @@ final class WallPresenter extends OpenVKPresenter "amount" => sizeof($this->template->posts), "perPage" => OPENVK_DEFAULT_PER_PAGE, ]; + $this->template->ignore_status = $owner->isIgnoredBy($this->user->identity); $this->logPostsViewed($this->template->posts, $user); diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index b39b8239..0f6032d1 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -57,7 +57,8 @@ {_pinned} - + + {if $canBePinned && !($forceNoPinLink ?? false) && $compact == false} {if $post->isPinned()} diff --git a/Web/Presenters/templates/components/post/oldpost.xml b/Web/Presenters/templates/components/post/oldpost.xml index 3612aa1d..a1d6a34e 100644 --- a/Web/Presenters/templates/components/post/oldpost.xml +++ b/Web/Presenters/templates/components/post/oldpost.xml @@ -133,6 +133,10 @@ {if !($forceNoDeleteLink ?? false) && $canBeDeleted} {_delete}  |  + {/if} + + {if !$canBeDeleted} + {if !$ignore_status}{_ignore_user}{else}{_unignore_user}{/if}  |  {/if} {if !($forceNoPinLink ?? false) && $canBePinned} From 276474641b84df6262b38652d22d3b0c443d49cc Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 12:54:44 +0300 Subject: [PATCH 02/12] fix(FeedIgnore): Linter is crazy xd --- Web/Presenters/WallPresenter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index aa238d65..709a0091 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -102,7 +102,7 @@ final class WallPresenter extends OpenVKPresenter break; } - $this->template->owner = $user; + $this->template->owner = $user; $this->template->canPost = $canPost; $this->template->count = $count; $this->template->type = $type; From 033a04eec0b83e39c2d61f5806c574eb77ac801a Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 13:26:27 +0300 Subject: [PATCH 03/12] style: created css class for button --- .../templates/components/post/microblogpost.xml | 2 +- Web/static/css/microblog.css | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index 0f6032d1..5933f4bb 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -58,7 +58,7 @@ {_pinned} - + {if $canBePinned && !($forceNoPinLink ?? false) && $compact == false} {if $post->isPinned()} diff --git a/Web/static/css/microblog.css b/Web/static/css/microblog.css index 503af42a..571b4c30 100644 --- a/Web/static/css/microblog.css +++ b/Web/static/css/microblog.css @@ -86,6 +86,17 @@ background-color: rgb(240, 240, 240); } +.ignore { + float: right; + height: 16px; + width: 16px; + overflow: auto; + background: url("/assets/packages/static/openvk/img/audios_controls.png") no-repeat 0 0; + background-position: -51px -67px; + opacity: 0.2; + transition-duration: 0.3s; +} + .post-author .delete { float: right; height: 16px; From ddefa148818b73b504bcb0025d4dffeeb495be99 Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 13:34:51 +0300 Subject: [PATCH 04/12] style: fix hover --- Web/static/css/microblog.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Web/static/css/microblog.css b/Web/static/css/microblog.css index 571b4c30..89cf5dda 100644 --- a/Web/static/css/microblog.css +++ b/Web/static/css/microblog.css @@ -93,10 +93,14 @@ overflow: auto; background: url("/assets/packages/static/openvk/img/audios_controls.png") no-repeat 0 0; background-position: -51px -67px; - opacity: 0.2; + opacity: 0.1; transition-duration: 0.3s; } +.ignore:hover { + opacity: 0.4; +} + .post-author .delete { float: right; height: 16px; From 90a3352c993624d4a30185dc45dad33eb669dcf0 Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 19:35:03 +0300 Subject: [PATCH 05/12] feat(FeedIgnore): remove garbage logic --- Web/Presenters/WallPresenter.php | 1 - Web/Presenters/templates/components/post/microblogpost.xml | 2 +- Web/Presenters/templates/components/post/oldpost.xml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 709a0091..f4a8e898 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -113,7 +113,6 @@ final class WallPresenter extends OpenVKPresenter "amount" => sizeof($this->template->posts), "perPage" => OPENVK_DEFAULT_PER_PAGE, ]; - $this->template->ignore_status = $owner->isIgnoredBy($this->user->identity); $this->logPostsViewed($this->template->posts, $user); diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index 5933f4bb..b1bd2cbe 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -58,7 +58,7 @@ {_pinned} - + {if $canBePinned && !($forceNoPinLink ?? false) && $compact == false} {if $post->isPinned()} diff --git a/Web/Presenters/templates/components/post/oldpost.xml b/Web/Presenters/templates/components/post/oldpost.xml index a1d6a34e..9c38ac86 100644 --- a/Web/Presenters/templates/components/post/oldpost.xml +++ b/Web/Presenters/templates/components/post/oldpost.xml @@ -136,7 +136,7 @@ {/if} {if !$canBeDeleted} - {if !$ignore_status}{_ignore_user}{else}{_unignore_user}{/if}  |  + {_ignore_user}  |  {/if} {if !($forceNoPinLink ?? false) && $canBePinned} From 47b14a4190840fc5e3ed3adfd7b7106ab3c1115d Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 19:42:15 +0300 Subject: [PATCH 06/12] feat(FeedIgnore): icon now have sense --- Web/static/css/microblog.css | 3 +-- Web/static/img/ignore.png | Bin 0 -> 295 bytes 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 Web/static/img/ignore.png diff --git a/Web/static/css/microblog.css b/Web/static/css/microblog.css index 89cf5dda..3a2f6212 100644 --- a/Web/static/css/microblog.css +++ b/Web/static/css/microblog.css @@ -91,8 +91,7 @@ height: 16px; width: 16px; overflow: auto; - background: url("/assets/packages/static/openvk/img/audios_controls.png") no-repeat 0 0; - background-position: -51px -67px; + background: url("/assets/packages/static/openvk/img/ignore.png") no-repeat 0 0; opacity: 0.1; transition-duration: 0.3s; } diff --git a/Web/static/img/ignore.png b/Web/static/img/ignore.png new file mode 100644 index 0000000000000000000000000000000000000000..c743c568b9c0b59212fa2ff4692bfba3881cad97 GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s3?%0jwTl2L#^NA%C&rs6b?Si}mUKs7M+SzC z{oH>NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fF5lu!@w z32_C|S-l$%oWJ+@<%jZV+jILibuT;g{`2?B89VPkdw1*6>y>*h0@X~Dn0gdQF_r}R z1v5B2yO9RsBze2LFm$lWdH^|`1s;*bK$i-GFeAgPITAoY_7YEDSN4~zA_5vLYlPA! z0)-4bT^vI=qLUMVfR#~!H`&QTz|ep*nBh@_poeJ-??Z>134D{7W~6l-%y_2U!^#jh Wk1_AA{JBz~UItHBKbLh*2~7aA9#zW# literal 0 HcmV?d00001 From a2af0f849f1c315a26de5d9d0931d9821ad3a11b Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 21:47:22 +0300 Subject: [PATCH 07/12] feat(FeedIgnore): check is global feed --- Web/Presenters/WallPresenter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index f4a8e898..60497961 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -200,6 +200,7 @@ final class WallPresenter extends OpenVKPresenter foreach ($posts->page((int) ($_GET["p"] ?? 1), $perPage) as $post) { $this->template->posts[] = $this->posts->get($post->id); } + $this->template->feedIgnoreButton = true; } public function renderGlobalFeed(): void @@ -240,6 +241,7 @@ final class WallPresenter extends OpenVKPresenter foreach ($posts as $post) { $this->template->posts[] = $this->posts->get($post->id); } + $this->template->feedIgnoreButton = true; } public function renderHashtagFeed(string $hashtag): void From 67d8f4e351abee57e9577979f9fd53dc3fea7f94 Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 21:47:52 +0300 Subject: [PATCH 08/12] feat(FeedIgnore): design rework --- .../templates/components/post/microblogpost.xml | 4 ++-- Web/Presenters/templates/components/post/oldpost.xml | 4 ++-- Web/static/css/main.css | 9 +++++++++ Web/static/css/microblog.css | 9 +++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index b1bd2cbe..9142e5f5 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -57,8 +57,8 @@ {_pinned} - - + + {if $canBePinned && !($forceNoPinLink ?? false) && $compact == false} {if $post->isPinned()} diff --git a/Web/Presenters/templates/components/post/oldpost.xml b/Web/Presenters/templates/components/post/oldpost.xml index 9c38ac86..7c86382a 100644 --- a/Web/Presenters/templates/components/post/oldpost.xml +++ b/Web/Presenters/templates/components/post/oldpost.xml @@ -135,8 +135,8 @@ {_delete}  |  {/if} - {if !$canBeDeleted} - {_ignore_user}  |  + {if $feedIgnoreButton && !$canBeDeleted} + {_feed_ignore}  |  {/if} {if !($forceNoPinLink ?? false) && $canBePinned} diff --git a/Web/static/css/main.css b/Web/static/css/main.css index 0332d278..82fa41d7 100644 --- a/Web/static/css/main.css +++ b/Web/static/css/main.css @@ -914,6 +914,15 @@ h4 { } } +.post-hidden { + display: none; +} + +.ignore-message { + padding: 5px 0; +} + + .small-textarea { height: 24px; } diff --git a/Web/static/css/microblog.css b/Web/static/css/microblog.css index 3a2f6212..79272fac 100644 --- a/Web/static/css/microblog.css +++ b/Web/static/css/microblog.css @@ -100,6 +100,15 @@ opacity: 0.4; } +.post-hidden { + display: none; +} + +.ignore-message { + padding: 5px 0; + border-bottom: 1px #ddd solid; +} + .post-author .delete { float: right; height: 16px; From cb015a571068b00b6005c7124988666f58a0d8f7 Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 21:48:10 +0300 Subject: [PATCH 09/12] feat(FeedIgnore): added js listner --- Web/static/js/al_feed.js | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/Web/static/js/al_feed.js b/Web/static/js/al_feed.js index 66eeddf1..c35161bc 100644 --- a/Web/static/js/al_feed.js +++ b/Web/static/js/al_feed.js @@ -43,6 +43,53 @@ 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(` +
+ ${tr(`feed_${ENTITY_NAME}_ignored`)} ${tr('feed_unignore')} +
+ `) + } + } +}) + u(document).on('click', '#__feed_settings_link', (e) => { e.preventDefault() From 37a9c2fb56fb075986c812a341e1b40820c94242 Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 21:48:39 +0300 Subject: [PATCH 10/12] feat(FeedIgnore): added strings --- locales/en.strings | 5 +++++ locales/ru.strings | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/locales/en.strings b/locales/en.strings index bca784ef..fd13f8da 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -359,6 +359,11 @@ "subscriptions_one" = "$1 subscription"; "subscriptions_other" = "$1 subscriptions"; +"feed_user_ignored" = "User will no longer appear in the feed."; +"feed_club_ignored" = "Club will no longer appear in the feed."; +"feed_unignore" = "Restore."; +"feed_ignore" = "Not interested"; + /* Group */ "group" = "Group"; diff --git a/locales/ru.strings b/locales/ru.strings index f933d724..0a6080c6 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -290,6 +290,11 @@ "change_geo_name" = "Изменить название точки"; "change_geo_name_new" = "Новое название"; +"feed_user_ignored" = "Пользователь больше не будет появляться в ленте."; +"feed_club_ignored" = "Группа больше не будет появляться в ленте."; +"feed_unignore" = "Вернуть."; +"feed_ignore" = "Не интересно"; + /* Friends */ "friends" = "Друзья"; From f3f06ec090c29ce671dd816dd1e128f41d5c540f Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 20 May 2025 22:25:30 +0300 Subject: [PATCH 11/12] feat(FeedIgnore): added uk strings --- locales/uk.strings | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/locales/uk.strings b/locales/uk.strings index c54b4769..6295cbee 100644 --- a/locales/uk.strings +++ b/locales/uk.strings @@ -280,6 +280,11 @@ "change_geo_name" = "Змінити назву розташування"; "change_geo_name_new" = "Нова назва"; +"feed_user_ignored" = "Користувач більше не з'являтиметься у стрічці."; +"feed_club_ignored" = "Спiльнота більше не з'являтиметься у стрічці."; +"feed_unignore" = "Повернути."; +"feed_ignore" = "Не цікаво"; + /* Friends */ "friends" = "Друзі"; From d52e655a4c3d4b7e047fc7785e62dfe45d6c53ca Mon Sep 17 00:00:00 2001 From: xRy0 Date: Tue, 27 May 2025 15:01:36 +0300 Subject: [PATCH 12/12] feat(FeedIgnore): changed icon --- .../templates/components/post/microblogpost.xml | 2 +- Web/static/img/ignore.png | Bin 295 -> 0 bytes 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 Web/static/img/ignore.png diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index 9142e5f5..cb005144 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -58,7 +58,7 @@ {_pinned} - + {if $canBePinned && !($forceNoPinLink ?? false) && $compact == false} {if $post->isPinned()} diff --git a/Web/static/img/ignore.png b/Web/static/img/ignore.png deleted file mode 100644 index c743c568b9c0b59212fa2ff4692bfba3881cad97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s3?%0jwTl2L#^NA%C&rs6b?Si}mUKs7M+SzC z{oH>NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fF5lu!@w z32_C|S-l$%oWJ+@<%jZV+jILibuT;g{`2?B89VPkdw1*6>y>*h0@X~Dn0gdQF_r}R z1v5B2yO9RsBze2LFm$lWdH^|`1s;*bK$i-GFeAgPITAoY_7YEDSN4~zA_5vLYlPA! z0)-4bT^vI=qLUMVfR#~!H`&QTz|ep*nBh@_poeJ-??Z>134D{7W~6l-%y_2U!^#jh Wk1_AA{JBz~UItHBKbLh*2~7aA9#zW#