Skip to content

Commit

Permalink
Изменения понятия "гендер" и "пол" на "местоимения" (#1033)
Browse files Browse the repository at this point in the history
  • Loading branch information
veselcraft authored Nov 30, 2023
1 parent 237206c commit 5b8fe91
Show file tree
Hide file tree
Showing 31 changed files with 1,195 additions and 33 deletions.
2 changes: 1 addition & 1 deletion VKAPI/Handlers/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function get(string $user_ids = "0", string $fields = "", int $offset = 0, int $
$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;
Expand Down
4 changes: 2 additions & 2 deletions VKAPI/Handlers/Wall.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function get(int $owner_id, string $domain = "", int $offset = 0, int $count = 3
"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(),
Expand Down Expand Up @@ -441,7 +441,7 @@ function getById(string $posts, int $extended = 0, string $fields = "", User $us
"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(),
Expand Down
24 changes: 23 additions & 1 deletion Web/Models/Entities/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,29 @@ function getNsfwTolerance(): int

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
Expand Down
12 changes: 11 additions & 1 deletion Web/Presenters/AuthPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@ function renderRegister(): void
$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);
Expand Down
14 changes: 12 additions & 2 deletions Web/Presenters/UserPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,18 @@ function renderEdit(): void
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()) {
Expand Down
10 changes: 5 additions & 5 deletions Web/Presenters/templates/Auth/Register.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@
</tr>
<tr>
<td class="regform-left">
<span class="nobold">{_gender}: </span>
<span class="nobold">{_pronouns}: </span>
</td>
<td class="regform-right">
{var $femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]}
<select name="sex" required>
<option n:attr="selected => !$femalePreferred" value="male">{_male}</option>
<option n:attr="selected => $femalePreferred" value="female">{_female}</option>
<select name="pronouns" required>
<option value="male">{_male}</option>
<option value="female">{_female}</option>
<option value="neutral">{_neutral}</option>
</select>
</td>
</tr>
Expand Down
8 changes: 4 additions & 4 deletions Web/Presenters/templates/Search/Index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
{/if}
{if $x->getPrivacySetting("page.info.read") > 1}
<tr>
<td><span class="nobold">{_gender}: </span></td>
<td>{$x->isFemale() ? tr("female") : tr("male")}</td>
<td><span class="nobold">{_pronouns}: </span></td>
<td>{$x->isFemale() ? tr("female") : ($x->isNeutral() ? tr("neutral") : tr("male"))}</td>
</tr>
<tr>
<td><span class="nobold">{_relationship}:</span></td>
Expand Down Expand Up @@ -308,14 +308,14 @@
</div>
</div>

<div class="searchOption">
<!-- <div class="searchOption">
<div class="searchOptionName" id="n_gender" onclick="hideParams('gender')"><img src="/assets/packages/static/openvk/img/hide.png" class="searchHide">{_gender}</div>
<div class="searchOptionBlock" id="s_gender">
<p><input type="radio" form="searcher" id="gend" {if $_GET['gender'] == 0}checked{/if} name="gender" value="0">{_male}</p>
<p><input type="radio" form="searcher" id="gend1"{if $_GET['gender'] == 1}checked{/if} name="gender" value="1">{_female}</p>
<p><input type="radio" form="searcher" id="gend2"{if $_GET['gender'] == 2 || is_null($_GET['gender'])}checked{/if} name="gender" value="2">{_s_any}</p>
</div>
</div>
</div> -->

<div class="searchOption">
<div class="searchOptionName" id="n_relationship" onclick="hideParams('relationship')"><img src="/assets/packages/static/openvk/img/hide.png" class="searchHide">{ovk_proc_strtr(tr("relationship"), 14)}</div>
Expand Down
9 changes: 5 additions & 4 deletions Web/Presenters/templates/User/Edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,13 @@
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_gender}: </span>
<span class="nobold">{_pronouns}: </span>
</td>
<td>
<select name="gender">
<option value="1" {if $user->isFemale() == true}selected{/if}>{_female}</option>
<option value="0" {if $user->isFemale() == false}selected{/if}>{_male}</option>
<select name="pronouns">
<option value="0" {if $user->getPronouns() == 0}selected{/if}>{_male}</option>
<option value="1" {if $user->getPronouns() == 1}selected{/if}>{_female}</option>
<option value="2" {if $user->getPronouns() == 2}selected{/if}>{_neutral}</option>
</select>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions Web/Presenters/templates/User/View.xml
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@
<table id="basicInfo" class="ugc-table" border="0" cellspacing="0" cellpadding="0" border="0" cellspacing="0" cellpadding="0" n:if=" $user->getPrivacyPermission('page.info.read', $thisUser ?? NULL)">
<tbody>
<tr>
<td class="label"><span class="nobold">{_gender}: </span></td>
<td class="data">{$user->isFemale() ? tr("female") : tr("male")}</td>
<td class="label"><span class="nobold">{_pronouns}: </span></td>
<td class="data">{$user->isFemale() ? tr("female") : ($user->isNeutral() ? tr("neutral") : tr("male"))}</td>
</tr>
<tr>
<td class="label"><span class="nobold">{_relationship}:</span></td>
Expand Down
4 changes: 2 additions & 2 deletions Web/Presenters/templates/components/post/microblogpost.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<div class="post-author">
<a href="{$author->getURL()}"><b class="post-author-name">{$author->getCanonicalName()}</b></a>
<img n:if="$author->isVerified()" class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png">
{$post->isDeactivationMessage() ? ($author->isFemale() ? tr($deac . "_f") : tr($deac . "_m"))}
{$post->isUpdateAvatarMessage() && !$post->isPostedOnBehalfOfGroup() ? ($author->isFemale() ? tr("upd_f") : tr("upd_m"))}
{$post->isDeactivationMessage() ? ($author->isFemale() ? tr($deac . "_f") : ($author->isNeutral() ? tr($deac . "_g") : tr($deac . "_m")))}
{$post->isUpdateAvatarMessage() && !$post->isPostedOnBehalfOfGroup() ? ($author->isFemale() ? tr("upd_f") : ($author->isNeutral() ? tr("upd_n") : tr("upd_m")))}
{$post->isUpdateAvatarMessage() && $post->isPostedOnBehalfOfGroup() ? tr("upd_g") : ""}
{if ($onWallOf ?? false) &&!$post->isPostedOnBehalfOfGroup() && $post->getOwnerPost() !== $post->getTargetWall()}
{var $wallOwner = $post->getWallOwner()}
Expand Down
2 changes: 2 additions & 0 deletions Web/Presenters/templates/components/post/oldpost.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
{else}
{if $author->isFemale()}
{_post_writes_f}
{elseif $author->isNeutral()}
{_post_writes_g}
{else}
{_post_writes_m}
{/if}
Expand Down
Loading

0 comments on commit 5b8fe91

Please sign in to comment.