Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/tasks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRaimund Schlüßler <raimund.schluessler@mailbox.org>2022-04-25 23:24:27 +0300
committerGitHub <noreply@github.com>2022-04-25 23:24:27 +0300
commit4237950c381fd3ac5af1c2de92ac09502e4432fc (patch)
tree09f3d52d61cd5d586f7393a46d5cd0fe8ff93ec0 /src
parent94dc6d87c091f777098b8f8b55dbb5aeae49642c (diff)
Use try/catch block to copy to clipboard (#1974)
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
Diffstat (limited to 'src')
-rw-r--r--src/components/AppNavigation/ListItemCalendar.vue56
1 files changed, 26 insertions, 30 deletions
diff --git a/src/components/AppNavigation/ListItemCalendar.vue b/src/components/AppNavigation/ListItemCalendar.vue
index bf8cb05b..5e781098 100644
--- a/src/components/AppNavigation/ListItemCalendar.vue
+++ b/src/components/AppNavigation/ListItemCalendar.vue
@@ -264,10 +264,6 @@ export default {
url += '?export'
return url
},
- url() {
- const rootURL = generateRemoteUrl('dav')
- return new URL(this.calendar.url, rootURL)
- },
hasShares() {
return this.calendar.shares.length > 0
},
@@ -418,37 +414,37 @@ export default {
clickOutsideMiddleware(event) {
return !event.target.closest('.edit-calendar')
},
- copyCalDAVUrl(event) {
+ async copyCalDAVUrl(event) {
// change to loading status
event.stopPropagation()
- const url = this.url
+ const url = String(new URL(this.calendar.url, generateRemoteUrl('dav')))
// copy link for calendar to clipboard
- this.$copyText(url)
- .then(e => {
- event.preventDefault()
- this.copySuccess = true
- this.copied = true
- // Notify calendar url was copied
- const msg = this.calendar.supportsEvents
- ? t('tasks', 'Calendar link copied to clipboard.')
- : t('tasks', 'List link copied to clipboard.')
- console.debug(msg)
- showSuccess(msg)
- }, e => {
- this.copySuccess = false
- this.copied = true
- const msg = this.calendar.supportsEvents
- ? t('tasks', 'Calendar link could not be copied to clipboard.')
- : t('tasks', 'List link could not be copied to clipboard.')
- showError(msg)
- }).then(() => {
- setTimeout(() => {
- // stop loading status regardless of outcome
- this.copied = false
- }, 2000)
- })
+ try {
+ await this.$copyText(url)
+ event.preventDefault()
+ this.copySuccess = true
+ this.copied = true
+ // Notify calendar url was copied
+ const msg = this.calendar.supportsEvents
+ ? t('tasks', 'Calendar link copied to clipboard.')
+ : t('tasks', 'List link copied to clipboard.')
+ console.debug(msg)
+ showSuccess(msg)
+ } catch (e) {
+ this.copySuccess = false
+ this.copied = true
+ const msg = this.calendar.supportsEvents
+ ? t('tasks', 'Calendar link could not be copied to clipboard.')
+ : t('tasks', 'List link could not be copied to clipboard.')
+ showError(msg)
+ } finally {
+ setTimeout(() => {
+ // stop loading status regardless of outcome
+ this.copied = false
+ }, 2000)
+ }
},
setColor(color) {
this.selectedColor = color