From 5b8fe91a33873cde2b76f9dc729a729decfa5972 Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Thu, 30 Nov 2023 17:39:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BD=D1=8F=D1=82=D0=B8=D1=8F=20"?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B4=D0=B5=D1=80"=20=D0=B8=20"=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB"=20=D0=BD=D0=B0=20"=D0=BC=D0=B5=D1=81=D1=82=D0=BE=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B8=D1=8F"=20(#1033)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VKAPI/Handlers/Users.php | 2 +- VKAPI/Handlers/Wall.php | 4 +- Web/Models/Entities/User.php | 24 +- Web/Presenters/AuthPresenter.php | 12 +- Web/Presenters/UserPresenter.php | 14 +- Web/Presenters/templates/Auth/Register.xml | 10 +- Web/Presenters/templates/Search/Index.xml | 8 +- Web/Presenters/templates/User/Edit.xml | 9 +- Web/Presenters/templates/User/View.xml | 4 +- .../components/post/microblogpost.xml | 4 +- .../templates/components/post/oldpost.xml | 2 + Web/static/js/package-lock.json | 1107 +++++++++++++++++ locales/README.md | 0 locales/by.strings | 0 locales/by_lat.strings | 0 locales/de.strings | 0 locales/en.strings | 9 +- locales/eo.strings | 0 locales/hy.strings | 0 locales/id.strings | 0 locales/kk.strings | 0 locales/pl.strings | 0 locales/qqx.strings | 0 locales/ru.strings | 10 +- locales/ru_old.strings | 0 locales/ru_sov.strings | 0 locales/sr_cyr.strings | 0 locales/sr_lat.strings | 0 locales/tr.strings | 0 locales/udm.strings | 0 locales/uk.strings | 9 +- 31 files changed, 1195 insertions(+), 33 deletions(-) create mode 100644 Web/static/js/package-lock.json mode change 100644 => 100755 locales/README.md mode change 100644 => 100755 locales/by.strings mode change 100644 => 100755 locales/by_lat.strings mode change 100644 => 100755 locales/de.strings mode change 100644 => 100755 locales/eo.strings mode change 100644 => 100755 locales/hy.strings mode change 100644 => 100755 locales/id.strings mode change 100644 => 100755 locales/kk.strings mode change 100644 => 100755 locales/pl.strings mode change 100644 => 100755 locales/qqx.strings mode change 100644 => 100755 locales/ru_old.strings mode change 100644 => 100755 locales/ru_sov.strings mode change 100644 => 100755 locales/sr_cyr.strings mode change 100644 => 100755 locales/sr_lat.strings mode change 100644 => 100755 locales/tr.strings mode change 100644 => 100755 locales/udm.strings diff --git a/VKAPI/Handlers/Users.php b/VKAPI/Handlers/Users.php index 4f1b59a4..6c31e9be 100644 --- a/VKAPI/Handlers/Users.php +++ b/VKAPI/Handlers/Users.php @@ -62,7 +62,7 @@ final class Users extends VKAPIRequestHandler $response[$i]->verified = intval($usr->isVerified()); break; case "sex": - $response[$i]->sex = $usr->isFemale() ? 1 : 2; + $response[$i]->sex = $usr->isFemale() ? 1 : ($usr->isNeutral() ? 0 : 2); break; case "has_photo": $response[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1; diff --git a/VKAPI/Handlers/Wall.php b/VKAPI/Handlers/Wall.php index 527fb9a5..ba61247f 100644 --- a/VKAPI/Handlers/Wall.php +++ b/VKAPI/Handlers/Wall.php @@ -236,7 +236,7 @@ final class Wall extends VKAPIRequestHandler "last_name" => $user->getLastName(), "can_access_closed" => false, "is_closed" => false, - "sex" => $user->isFemale() ? 1 : 2, + "sex" => $user->isFemale() ? 1 : ($user->isNeutral() ? 0 : 2), "screen_name" => $user->getShortCode(), "photo_50" => $user->getAvatarUrl(), "photo_100" => $user->getAvatarUrl(), @@ -441,7 +441,7 @@ final class Wall extends VKAPIRequestHandler "last_name" => $user->getLastName(), "can_access_closed" => false, "is_closed" => false, - "sex" => $user->isFemale() ? 1 : 2, + "sex" => $user->isFemale() ? 1 : ($user->isNeutral() ? 0 : 2), "screen_name" => $user->getShortCode(), "photo_50" => $user->getAvatarUrl(), "photo_100" => $user->getAvatarUrl(), diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index 5a4fc2f4..05de73ee 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -795,7 +795,29 @@ class User extends RowModel function isFemale(): bool { - return (bool) $this->getRecord()->sex; + return $this->getRecord()->sex == 1; + } + + function isNeutral(): bool + { + return (bool) $this->getRecord()->sex == 2; + } + + function getLocalizedPronouns(): string + { + switch ($this->getRecord()->sex) { + case 0: + return tr('male'); + case 1: + return tr('female'); + case 2: + return tr('neutral'); + } + } + + function getPronouns(): int + { + return $this->getRecord()->sex; } function isVerified(): bool diff --git a/Web/Presenters/AuthPresenter.php b/Web/Presenters/AuthPresenter.php index c6a7f143..7edcda7c 100644 --- a/Web/Presenters/AuthPresenter.php +++ b/Web/Presenters/AuthPresenter.php @@ -95,7 +95,17 @@ final class AuthPresenter extends OpenVKPresenter $user = new User; $user->setFirst_Name($this->postParam("first_name")); $user->setLast_Name($this->postParam("last_name")); - $user->setSex((int)($this->postParam("sex") === "female")); + switch ($this->postParam("pronouns")) { + case 'male': + $user->setSex(0); + break; + case 'female': + $user->setSex(1); + break; + case 'neutral': + $user->setSex(2); + break; + } $user->setEmail($this->postParam("email")); $user->setSince(date("Y-m-d H:i:s")); $user->setRegistering_Ip(CONNECTING_IP); diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 3097115f..870e4ab2 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -183,8 +183,18 @@ final class UserPresenter extends OpenVKPresenter if ($this->postParam("politViews") <= 9 && $this->postParam("politViews") >= 0) $user->setPolit_Views($this->postParam("politViews")); - if ($this->postParam("gender") <= 1 && $this->postParam("gender") >= 0) - $user->setSex($this->postParam("gender")); + if ($this->postParam("pronouns") <= 2 && $this->postParam("pronouns") >= 0) + switch ($this->postParam("pronouns")) { + case '0': + $user->setSex(0); + break; + case '1': + $user->setSex(1); + break; + case '2': + $user->setSex(2); + break; + } $user->setAudio_broadcast_enabled($this->checkbox("broadcast_music")); if(!empty($this->postParam("phone")) && $this->postParam("phone") !== $user->getPhone()) { diff --git a/Web/Presenters/templates/Auth/Register.xml b/Web/Presenters/templates/Auth/Register.xml index 23857633..120c0b91 100644 --- a/Web/Presenters/templates/Auth/Register.xml +++ b/Web/Presenters/templates/Auth/Register.xml @@ -91,13 +91,13 @@ - {_gender}: + {_pronouns}: - {var $femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]} - + + + diff --git a/Web/Presenters/templates/Search/Index.xml b/Web/Presenters/templates/Search/Index.xml index acc1eab7..f8c8c173 100644 --- a/Web/Presenters/templates/Search/Index.xml +++ b/Web/Presenters/templates/Search/Index.xml @@ -94,8 +94,8 @@ {/if} {if $x->getPrivacySetting("page.info.read") > 1} - {_gender}: - {$x->isFemale() ? tr("female") : tr("male")} + {_pronouns}: + {$x->isFemale() ? tr("female") : ($x->isNeutral() ? tr("neutral") : tr("male"))} {_relationship}: @@ -308,14 +308,14 @@ -
+
{ovk_proc_strtr(tr("relationship"), 14)}
diff --git a/Web/Presenters/templates/User/Edit.xml b/Web/Presenters/templates/User/Edit.xml index fef8a109..aa1a46ea 100644 --- a/Web/Presenters/templates/User/Edit.xml +++ b/Web/Presenters/templates/User/Edit.xml @@ -139,12 +139,13 @@ - {_gender}: + {_pronouns}: - + + + diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index b8bd5afc..84e2eaad 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -451,8 +451,8 @@ - - + + diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index 0b0978bc..04731619 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -26,8 +26,8 @@
{_gender}: {$user->isFemale() ? tr("female") : tr("male")}{_pronouns}: {$user->isFemale() ? tr("female") : ($user->isNeutral() ? tr("neutral") : tr("male"))}
{_relationship}: