Skip to content

Commit

Permalink
Make read more in contextual helpers configurable (owncloud#8713)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan authored Mar 27, 2023
1 parent 2582f8d commit 9c8650e
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Context helper read more link configurable

We've added a configuration variable to disable the read more link in the contextual helper.

https://github.com/owncloud/web/pull/8713
https://github.com/owncloud/web/issues/8570
3 changes: 2 additions & 1 deletion config/config.json.sample-ocis
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"xhr": {
"timeout": 60000
}
}
},
"contextHelpersReadMore": true
}
}
3 changes: 2 additions & 1 deletion config/vite_ocis/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"image/tiff",
"image/bmp",
"image/x-ms-bmp"
]
],
"contextHelpersReadMore": true
},
"external_apps": [
{
Expand Down
3 changes: 2 additions & 1 deletion dev/docker/ocis.web.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"image/tiff",
"image/bmp",
"image/x-ms-bmp"
]
],
"contextHelpersReadMore": true
},
"apps": ["files", "text-editor", "pdf-viewer", "search", "external", "admin-settings"],
"external_apps": [
Expand Down
1 change: 1 addition & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ hovers the row with his mouse. Defaults to `false`.
- `options.upload.xhr.timeout` Specifies the timeout for XHR uploads in milliseconds.
- `options.editor.autosaveEnabled` Specifies if the autosave for the editor apps is enabled.
- `options.editor.autosaveInterval` Specifies the time interval for the autosave of editor apps in seconds.
- `options.editor.contextHelpersReadMore` Specifies whether the "Read more" link should be displayed or not.

### Sentry

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ import { getLocaleFromLanguage } from 'web-pkg/src/helpers'
import { Resource } from 'web-client/src/helpers'
import { isLocationSharesActive } from '../../../router'
import { useShares } from 'web-app-files/src/composables'
import { configurationManager } from 'web-pkg'
export default defineComponent({
name: 'FileLinks',
Expand Down Expand Up @@ -178,7 +179,8 @@ export default defineComponent({
outgoingLinks,
directLinks,
indirectLinks,
canCreatePublicLinks
canCreatePublicLinks,
configurationManager
}
},
computed: {
Expand Down Expand Up @@ -251,10 +253,10 @@ export default defineComponent({
},
viaLinkHelp() {
return shareViaLinkHelp
return shareViaLinkHelp(this.configurationManager)
},
indirectLinkHelp() {
return shareViaIndirectLinkHelp
return shareViaIndirectLinkHelp(this.configurationManager)
},
canCreateLinks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import { isProjectSpaceResource, Resource } from 'web-client/src/helpers'
import { getSharedAncestorRoute } from 'web-app-files/src/helpers/share'
import { AncestorMetaData } from 'web-app-files/src/helpers/resource/ancestorMetaData'
import { useShares } from 'web-app-files/src/composables'
import { configurationManager } from 'web-pkg'
export default defineComponent({
name: 'FileShares',
Expand Down Expand Up @@ -137,7 +138,8 @@ export default defineComponent({
hasProjectSpaces: useCapabilityProjectSpacesEnabled(),
hasShareJail: useCapabilityShareJailEnabled(),
hasResharing: useCapabilityFilesSharingResharing(),
getSharedAncestor
getSharedAncestor,
configurationManager
}
},
computed: {
Expand All @@ -149,15 +151,15 @@ export default defineComponent({
const cernFeatures = !!this.configuration?.options?.cernFeatures
if (cernFeatures) {
const mergedHelp = shareInviteCollaboratorHelp
const mergedHelp = shareInviteCollaboratorHelp(this.configurationManager)
mergedHelp.list = [
...shareInviteCollaboratorHelpCern.list,
...shareInviteCollaboratorHelp.list
...shareInviteCollaboratorHelp(this.configurationManager).list
]
return mergedHelp
}
return shareInviteCollaboratorHelp
return shareInviteCollaboratorHelp(this.configurationManager)
},
helpersEnabled() {
return this.configuration?.options?.contextHelpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { Resource } from 'web-client/src/helpers'
import { useClientService } from 'web-pkg/src/composables'
import Fuse from 'fuse.js'
import Mark from 'mark.js'
import { configurationManager } from 'web-pkg'
export default defineComponent({
name: 'SpaceMembers',
Expand All @@ -91,7 +92,8 @@ export default defineComponent({
return {
filterTerm: '',
isFilterOpen: false,
markInstance: null
markInstance: null,
configurationManager
}
},
computed: {
Expand All @@ -106,7 +108,7 @@ export default defineComponent({
return this.configuration?.options?.contextHelpers
},
spaceAddMemberHelp() {
return shareSpaceAddMemberHelp
return shareSpaceAddMemberHelp(this.configurationManager)
},
hasCollaborators() {
return this.spaceMembers.length > 0
Expand Down
88 changes: 53 additions & 35 deletions packages/web-app-files/src/helpers/contextualHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ConfigurationManager } from 'web-pkg'

// just a dummy function to trick gettext tools
function $gettext(msg) {
return msg
Expand All @@ -6,33 +8,40 @@ export const empty = {
text: '',
list: ['', '', '']
}
export const shareInviteCollaboratorHelp = {
title: $gettext('Invite specific people'),
text: $gettext('Enter a name or group to share this item.'),
list: [
{ text: $gettext('Subfolders'), headline: true },
{
text: $gettext(
'If you share a folder, all of its contents and subfolders will be shared as well.'
)
},
{ text: $gettext('Notification'), headline: true },
{
text: $gettext('Invited people will be notified via email or in-app notification.')
},
{ text: $gettext('Incognito'), headline: true },
{
text: $gettext('Invited people can not see who else has access..')
},
{ text: $gettext('“via folder”'), headline: true },
{
text: $gettext(
'The “via folder” is shown next to a share, if access has already been given via a parent folder. Click on the “via folder” to edit the share on its parent folder.'
)
}
],
readMoreLink: 'https://doc.owncloud.com/webui/next/owncloud_web/web_for_users.html#sharing'
export const shareInviteCollaboratorHelp = (configurationManager: ConfigurationManager) => {
console.log(configurationManager.options)
return {
title: $gettext('Invite specific people'),
text: $gettext('Enter a name or group to share this item.'),
list: [
{ text: $gettext('Subfolders'), headline: true },
{
text: $gettext(
'If you share a folder, all of its contents and subfolders will be shared as well.'
)
},
{ text: $gettext('Notification'), headline: true },
{
text: $gettext('Invited people will be notified via email or in-app notification.')
},
{ text: $gettext('Incognito'), headline: true },
{
text: $gettext('Invited people can not see who else has access..')
},
{ text: $gettext('“via folder”'), headline: true },
{
text: $gettext(
'The “via folder” is shown next to a share, if access has already been given via a parent folder. Click on the “via folder” to edit the share on its parent folder.'
)
}
],
readMoreLink:
configurationManager.options.contextHelpersReadMore === false
? ''
: 'https://doc.owncloud.com/webui/next/owncloud_web/web_for_users.html#sharing'
}
}

export const shareInviteCollaboratorHelpCern = {
list: [
{ text: $gettext('Search for service or secondary Account'), headline: true },
Expand All @@ -43,7 +52,7 @@ export const shareInviteCollaboratorHelpCern = {
}
]
}
export const shareSpaceAddMemberHelp = {
export const shareSpaceAddMemberHelp = (configurationManager: ConfigurationManager) => ({
title: $gettext('Add members to this Space'),
text: $gettext('Enter a name to add people or groups as members to this Space.'),
list: [
Expand All @@ -60,9 +69,12 @@ export const shareSpaceAddMemberHelp = {
)
}
],
readMoreLink: 'https://doc.owncloud.com/webui/next/owncloud_web/web_for_users.html#sharing'
}
export const shareViaLinkHelp = {
readMoreLink:
configurationManager.options.contextHelpersReadMore === false
? ''
: 'https://doc.owncloud.com/webui/next/owncloud_web/web_for_users.html#sharing'
})
export const shareViaLinkHelp = (configurationManager: ConfigurationManager) => ({
title: $gettext('Choose how access is granted'),
list: [
{
Expand Down Expand Up @@ -93,9 +105,12 @@ export const shareViaLinkHelp = {
)
}
],
readMoreLink: 'https://doc.owncloud.com/webui/next/owncloud_web/web_for_users.html#sharing'
}
export const shareViaIndirectLinkHelp = {
readMoreLink:
configurationManager.options.contextHelpersReadMore === false
? ''
: 'https://doc.owncloud.com/webui/next/owncloud_web/web_for_users.html#sharing'
})
export const shareViaIndirectLinkHelp = (configurationManager: ConfigurationManager) => ({
title: $gettext('What are indirect links?'),
text: $gettext('Indirect links are links giving access by a parent folder.'),
list: [
Expand All @@ -109,5 +124,8 @@ export const shareViaIndirectLinkHelp = {
)
}
],
readMoreLink: 'https://doc.owncloud.com/webui/next/owncloud_web/web_for_users.html#sharing'
}
readMoreLink:
configurationManager.options.contextHelpersReadMore === false
? ''
: 'https://doc.owncloud.com/webui/next/owncloud_web/web_for_users.html#sharing'
})
5 changes: 5 additions & 0 deletions packages/web-pkg/src/configuration/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export class ConfigurationManager {

set options(options: OptionsConfiguration) {
set(this.optionsConfiguration, 'routing.idBased', get(options, 'routing.idBased', true))
set(
this.optionsConfiguration,
'contextHelpersReadMore',
get(options, 'contextHelpersReadMore', true)
)
}

get options(): OptionsConfiguration {
Expand Down
1 change: 1 addition & 0 deletions packages/web-pkg/src/configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface RoutingOptionsConfiguration {
export interface OptionsConfiguration {
routing?: RoutingOptionsConfiguration
logoutUrl?: string
contextHelpersReadMore?: boolean
}

export interface OAuth2Configuration {
Expand Down
3 changes: 2 additions & 1 deletion packages/web-runtime/src/store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const state = {
previewFileMimeTypes: [],
runningOnEos: false,
cernFeatures: false,
sharingRecipientsPerPage: 200
sharingRecipientsPerPage: 200,
contextHelpersReadMore: true
}
}

Expand Down

0 comments on commit 9c8650e

Please sign in to comment.