Skip to content

Commit

Permalink
fix(Contexts): show sharees` displayname in edit modal
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
  • Loading branch information
blizzz committed Apr 22, 2024
1 parent 54b8ef8 commit dfdcc50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/Db/ContextMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use OCA\Tables\AppInfo\Application;
use OCA\Tables\Errors\NotFoundError;
use OCA\Tables\Helper\GroupHelper;
use OCA\Tables\Helper\UserHelper;
use OCP\AppFramework\Db\QBMapper;
use OCP\DB\Exception;
Expand All @@ -15,10 +16,8 @@
/** @template-extends QBMapper<Context> */
class ContextMapper extends QBMapper {
protected string $table = 'tables_contexts_context';
private UserHelper $userHelper;

public function __construct(IDBConnection $db, UserHelper $userHelper) {
$this->userHelper = $userHelper;
public function __construct(IDBConnection $db, protected UserHelper $userHelper, protected GroupHelper $groupHelper) {
parent::__construct($db, $this->table, Context::class);
}

Expand Down Expand Up @@ -86,6 +85,11 @@ protected function formatResultRows(array $rows, ?string $userId) {
'share_id' => (int)$item['share_id'],
'receiver' => $item['receiver'],
'receiver_type' => $item['receiver_type'],
'receiver_display_name' => match ($item['receiver_type']) {
'user' => $this->userHelper->getUserDisplayName($item['receiver']),
'group' => $this->groupHelper->getGroupDisplayName($item['receiver']),
default => $item['receiver'],
},
'display_mode_default' => (int)$item['display_mode_default'],
];
if ($userId !== null) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/modals/EditContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default {
const receivers = sharing.map((share) => {
return {
user: share.receiver,
displayName: share.receiver,
displayName: share.receiver_display_name,
icon: share.receiver_type === 'user' ? 'icon-user' : 'icon-group',
isUser: share.receiver_type === 'user',
key: share.receiver_type + '-' + share.receiver,
Expand Down

0 comments on commit dfdcc50

Please sign in to comment.