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

Fix bug where translations were missing on the share type filters #12013

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Missing translations for share type filters

We've fixed a bug, where the translations for the share type filters were missing.
This was the case for the "Shared with me" and "Shared with others" page.

https://github.com/owncloud/web/pull/12013
8 changes: 7 additions & 1 deletion packages/web-app-files/src/views/shares/SharedWithMe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ export default defineComponent({
uniqueShareTypes.push(ShareTypes.remote.value)
}

return ShareTypes.getByValues(uniqueShareTypes)
return ShareTypes.getByValues(uniqueShareTypes).map((shareType) => {
return {
key: shareType.key,
value: shareType.value,
label: $gettext(shareType.label)
}
})
})

const fileOwners = computed(() => {
Expand Down
10 changes: 9 additions & 1 deletion packages/web-app-files/src/views/shares/SharedWithOthers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import { useGetMatchingSpace } from '@ownclouders/web-pkg'
import SharesNavigation from '../../components/AppBar/SharesNavigation.vue'
import { OutgoingShareResource, ShareTypes } from '@ownclouders/web-client'
import { storeToRefs } from 'pinia'
import { useGettext } from 'vue3-gettext'

export default defineComponent({
components: {
Expand All @@ -128,6 +129,7 @@ export default defineComponent({
const configStore = useConfigStore()
const appsStore = useAppsStore()
const { options: configOptions } = storeToRefs(configStore)
const { $gettext } = useGettext()

const resourcesStore = useResourcesStore()

Expand All @@ -150,7 +152,13 @@ export default defineComponent({
uniqueShareTypes.push(ShareTypes.remote.value)
}

return ShareTypes.getByValues(uniqueShareTypes)
return ShareTypes.getByValues(uniqueShareTypes).map((shareType) => {
return {
key: shareType.key,
value: shareType.value,
label: $gettext(shareType.label)
}
})
})
const selectedShareTypesQuery = useRouteQuery('q_shareType')
const filteredItems = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { defaultStubs, RouteLocation } from '@ownclouders/web-test-helpers'
import { useSortMock } from '../../../../tests/mocks/useSortMock'
import { mock } from 'vitest-mock-extended'
import { defaultPlugins, mount, defaultComponentMocks } from '@ownclouders/web-test-helpers'
import { ShareTypes, IncomingShareResource } from '@ownclouders/web-client'
import { ShareTypes, IncomingShareResource, ShareType } from '@ownclouders/web-client'
import SharedWithMeSection from '../../../../src/components/Shares/SharedWithMeSection.vue'

vi.mock('../../../../src/composables/resourcesViewDefaults')
Expand Down Expand Up @@ -96,9 +96,11 @@ describe('SharedWithMe view', () => {
})
const filterItems = wrapper
.findComponent<typeof ItemFilter>('.share-type-filter')
.props('items')
.props('items') as ShareType[]

expect(wrapper.find('.share-type-filter').exists()).toBeTruthy()
expect(filterItems).toEqual([shareType1, shareType2])
expect(filterItems[0].value).toEqual(shareType1.value)
expect(filterItems[1].value).toEqual(shareType2.value)
})
})
describe('shared by', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ describe('SharedWithOthers view', () => {
expect(wrapper.find('.no-content-message').exists()).toBeTruthy()
})
it('shows the files table when files are available', () => {
const mockedFiles = [mockDeep<IncomingShareResource>(), mockDeep<IncomingShareResource>()]
const mockedFiles = [
mockDeep<IncomingShareResource>({ shareTypes: [ShareTypes.user.value] }),
mockDeep<IncomingShareResource>({ shareTypes: [ShareTypes.user.value] })
]
const { wrapper } = getMountedWrapper({ files: mockedFiles })
expect(wrapper.find('.no-content-message').exists()).toBeFalsy()
expect(wrapper.find('resource-table-stub').exists()).toBeTruthy()
Expand Down Expand Up @@ -73,7 +76,11 @@ function getMountedWrapper({
mocks = {},
files = [],
loading = false
}: { mocks?: Record<string, unknown>; files?: IncomingShareResource[]; loading?: boolean } = {}) {
}: {
mocks?: Record<string, unknown>
files?: IncomingShareResource[]
loading?: boolean
} = {}) {
vi.mocked(useResourcesViewDefaults).mockImplementation(() =>
useResourcesViewDefaultsMock({
paginatedResources: ref(files),
Expand Down