Skip to content

Commit 77fbd32

Browse files
authored
bug: fix streamer permissions (#437)
1 parent 255f469 commit 77fbd32

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

components/match/DemoPlaybackControls.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
Trophy,
2626
} from "lucide-vue-next";
2727
import { useAuthStore } from "~/stores/AuthStore";
28+
import { e_player_roles_enum } from "~/generated/zeus";
2829
import CreateClipDialog from "~/components/clips/CreateClipDialog.vue";
2930
import { Button } from "~/components/ui/button";
3031
import { Kbd } from "~/components/ui/kbd";
@@ -50,9 +51,12 @@ import RoundSelector from "~/components/match/RoundSelector.vue";
5051
import SpectatorSlots from "~/components/stream-deck/SpectatorSlots.vue";
5152
import { resolveKeyToRealSlot } from "~/utilities/streamerSpecSlots";
5253
53-
// API gates clip creation at verified_user; we only check "logged in"
54-
// on the client so any logged-in viewer sees the button.
55-
const canCreateClip = computed(() => !!useAuthStore().me?.steam_id);
54+
// API gates clip creation at streamer; mirror that on the client so a
55+
// non-streamer viewer (e.g. a plain-user organizer watching their own demo)
56+
// doesn't see a button the action would reject.
57+
const canCreateClip = computed(() =>
58+
useAuthStore().isRoleAbove(e_player_roles_enum.streamer),
59+
);
5660
const showCreateClipDialog = ref(false);
5761
const dialogInitialMode = ref<"manual" | "auto">("auto");
5862
const editor = useClipEditor();

components/match/MatchActions.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ import {
175175
{{ $t("match.actions.stop_live") }}
176176
</template>
177177
</DropdownMenuItem>
178-
<Tooltip v-if="hasMatchDemos && !hasRegisteredGpu">
178+
<Tooltip v-if="canCreateClips && !hasRegisteredGpu">
179179
<TooltipTrigger as-child>
180180
<DropdownMenuItem disabled>
181181
{{ $t("match.actions.create_clips") }}
@@ -186,7 +186,7 @@ import {
186186
</TooltipContent>
187187
</Tooltip>
188188
<DropdownMenuItem
189-
v-else-if="hasMatchDemos"
189+
v-else-if="canCreateClips"
190190
@click="createClipsForMatch"
191191
>
192192
{{ $t("match.actions.create_clips") }}
@@ -887,6 +887,12 @@ export default {
887887
useAuthStore().isRoleAbove(e_player_roles_enum.administrator)
888888
);
889889
},
890+
canCreateClips() {
891+
return (
892+
this.hasMatchDemos &&
893+
useAuthStore().isRoleAbove(e_player_roles_enum.administrator)
894+
);
895+
},
890896
hasMinimumLineupPlayers() {
891897
return (
892898
this.match.lineup_1?.lineup_players.length >=

0 commit comments

Comments
 (0)