Fix lỗi set privacy chéo

This commit is contained in:
2026-06-10 15:00:40 +07:00
parent 727bda9b48
commit ec7a9186b6
9 changed files with 190 additions and 76 deletions
+5 -6
View File
@@ -1098,12 +1098,10 @@ async function openScene(sceneId, privacy, shareToken, force = false, initialPit
const scene = await sceneRes.json();
const hotspots = await hotspotsRes.json();
// [FIX] Lưu tourId đang hoạt động sau khi đã nạp dữ liệu scene thành công
// [TOUR ID] Cập nhật tourId hiện tại vào localStorage để các cảnh con kế thừa đúng
const currentTourId = scene.tourId?._id || scene.tourId || scene._id;
if (!localStorage.getItem('activeTourId') || force) {
localStorage.setItem('activeTourId', currentTourId);
}
localStorage.setItem('activeTourId', currentTourId);
if (!sceneRes.ok) throw new Error(scene.message || 'Failed to fetch scene details');
@@ -2063,7 +2061,8 @@ window.openEditMetadataModal = function(scene, isChildArg = null) {
sharedUsersData = scene.sharedWith || [];
sharedEmailsData = scene.sharedEmails || [];
// [FIX] Cập nhật activeTourId ngay khi chỉnh sửa để đồng bộ luồng tạo tour
// [TOUR ID] Cập nhật activeTourId ngay khi mở modal sửa để đảm bảo
// các thao tác tạo cảnh con sau đó (nếu có) luôn mang ID của Tour này.
const currentTourId = scene.tourId?._id || scene.tourId || scene._id;
localStorage.setItem('activeTourId', currentTourId);