Skip to content

Commit

Permalink
fix(design): correct show share icon (#555)
Browse files Browse the repository at this point in the history
- only show if hasShares and you are the owner
- don't show hasShares if shared with you

Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>
  • Loading branch information
Florian authored Sep 13, 2023
1 parent e0aa764 commit 2b620b0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
6 changes: 5 additions & 1 deletion lib/Service/TableService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use DateTime;
use Exception;

use OCA\Tables\Db\Share;
use OCA\Tables\Db\Table;
use OCA\Tables\Db\TableMapper;
use OCA\Tables\Errors\InternalError;
Expand Down Expand Up @@ -118,6 +117,11 @@ public function findAll(?string $userId = null, bool $skipTableEnhancement = fal
foreach ($allTables as $table) {
/** @var string $userId */
$this->enhanceTable($table, $userId);
// if the table is shared with me, there are no other shares
// will avoid showing the shared icon in the FE nav
if($table->getIsShared()) {
$table->setHasShares(false);
}
}
}

Expand Down
8 changes: 2 additions & 6 deletions src/modules/navigation/partials/NavigationTableItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<NcCounterBubble v-if="canReadData(table)">
{{ n('tables', '%n row', '%n rows', table.rowsCount, {}) }}
</NcCounterBubble>
<NcActionButton v-if="!isSharedItem" icon="icon-share" :class="{'margin-right': !(activeTable && table.id === activeTable.id)}" @click="actionShowShare" />
<NcActionButton v-if="table.hasShares" icon="icon-share" :class="{'margin-right': !(activeTable && table.id === activeTable.id)}" @click="actionShowShare" />
<div v-if="table.isShared && table.ownership !== userId" class="margin-left">
<NcAvatar :user="table.ownership" />
</div>
Expand Down Expand Up @@ -74,7 +74,7 @@
<NavigationViewItem v-for="view in getViews"
:key="'view'+view.id"
:view="view"
:is-shared-item="true" />
:show-share-sender="false" />
</NcAppNavigationItem>
</template>
<script>
Expand Down Expand Up @@ -128,10 +128,6 @@ export default {
type: String,
default: '',
},
isSharedItem: {
type: Boolean,
default: false,
},
},
data() {
Expand Down
13 changes: 7 additions & 6 deletions src/modules/navigation/partials/NavigationViewItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<NcCounterBubble v-if="canReadData(view)">
{{ n('tables', '%n row', '%n rows', view.rowsCount, {}) }}
</NcCounterBubble>
<NcActionButton v-if="!isSharedItem" icon="icon-share" :class="{'margin-right': !(activeView && view.id === activeView.id)}" @click="actionShowShare" />
<div v-if="view.isShared && view.ownership !== userId && !canManageTable(view)" class="margin-left">
<NcActionButton v-if="view.hasShares" icon="icon-share" :class="{'margin-right': !(activeView && view.id === activeView.id)}" @click="actionShowShare" />
<div v-if="view.isShared && view.ownership !== userId && !canManageTable(view) && showShareSender" class="margin-left">
<NcAvatar :user="view.ownership" />
</div>
</template>
Expand Down Expand Up @@ -116,10 +116,11 @@ export default {
type: Object,
default: null,
},
isSharedItem: {
type: Boolean,
default: false,
},
// this is good if you show the share sender via the table and show this as children
showShareSender: {
type: Boolean,
default: true,
},
},
data() {
Expand Down
11 changes: 4 additions & 7 deletions src/modules/navigation/sections/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@
:filter-string="filterString"
:table="table" />

<NcAppNavigationCaption v-if="getSharedTables.length > 0"
<NcAppNavigationCaption v-if="getSharedTables.length > 0 || getSharedViews.length > 0"
:title="t('tables', 'Shared')" />
<NavigationTableItem v-for="table in getSharedTables"
:key="table.id"
:filter-string="filterString"
:table="table"
:is-shared-item="true" />
<NavigationViewItem
v-for="view in getSharedViews"
:table="table" />
<NavigationViewItem v-for="view in getSharedViews"
:key="'view'+view.id"
:view="view"
:is-shared-item="true" />
:view="view" />
</ul>

<div v-if="filterString !== ''" class="search-info">
Expand Down

0 comments on commit 2b620b0

Please sign in to comment.