Skip to content

Commit

Permalink
fix(platform): small fixes (#182)
Browse files Browse the repository at this point in the history
Fixes channel_live_viewer_count column in users table and "null" being shown as stream title instead of nothing
  • Loading branch information
lennartkloock authored Jan 5, 2024
1 parent eb89932 commit 46bc686
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion platform/api/src/video_event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async fn handle_room_event<G: ApiGlobal>(global: &Arc<G>, event: event::Room, ti
connection_id: Some(connection_id),
..
}) => {
let res: Option<(common::database::Ulid,)> = sqlx::query_as("UPDATE users SET channel_active_connection_id = NULL, channel_live_viewer_count = NULL, channel_live_viewer_count_updated_at = NOW() WHERE channel_room_id = $1 AND channel_active_connection_id = $2 RETURNING id")
let res: Option<(common::database::Ulid,)> = sqlx::query_as("UPDATE users SET channel_active_connection_id = NULL, channel_live_viewer_count = 0, channel_live_viewer_count_updated_at = NOW() WHERE channel_room_id = $1 AND channel_active_connection_id = $2 RETURNING id")
.bind(Ulid::from(room_id.into_ulid()))
.bind(Ulid::from(connection_id.into_ulid()))
.fetch_optional(global.db().as_ref())
Expand Down
2 changes: 1 addition & 1 deletion platform/migrations/20230825170300_init.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE TABLE users (
channel_room_id UUID NOT NULL,
channel_active_connection_id UUID DEFAULT NULL,
channel_title VARCHAR(256),
channel_live_viewer_count INT4,
channel_live_viewer_count INT4 NOT NULL DEFAULT 0,
channel_live_viewer_count_updated_at TIMESTAMPTZ,
channel_description TEXT,
channel_links JSONB NOT NULL DEFAULT '[]'::JSONB,
Expand Down
4 changes: 3 additions & 1 deletion platform/website/src/components/channel/title.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@
});
</script>

{title}
{#if title}
{title}
{/if}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { viewersToString } from "$lib/utils";
import { page } from "$app/stores";
import type { Channel, DisplayColor } from "$/gql/graphql";
import type { DisplayColor } from "$/gql/graphql";
import DefaultAvatar from "../user/default-avatar.svelte";
import { fade } from "svelte/transition";
Expand Down

0 comments on commit 46bc686

Please sign in to comment.