@ -217,22 +217,23 @@
< / template >
< script >
import { showError , showSuccess } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'
import moment from '@nextcloud/moment'
import { generateUrl , getBaseUrl } from '@nextcloud/router'
import { showError , showSuccess } from '@nextcloud/dialogs'
import { ShareType } from '@nextcloud/sharing'
import VueQrcode from '@chenfengyuan/vue-qrcode'
import moment from '@nextcloud/moment'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActionCheckbox from '@nextcloud/vue/dist/Components/NcActionCheckbox.js'
import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput.js'
import NcActionLink from '@nextcloud/vue/dist/Components/NcActionLink.js'
import NcActionText from '@nextcloud/vue/dist/Components/NcActionText.js'
import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js'
import VueQrcode from '@chenfengyuan/vue-qrcode'
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
import NcActionCheckbox from '@nextcloud/vue/components/NcActionCheckbox'
import NcActionInput from '@nextcloud/vue/components/NcActionInput'
import NcActionLink from '@nextcloud/vue/components/NcActionLink'
import NcActionText from '@nextcloud/vue/components/NcActionText'
import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
import NcActions from '@nextcloud/vue/components/NcActions'
import NcAvatar from '@nextcloud/vue/components/NcAvatar'
import NcDialog from '@nextcloud/vue/components/NcDialog'
import Tune from 'vue-material-design-icons/Tune.vue'
import IconCalendarBlank from 'vue-material-design-icons/CalendarBlank.vue'
@ -251,7 +252,7 @@ import GeneratePassword from '../utils/GeneratePassword.ts'
import Share from '../models/Share.ts'
import SharesMixin from '../mixins/SharesMixin.js'
import ShareDetails from '../mixins/ShareDetails.js'
import { getLoggerBuilder } from '@nextcloud/logger '
import logger from '../services/logger.ts '
export default {
name : 'SharingEntryLink' ,
@ -305,10 +306,6 @@ export default {
ExternalLegacyLinkActions : OCA . Sharing . ExternalLinkActions . state ,
ExternalShareActions : OCA . Sharing . ExternalShareActions . state ,
logger : getLoggerBuilder ( )
. setApp ( 'files_sharing' )
. detectUser ( )
. build ( ) ,
/ / t r a c k s w h e t h e r m o d a l s h o u l d b e o p e n e d o r n o t
showQRCode : false ,
@ -322,6 +319,8 @@ export default {
* @ return { string }
* /
title ( ) {
const l10nOptions = { escape : false /* no escape as this string is already escaped by Vue */ }
/ / i f w e h a v e a v a l i d e x i s t i n g s h a r e ( n o t p e n d i n g )
if ( this . share && this . share . id ) {
if ( ! this . isShareOwner && this . share . ownerDisplayName ) {
@ -329,26 +328,26 @@ export default {
return t ( 'files_sharing' , '{shareWith} by {initiator}' , {
shareWith : this . share . shareWith ,
initiator : this . share . ownerDisplayName ,
} )
} , l10nOptions )
}
return t ( 'files_sharing' , 'Shared via link by {initiator}' , {
initiator : this . share . ownerDisplayName ,
} )
} , l10nOptions )
}
if ( this . share . label && this . share . label . trim ( ) !== '' ) {
if ( this . isEmailShareType ) {
if ( this . isFileRequest ) {
return t ( 'files_sharing' , 'File request ({label})' , {
label : this . share . label . trim ( ) ,
} )
} , l10nOptions )
}
return t ( 'files_sharing' , 'Mail share ({label})' , {
label : this . share . label . trim ( ) ,
} )
} , l10nOptions )
}
return t ( 'files_sharing' , 'Share link ({label})' , {
label : this . share . label . trim ( ) ,
} )
} , l10nOptions )
}
if ( this . isEmailShareType ) {
if ( ! this . share . shareWith || this . share . shareWith . trim ( ) === '' ) {
@ -383,6 +382,7 @@ export default {
}
return null
} ,
passwordExpirationTime ( ) {
if ( this . share . passwordExpirationTime === null ) {
return null
@ -605,7 +605,7 @@ export default {
* @ param { boolean } shareReviewComplete if the share was reviewed
* /
async onNewLinkShare ( shareReviewComplete = false ) {
this . logger . debug ( 'onNewLinkShare called (with this.share)' , this . share )
logger . debug ( 'onNewLinkShare called (with this.share)' , this . share )
/ / d o n o t r u n a g a i n i f a l r e a d y l o a d i n g
if ( this . loading ) {
return
@ -620,7 +620,7 @@ export default {
shareDefaults . expiration = this . formatDateToString ( this . config . defaultExpirationDate )
}
this . logger . debug ( 'Missing required properties?' , this . enforcedPropertiesMissing )
logger . debug ( 'Missing required properties?' , this . enforcedPropertiesMissing )
/ / D o n o t p u s h y e t i f w e n e e d a p a s s w o r d o r a n e x p i r a t i o n d a t e : s h o w p e n d i n g m e n u
/ / A s h a r e w o u l d r e q u i r e a r e v i e w f o r e x a m p l e i s d e f a u l t e x p i r a t i o n d a t e i s s e t b u t n o t e n f o r c e d , t h i s a l l o w s
/ / t h e u s e r t o r e v i e w t h e s h a r e a n d r e m o v e t h e e x p i r a t i o n d a t e i f t h e y d o n ' t w a n t i t
@ -628,7 +628,7 @@ export default {
this . pending = true
this . shareCreationComplete = false
this . logger . info ( 'Share policy requires a review or has mandated properties (password, expirationDate)...' )
logger . info ( 'Share policy requires a review or has mandated properties (password, expirationDate)...' )
/ / E L S E , s h o w t h e p e n d i n g p o p o v e r m e n u
/ / i f p a s s w o r d d e f a u l t o r e n f o r c e d , p r e - f i l l w i t h r a n d o m o n e
@ -656,13 +656,13 @@ export default {
/ / i f t h e s h a r e i s v a l i d , c r e a t e i t o n t h e s e r v e r
if ( this . checkShare ( this . share ) ) {
try {
this . logger . info ( 'Sending existing share to server' , this . share )
logger . info ( 'Sending existing share to server' , this . share )
await this . pushNewLinkShare ( this . share , true )
this . shareCreationComplete = true
this . logger . info ( 'Share created on server' , this . share )
logger . info ( 'Share created on server' , this . share )
} catch ( e ) {
this . pending = false
this . logger . error ( 'Error creating share' , e )
logger . error ( 'Error creating share' , e )
return false
}
return true