223223</template >
224224
225225<script >
226+ import { showError , showSuccess } from ' @nextcloud/dialogs'
226227import { emit } from ' @nextcloud/event-bus'
228+ import { t } from ' @nextcloud/l10n'
229+ import moment from ' @nextcloud/moment'
227230import { generateUrl , getBaseUrl } from ' @nextcloud/router'
228- import { showError , showSuccess } from ' @nextcloud/dialogs'
229231import { ShareType } from ' @nextcloud/sharing'
230- import VueQrcode from ' @chenfengyuan/vue-qrcode'
231- import moment from ' @nextcloud/moment'
232232
233+ import VueQrcode from ' @chenfengyuan/vue-qrcode'
233234import NcActionButton from ' @nextcloud/vue/components/NcActionButton'
234235import NcActionCheckbox from ' @nextcloud/vue/components/NcActionCheckbox'
235236import NcActionInput from ' @nextcloud/vue/components/NcActionInput'
@@ -258,7 +259,7 @@ import GeneratePassword from '../utils/GeneratePassword.ts'
258259import Share from ' ../models/Share.ts'
259260import SharesMixin from ' ../mixins/SharesMixin.js'
260261import ShareDetails from ' ../mixins/ShareDetails.js'
261- import { getLoggerBuilder } from ' @nextcloud/ logger'
262+ import logger from ' ../services/ logger.ts '
262263
263264export default {
264265 name: ' SharingEntryLink' ,
@@ -313,10 +314,6 @@ export default {
313314
314315 ExternalLegacyLinkActions: OCA .Sharing .ExternalLinkActions .state ,
315316 ExternalShareActions: OCA .Sharing .ExternalShareActions .state ,
316- logger: getLoggerBuilder ()
317- .setApp (' files_sharing' )
318- .detectUser ()
319- .build (),
320317
321318 // tracks whether modal should be opened or not
322319 showQRCode: false ,
@@ -330,33 +327,35 @@ export default {
330327 * @return {string}
331328 */
332329 title () {
330+ const l10nOptions = { escape: false /* no escape as this string is already escaped by Vue */ }
331+
333332 // if we have a valid existing share (not pending)
334333 if (this .share && this .share .id ) {
335334 if (! this .isShareOwner && this .share .ownerDisplayName ) {
336335 if (this .isEmailShareType ) {
337336 return t (' files_sharing' , ' {shareWith} by {initiator}' , {
338337 shareWith: this .share .shareWith ,
339338 initiator: this .share .ownerDisplayName ,
340- })
339+ }, l10nOptions )
341340 }
342341 return t (' files_sharing' , ' Shared via link by {initiator}' , {
343342 initiator: this .share .ownerDisplayName ,
344- })
343+ }, l10nOptions )
345344 }
346345 if (this .share .label && this .share .label .trim () !== ' ' ) {
347346 if (this .isEmailShareType ) {
348347 if (this .isFileRequest ) {
349348 return t (' files_sharing' , ' File request ({label})' , {
350349 label: this .share .label .trim (),
351- })
350+ }, l10nOptions )
352351 }
353352 return t (' files_sharing' , ' Mail share ({label})' , {
354353 label: this .share .label .trim (),
355- })
354+ }, l10nOptions )
356355 }
357356 return t (' files_sharing' , ' Share link ({label})' , {
358357 label: this .share .label .trim (),
359- })
358+ }, l10nOptions )
360359 }
361360 if (this .isEmailShareType ) {
362361 if (! this .share .shareWith || this .share .shareWith .trim () === ' ' ) {
@@ -391,6 +390,7 @@ export default {
391390 }
392391 return null
393392 },
393+
394394 passwordExpirationTime () {
395395 if (this .share .passwordExpirationTime === null ) {
396396 return null
@@ -613,7 +613,7 @@ export default {
613613 * @param {boolean} shareReviewComplete if the share was reviewed
614614 */
615615 async onNewLinkShare (shareReviewComplete = false ) {
616- this . logger .debug (' onNewLinkShare called (with this.share)' , this .share )
616+ logger .debug (' onNewLinkShare called (with this.share)' , this .share )
617617 // do not run again if already loading
618618 if (this .loading ) {
619619 return
@@ -628,15 +628,15 @@ export default {
628628 shareDefaults .expiration = this .formatDateToString (this .config .defaultExpirationDate )
629629 }
630630
631- this . logger .debug (' Missing required properties?' , this .enforcedPropertiesMissing )
631+ logger .debug (' Missing required properties?' , this .enforcedPropertiesMissing )
632632 // Do not push yet if we need a password or an expiration date: show pending menu
633633 // A share would require a review for example is default expiration date is set but not enforced, this allows
634634 // the user to review the share and remove the expiration date if they don't want it
635635 if ((this .sharePolicyHasEnforcedProperties && this .enforcedPropertiesMissing ) || this .shareRequiresReview (shareReviewComplete === true )) {
636636 this .pending = true
637637 this .shareCreationComplete = false
638638
639- this . logger .info (' Share policy requires a review or has mandated properties (password, expirationDate)...' )
639+ logger .info (' Share policy requires a review or has mandated properties (password, expirationDate)...' )
640640
641641 // ELSE, show the pending popovermenu
642642 // if password default or enforced, pre-fill with random one
@@ -664,13 +664,13 @@ export default {
664664 // if the share is valid, create it on the server
665665 if (this .checkShare (this .share )) {
666666 try {
667- this . logger .info (' Sending existing share to server' , this .share )
667+ logger .info (' Sending existing share to server' , this .share )
668668 await this .pushNewLinkShare (this .share , true )
669669 this .shareCreationComplete = true
670- this . logger .info (' Share created on server' , this .share )
670+ logger .info (' Share created on server' , this .share )
671671 } catch (e) {
672672 this .pending = false
673- this . logger .error (' Error creating share' , e)
673+ logger .error (' Error creating share' , e)
674674 return false
675675 }
676676 return true
0 commit comments