diff --git a/modules/relay/src/main/JsonView.scala b/modules/relay/src/main/JsonView.scala index 4c87ae6c1b8a..93e83dc1ff5f 100644 --- a/modules/relay/src/main/JsonView.scala +++ b/modules/relay/src/main/JsonView.scala @@ -107,8 +107,8 @@ final class JsonView( .add("pinned" -> pinned.map: (id, name, image) => Json .obj( - "id" -> id, - "name" -> name + "userId" -> id, + "name" -> name ) .add("image" -> image.map(id => picfitUrl.thumbnail(id, 1200, 675)))), study = studyData.study, diff --git a/ui/analyse/src/study/relay/interfaces.ts b/ui/analyse/src/study/relay/interfaces.ts index 37f940a1848f..699295f0fdef 100644 --- a/ui/analyse/src/study/relay/interfaces.ts +++ b/ui/analyse/src/study/relay/interfaces.ts @@ -7,7 +7,7 @@ export interface RelayData { group?: RelayGroup; isSubscribed?: boolean; // undefined if anon videoUrls?: [string, string]; - pinned?: { id: string; name: string; image?: string }; + pinned?: { userId: string; name: string; image?: string }; } export interface RelayGame { diff --git a/ui/analyse/src/study/relay/relayCtrl.ts b/ui/analyse/src/study/relay/relayCtrl.ts index be5531f77cbc..2f6de2d71915 100644 --- a/ui/analyse/src/study/relay/relayCtrl.ts +++ b/ui/analyse/src/study/relay/relayCtrl.ts @@ -49,11 +49,11 @@ export default class RelayCtrl { setInterval(() => this.redraw(true), 1000); if (data.videoUrls) videoPlayerOnWindowResize(this.redraw); - if (data.pinned && this.pinStreamer()) this.streams.push([data.pinned.id, data.pinned.name]); + if (data.pinned && this.pinStreamer()) this.streams.push([data.pinned.userId, data.pinned.name]); site.pubsub.on('socket.in.crowd', d => { const s = (d.streams as [string, string][]) ?? []; - if (this.pinStreamer()) s.unshift([data.pinned!.id, data.pinned!.name]); + if (this.pinStreamer()) s.unshift([data.pinned!.userId, data.pinned!.name]); if (!s) return; if (this.streams.length === s.length && this.streams.every(([id], i) => id === s[i][0])) return; this.streams = s; @@ -105,13 +105,10 @@ export default class RelayCtrl { isStreamer = () => this.streams.some(([id]) => id === document.body.dataset.user); - pinStreamer = () => { - return ( - !this.currentRound().finished && - Date.now() > this.currentRound().startsAt! - 1000 * 3600 && - this.data.pinned != undefined - ); - }; + pinStreamer = () => + !this.currentRound().finished && + Date.now() > this.currentRound().startsAt! - 1000 * 3600 && + this.data.pinned != undefined; hidePinnedImage = () => { site.storage.set(`relay.hide-image.${this.id}`, 'true'); diff --git a/ui/analyse/src/study/relay/relayView.ts b/ui/analyse/src/study/relay/relayView.ts index 0041fe2e28e5..544afdb1eeb6 100644 --- a/ui/analyse/src/study/relay/relayView.ts +++ b/ui/analyse/src/study/relay/relayView.ts @@ -72,7 +72,7 @@ export function renderPinnedImage(relay: RelayCtrl) { attrs: { src: relay.data.pinned.image, style: 'cursor: pointer;' }, hook: bind('click', () => { const url = new URL(location.href); - url.searchParams.set('embed', relay.data.pinned!.id); + url.searchParams.set('embed', relay.data.pinned!.userId); window.location.replace(url); }), });