@bimdata/bcf-components 6.1.1-rc.1 → 6.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bimdata/bcf-components",
3
- "version": "6.1.1-rc.1",
3
+ "version": "6.2.0-rc.1",
4
4
  "files": [
5
5
  "src",
6
6
  "vue3-plugin.js"
@@ -268,6 +268,10 @@ export default {
268
268
  type: Object,
269
269
  required: true,
270
270
  },
271
+ currentUserEmail: {
272
+ type: String,
273
+ required: false,
274
+ },
271
275
  },
272
276
  emits: [
273
277
  "back",
@@ -293,11 +297,6 @@ export default {
293
297
 
294
298
  const topicLabels = computed(() => Array.from(props.topic.labels ?? []).sort());
295
299
 
296
- const currentUserEmail = ref("");
297
- const loadCurrentUserEmail = async () => {
298
- currentUserEmail.value = (await service.fetchCurrentUser()).email ?? "";
299
- };
300
-
301
300
  const deleteTopic = async () => {
302
301
  try {
303
302
  showDeleteModal.value = false;
@@ -312,11 +311,8 @@ export default {
312
311
  }
313
312
  };
314
313
 
315
- onMounted(() => loadCurrentUserEmail())
316
-
317
314
  return {
318
315
  // References
319
- currentUserEmail,
320
316
  loading,
321
317
  priorityColor,
322
318
  showDeleteModal,
@@ -330,4 +326,4 @@ export default {
330
326
  };
331
327
  </script>
332
328
 
333
- <style scoped lang="scss" src="./BcfTopicOverview.scss"></style>
329
+ <style scoped lang="scss" src="./BcfTopicOverview.scss"></style>
@@ -120,7 +120,7 @@ export default {
120
120
  },
121
121
  currentUserEmail: {
122
122
  type: String,
123
- required: true,
123
+ required: false,
124
124
  },
125
125
  },
126
126
  emis: ["comment-created", "comment-updated", "comment-deleted", "view-comment-snapshot"],
@@ -26,7 +26,7 @@
26
26
  </div>
27
27
 
28
28
  <div class="topic-comment__header__right">
29
- <template v-if="currentUserEmail === comment.author">
29
+ <template v-if="canEditComment(comment)">
30
30
  <div class="topic-comment__header__right__actions flex">
31
31
  <template v-if="showMenu">
32
32
  <BIMDataButton ghost rounded icon @click="onOpenEdit">
@@ -163,7 +163,7 @@ export default {
163
163
  },
164
164
  currentUserEmail: {
165
165
  type: String,
166
- required: true,
166
+ required: false,
167
167
  },
168
168
  },
169
169
  emits: ["comment-updated", "comment-deleted", "view-comment-snapshot"],
@@ -221,6 +221,13 @@ export default {
221
221
  viewpoint.value = await viewer.getViewpoint();
222
222
  };
223
223
 
224
+ const canEditComment = comment => {
225
+ if (!props.currentUserEmail) {
226
+ return false;
227
+ }
228
+ return currentUserEmail === comment.author;
229
+ }
230
+
224
231
  const submitUpdate = async () => {
225
232
  try {
226
233
  if (props.comment.comment === text.value && !viewpoint.value) {
@@ -307,6 +314,7 @@ export default {
307
314
  closeMenu,
308
315
  createViewpoint,
309
316
  deleteViewpoint,
317
+ canEditComment,
310
318
  highlightViewer,
311
319
  onOpenDelete,
312
320
  onOpenEdit,