File tree Expand file tree Collapse file tree 4 files changed +24
-28
lines changed
frontend/src/components/collaborator Expand file tree Collapse file tree 4 files changed +24
-28
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ import { errorToMultiLineToast } from '@/components/toast/toasts.js'
131131import CollaboratorListItem from ' @/components/collaborator/CollaboratorListItem.vue'
132132import PromptEntityDelete from ' @/components/prompt/PromptEntityDelete.vue'
133133import campCollaborationDisplayName from ' ../../../../common/helpers/campCollaborationDisplayName'
134+ import isOwnCampCollaboration from ' ./isOwnCampCollaboration.js'
134135
135136export default {
136137 name: ' CollaboratorEdit' ,
@@ -173,10 +174,7 @@ export default {
173174 )
174175 },
175176 isOwnCampCollaboration () {
176- if (! (typeof this .collaborator .user === ' function' )) {
177- return false
178- }
179- return this .$store .state .auth .user ? .id === this .collaborator .user ().id
177+ return isOwnCampCollaboration (this .collaborator , this .$store .state .auth )
180178 },
181179 name () {
182180 return campCollaborationDisplayName (this .collaborator , this .$tc .bind (this ), false )
Original file line number Diff line number Diff line change @@ -23,29 +23,10 @@ import CollaboratorEdit from '@/components/collaborator/CollaboratorEdit.vue'
2323import CollaboratorListItem from ' @/components/collaborator/CollaboratorListItem.vue'
2424import { sortBy } from ' lodash-es'
2525import campCollaborationDisplayName from ' @/common/helpers/campCollaborationDisplayName.js'
26+ import isOwnCampCollaboration from ' ./isOwnCampCollaboration.js'
2627
2728const ROLE_ORDER = [' manager' , ' member' , ' guest' ]
2829
29- /**
30- * @typedef Collaborator {
31- * user: () => { id: string },
32- * }
33- *
34- * @typedef Auth {
35- * user: { id: string },
36- * }
37- *
38- * @param {Collaborator} collaborator
39- * @param {Auth} auth
40- * @returns {boolean}
41- */
42- function isOwnCampCollaboration (collaborator , auth ) {
43- if (! (typeof collaborator .user === ' function' )) {
44- return false
45- }
46- return auth .user ? .id === collaborator .user ().id
47- }
48-
4930export default {
5031 name: ' CollaboratorList' ,
5132 components: {
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import DialogBase from '@/components/dialog/DialogBase.vue'
3535import campCollaborationDisplayName from ' @/common/helpers/campCollaborationDisplayName.js'
3636import { errorToMultiLineToast } from ' @/components/toast/toasts'
3737import PopoverPrompt from ' @/components/prompt/PopoverPrompt.vue'
38+ import isOwnCampCollaboration from ' ./isOwnCampCollaboration.js'
3839
3940export default {
4041 name: ' PromptCollaboratorDeactivate' ,
@@ -45,10 +46,7 @@ export default {
4546 },
4647 computed: {
4748 isOwnCampCollaboration () {
48- if (! (typeof this .entity .user === ' function' )) {
49- return false
50- }
51- return this .$store .state .auth .user ? .id === this .entity .user ().id
49+ return isOwnCampCollaboration (this .entity , this .$store .state .auth )
5250 },
5351 displayName () {
5452 return campCollaborationDisplayName (this .entity , this .$tc .bind (this ))
Original file line number Diff line number Diff line change 1+ /**
2+ * @typedef Collaborator {
3+ * user: () => { id: string },
4+ * }
5+ *
6+ * @typedef Auth {
7+ * user: { id: string },
8+ * }
9+ *
10+ * @param {Collaborator } collaborator
11+ * @param {Auth } auth
12+ * @returns {boolean }
13+ */
14+ export default function isOwnCampCollaboration ( collaborator , auth ) {
15+ if ( ! ( typeof collaborator . user === 'function' ) ) {
16+ return false
17+ }
18+ return auth . user ?. id === collaborator . user ( ) . id
19+ }
You can’t perform that action at this time.
0 commit comments