blob: 5693a28a44a2b7c1f4c2fa3b896a12ce9dc7aa2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
<template>
<div class="who-has-access">
<span :class="{hidden: !isLoading}" class="icon icon-loading" />
<span :class="{hidden: !isEmptyList}">
{{ emptyLabel }}
</span>
<Avatar v-for="uid in uniqueShareUIDs" :key="uid" :user="uid"
:display-name="uidDisplaynameMap[uid]" :size="64" />
</div>
</template>
<script>
import HttpClient from 'nextcloud-axios'
import Vue from 'vue'
import { generateOcsUrl } from 'nextcloud-server/dist/router'
import Avatar from 'nextcloud-vue/dist/Components/Avatar'
export default {
name: 'Shares',
components: {
Avatar
},
data() {
return {
uniqueShareUIDs: [],
uidDisplaynameMap: {},
isLoading: true
}
},
computed: {
isEmptyList() {
return this.isLoading === false && this.uniqueShareUIDs.length === 0
},
emptyLabel() {
return t('privacy', 'You don\'t have any shares with individual users.')
}
},
mounted: function() {
const url = generateOcsUrl('/apps/files_sharing/api/v1/shares?format=json&shared_with_me=false')
const currentUserId = OC.getCurrentUser()
HttpClient.get(url).then(resp => {
resp.data.ocs.data.forEach((d) => {
if (d.share_with === currentUserId) {
return
}
switch (d.share_type) {
case 0:
if (this.uniqueShareUIDs.indexOf(d.share_with) === -1) {
this.uniqueShareUIDs.push(d.share_with)
Vue.set(this.uidDisplaynameMap, d.share_with, d.share_with_displayname)
}
break
default:
break
}
})
this.isLoading = false
})
}
}
</script>
|