@7365admin1/layer-common 3.2.2 → 3.2.3
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 3.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 55160ca: Stop crashing on a null session in comments, feedback and visitor management
|
|
8
|
+
|
|
9
|
+
Several call sites read `currentUser.value._id` (and `.serviceProvider`,
|
|
10
|
+
`.type`, `.givenName`, `.surname`) with no guard. When the session is briefly
|
|
11
|
+
absent — during sign-out, on an expired session, or before the user has
|
|
12
|
+
resolved on first paint — `currentUser.value` is null and the property read
|
|
13
|
+
throws, taking the page down rather than the one action.
|
|
14
|
+
|
|
15
|
+
Those reads are now optional. Purely defensive: where a user exists the
|
|
16
|
+
behaviour is identical, and where one does not the field goes undefined instead
|
|
17
|
+
of throwing.
|
|
18
|
+
|
|
19
|
+
Covers the feedback list and its accept/submit handlers, the visitor
|
|
20
|
+
check-in/check-out path, and comment loading.
|
|
21
|
+
|
|
3
22
|
## 3.2.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -721,9 +721,9 @@ const {
|
|
|
721
721
|
_getFeedbacks({
|
|
722
722
|
page: page.value,
|
|
723
723
|
site: route.params.site as string,
|
|
724
|
-
provider: currentUser.value
|
|
725
|
-
...(currentUser.value
|
|
726
|
-
userId: currentUser.value
|
|
724
|
+
provider: currentUser.value?.serviceProvider,
|
|
725
|
+
...(currentUser.value?.type != "site" && {
|
|
726
|
+
userId: currentUser.value?._id,
|
|
727
727
|
}),
|
|
728
728
|
service: "Security",
|
|
729
729
|
dateFrom: moment(startDate.value, "DD/MM/YYYY").startOf("day"),
|
|
@@ -998,9 +998,9 @@ async function handleAccept() {
|
|
|
998
998
|
_id: feedbackData.value._id,
|
|
999
999
|
statusUpdate: {
|
|
1000
1000
|
status: "In-Progress",
|
|
1001
|
-
updatedById: currentUser.value
|
|
1002
|
-
updatedByName: `${currentUser.value
|
|
1003
|
-
assignee: currentUser.value
|
|
1001
|
+
updatedById: currentUser.value?._id,
|
|
1002
|
+
updatedByName: `${currentUser.value?.givenName} ${currentUser.value?.surname}`,
|
|
1003
|
+
assignee: currentUser.value?._id,
|
|
1004
1004
|
provider: currentUser.value?.serviceProvider,
|
|
1005
1005
|
},
|
|
1006
1006
|
};
|
|
@@ -1158,7 +1158,7 @@ async function submit() {
|
|
|
1158
1158
|
isSubmitting.value = true;
|
|
1159
1159
|
|
|
1160
1160
|
const result = await createFeedback({
|
|
1161
|
-
createdBy: currentUser.value
|
|
1161
|
+
createdBy: currentUser.value?._id,
|
|
1162
1162
|
description: _feedback.value.description,
|
|
1163
1163
|
attachments: _feedback.value.attachments,
|
|
1164
1164
|
site: route.params.site as string,
|
|
@@ -1708,7 +1708,7 @@ async function handleVisitorDataFromScannedQRCodeCheckInOut(
|
|
|
1708
1708
|
site: visitorData.site ?? siteId,
|
|
1709
1709
|
},
|
|
1710
1710
|
update: {
|
|
1711
|
-
updatedBy: currentUser.value
|
|
1711
|
+
updatedBy: currentUser.value?._id,
|
|
1712
1712
|
visitorPass: visitorPass.find(
|
|
1713
1713
|
(i: Record<string, any>) => i.keyId === null
|
|
1714
1714
|
)
|
|
@@ -89,13 +89,13 @@ export default function useComment() {
|
|
|
89
89
|
|
|
90
90
|
comments.value = _comments.items
|
|
91
91
|
.map((comment: any) => {
|
|
92
|
-
if (comment.createdBy === currentUser.value
|
|
92
|
+
if (comment.createdBy === currentUser.value?._id) {
|
|
93
93
|
comment.justify = "end";
|
|
94
94
|
} else {
|
|
95
95
|
comment.justify = "start";
|
|
96
96
|
if (
|
|
97
97
|
((Array.isArray(comment.seenBy) &&
|
|
98
|
-
!comment.seenBy.includes(currentUser.value
|
|
98
|
+
!comment.seenBy.includes(currentUser.value?._id)) ||
|
|
99
99
|
!comment?.seenBy) &&
|
|
100
100
|
comment?._id
|
|
101
101
|
) {
|
|
@@ -111,7 +111,7 @@ export default function useComment() {
|
|
|
111
111
|
);
|
|
112
112
|
|
|
113
113
|
if (Array.isArray(updateSeenIds) && updateSeenIds.length > 0) {
|
|
114
|
-
const seenBy = await updateSeenBy(updateSeenIds, currentUser.value
|
|
114
|
+
const seenBy = await updateSeenBy(updateSeenIds, currentUser.value?._id);
|
|
115
115
|
}
|
|
116
116
|
} catch (error) {
|
|
117
117
|
console.log("error :", error);
|