Skip to content

Commit

Permalink
Pronouns: some updated that i can't describe just bc i'm tired
Browse files Browse the repository at this point in the history
  • Loading branch information
veselcraft committed Nov 26, 2023
1 parent 6794d64 commit ec5c95e
Show file tree
Hide file tree
Showing 12 changed files with 1,130 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VKAPI/Handlers/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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 @@ -170,7 +170,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 @@ -349,7 +349,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
2 changes: 1 addition & 1 deletion Web/Models/Entities/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ function getNsfwTolerance(): int

function isFemale(): bool
{
return (bool) $this->getRecord()->sex == 1;
return $this->getRecord()->sex == 1;
}

function isNeutral(): bool
Expand Down
7 changes: 4 additions & 3 deletions Web/Presenters/UserPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,16 @@ function renderEdit(): void
if ($this->postParam("politViews") <= 9 && $this->postParam("politViews") >= 0)
$user->setPolit_Views($this->postParam("politViews"));

bdump($this->postParam("pronouns"));
if ($this->postParam("pronouns") <= 2 && $this->postParam("pronouns") >= 0)
switch ($this->postParam("pronouns")) {
case 'male':
case '0':
$user->setSex(0);
break;
case 'female':
case '1':
$user->setSex(1);
break;
case 'neutral':
case '2':
$user->setSex(2);
break;
}
Expand Down
4 changes: 2 additions & 2 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
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 ec5c95e

Please sign in to comment.