Skip to content

Commit

Permalink
fix: Check video stream relation before loading (#5767)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamareebjamal authored Nov 25, 2020
1 parent 5d6f968 commit df1d513
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/components/public/session-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3 class="ui header" id="session-id-{{@session.id}}" style={{css color=(text-color @session.track.color)}}>
{{@session.title}}
<span style={{css float='right'}}>
{{#if @session.microlocation.videoStream}}
{{#if @session.microlocation.hasVideoStream}}
<button class="ui basic {{text-color @session.track.color 'basic' 'inverted'}} button" style={{css color=(text-color @session.track.color 'grey' 'lightgrey')}} {{action this.goToStream}}>
<i class="icon video"></i>
{{t 'Join Video'}}
Expand Down Expand Up @@ -90,7 +90,7 @@
</div>
{{/if}}

{{#if @session.microlocation.videoStream}}
{{#if @session.microlocation.hasVideoStream}}
<p style="white-space: pre-line;">
<a class="mt-2" href="{{href-to 'public.stream.view' (or @event.identifier @session.event.identifier) @session.microlocation.videoStream}}" target="_blank" rel="noopener">{{t 'Join Video Channel'}}</a>
{{#if @session.microlocation.videoStream.password}}
Expand Down
8 changes: 7 additions & 1 deletion app/models/microlocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ export default class Microlocation extends ModelBase.extend({
sessions : hasMany('session'),
event : belongsTo('event'),
videoStream : belongsTo('video-stream')
}) {}
}) {

get hasVideoStream(): boolean {
return this.belongsTo('videoStream').value() != null;
}

}

// DO NOT DELETE: this is how TypeScript knows how to look up your models.
declare module 'ember-data/types/registries/model' {
Expand Down

1 comment on commit df1d513

@vercel
Copy link

@vercel vercel bot commented on df1d513 Nov 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.