Skip to content

Commit

Permalink
bug(Notes): Fix edit tabs being leaked
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruptein authored Oct 19, 2024
1 parent 6ad2a45 commit 06d6f3e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ tech changes will usually be stripped from release notes for the public

## Unreleased

### Fixed

- Notes:
- It was possible to open a 'view-only' note on a tab you weren't supposed to see

## [2024.3.0] - 2024-10-13

### Removed
Expand Down
8 changes: 6 additions & 2 deletions client/src/game/ui/notes/NoteEdit.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, onBeforeMount, ref } from "vue";
import { computed, onBeforeMount, ref, watchEffect } from "vue";
import VueMarkdown from "vue-markdown-render";
import { useModal } from "../../../core/plugins/modals/plugin";
Expand Down Expand Up @@ -30,7 +30,7 @@ const canEdit = computed(() => {
const localShapenotes = computed(() =>
note.value === undefined
? []
: noteState.reactive.shapeNotes.get2(note.value.uuid)?.map((s) => ({ ...getProperties(s), id: s })) ?? [],
: (noteState.reactive.shapeNotes.get2(note.value.uuid)?.map((s) => ({ ...getProperties(s), id: s })) ?? []),
);
const showOnHover = computed({
Expand Down Expand Up @@ -100,6 +100,10 @@ const tabs = computed(
const activeTabIndex = ref(0);
const activeTab = computed(() => tabs.value[activeTabIndex.value]!.label);
watchEffect(() => {
if (!canEdit.value && !tabs.value[activeTabIndex.value]!.visible) activeTabIndex.value = 0;
});
// Ensure that defaultAccess is always first
// and that defaultAccess is provided even if it has no DB value
const accessLevels = computed(() => {
Expand Down

0 comments on commit 06d6f3e

Please sign in to comment.