Skip to content

Commit

Permalink
fix: [admin] display accoutn status as text
Browse files Browse the repository at this point in the history
  • Loading branch information
kumy committed Oct 17, 2023
1 parent 7691970 commit 9388fe6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions website/app-templates/smarty/blocks/user_finder_list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<th class="text-right">Join date</th>
<th class="text-right">Last login</th>
<th class="text-right">Email valid</th>
<th class="text-right">Status</th>
<th class="text-right">Actions</th>
</tr>
</thead>
Expand All @@ -25,6 +26,7 @@
<td class="text-right">{if !is_null($user->joined_on_datetime)}{$user->joined_on_datetime|print_date nofilter}{/if}</td>
<td class="text-right">{if !is_null($user->last_login_datetime)}{$user->last_login_datetime|print_date nofilter}{/if}</td>
<td class="text-right">{if $user->email_invalid}{t}false{/t}{else}{t}true{/t}{/if}</td>
<td class="text-right">{$user->status_text()}</td>
<td class="text-right">
{block user_actions}{/block}
</td>
Expand Down
10 changes: 10 additions & 0 deletions website/app/GeoKrety/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class User extends Base implements \JsonSerializable {
public const USER_ACCOUNT_VALID = 1;
public const USER_ACCOUNT_IMPORTED = 2;

public const ACCOUNT_STATUS_TEXT = [
self::USER_ACCOUNT_INVALID => 'Non-Activated',
self::USER_ACCOUNT_VALID => 'Fully activated',
self::USER_ACCOUNT_IMPORTED => 'Imported',
];

public const USER_ACCOUNT_STATUS_INVALID = [
self::USER_ACCOUNT_INVALID,
self::USER_ACCOUNT_IMPORTED,
Expand Down Expand Up @@ -303,6 +309,10 @@ public function isAccountImported(): bool {
return $this->account_valid === self::USER_ACCOUNT_IMPORTED;
}

public function status_text(): string {
return self::ACCOUNT_STATUS_TEXT[$this->account_valid];
}

public function hasEmail(): bool {
return !is_null($this->_email_hash);
}
Expand Down

0 comments on commit 9388fe6

Please sign in to comment.