Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent the member count inside a space from disappearing #6550

Merged
merged 2 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/bugfix-space-member-count
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Prevent the member count inside a space from disappearing

We've fixed a bug where opening the sidebar for a file inside a space caused the member count of the space to disappear.

https://github.com/owncloud/web/pull/6550
31 changes: 10 additions & 21 deletions packages/web-app-files/src/views/spaces/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@
</oc-drop>
</div>
<oc-button
v-if="!loadSharesTask.isRunning && currentFileOutgoingCollaborators.length"
v-if="memberCount"
:aria-label="$gettext('Open context menu and show members')"
appearance="raw"
@click="openSidebarSharePanel"
>
<oc-icon name="group" fill-type="line" size="small" />
<span
class="space-overview-people-count oc-text-small"
v-text="peopleCountString"
v-text="memberCountString"
></span>
</oc-button>
</div>
Expand Down Expand Up @@ -271,18 +271,9 @@ export default {
})
})

const loadSharesTask = useTask(function* (signal, ref) {
yield ref.loadCurrentFileOutgoingShares({
client: graphClient,
path: ref.space.id,
space: ref.space
})
})

return {
space,
loadResourcesTask,
loadSharesTask,
resourceTargetLocation: createLocationSpaces('files-spaces-project'),
paginatedResources,
paginationPages,
Expand All @@ -309,8 +300,7 @@ export default {
'selectedFiles',
'currentFolder',
'totalFilesCount',
'totalFilesSize',
'currentFileOutgoingCollaborators'
'totalFilesSize'
]),

selected: {
Expand Down Expand Up @@ -339,15 +329,15 @@ export default {
displayThumbnails() {
return !this.configuration.options.disablePreviews
},
peopleCountString() {
const translated = this.$ngettext(
'%{count} member',
'%{count} members',
this.currentFileOutgoingCollaborators.length
)
memberCount() {
const roles = Object.values(this.space.spaceRoles)
return roles.reduce((arr, obj) => arr.concat(obj), []).length
JammingBen marked this conversation as resolved.
Show resolved Hide resolved
},
memberCountString() {
const translated = this.$ngettext('%{count} member', '%{count} members', this.memberCount)

return this.$gettextInterpolate(translated, {
count: this.currentFileOutgoingCollaborators.length
count: this.memberCount
})
},
quotaModalIsOpen() {
Expand Down Expand Up @@ -419,7 +409,6 @@ export default {
},
async mounted() {
await this.loadResourcesTask.perform(this, false, this.$route.params.item || '')
this.loadSharesTask.perform(this)

if (this.markdownResizeObserver) {
this.markdownResizeObserver.unobserve(this.$refs.markdownContainer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const spaceMocks = {
spaceWithReadmeAndImage: {
id: 1,
name: 'space',
root: { permissions: [{ roles: ['manager'], grantedTo: [{ user: { id: 1 } }] }] },
special: [
{
specialFolder: { name: 'readme' },
Expand All @@ -55,6 +56,7 @@ const spaceMocks = {
spaceWithoutReadmeAndImage: {
id: 1,
name: 'space',
root: { permissions: [{ roles: ['manager'], grantedTo: [{ user: { id: 1 } }] }] },
special: []
}
}
Expand Down