-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend live stream visibility options: public, unlisted, private
- Loading branch information
Showing
13 changed files
with
177 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
lib/asciinema_web/controllers/live_stream/secret_badge.html.heex
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
lib/asciinema_web/controllers/live_stream/visibility_badge.html.heex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<span | ||
:if={@visibility == :public} | ||
class="special-label" | ||
title="Anyone can view, displayed on your public profile when live" | ||
> | ||
public | ||
</span> | ||
<span | ||
:if={@visibility == :unlisted} | ||
class="special-label" | ||
title="Only people with the link can view" | ||
> | ||
unlisted | ||
</span> | ||
<span :if={@visibility == :private} class="special-label" title="Only accessible by you"> | ||
private | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
priv/repo/migrations/20240512060058_add_visibility_to_live_streams.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
defmodule Asciinema.Repo.Migrations.AddVisibilityToLiveStreams do | ||
use Ecto.Migration | ||
|
||
def up do | ||
execute("CREATE TYPE live_stream_visibility AS ENUM ('private', 'unlisted', 'public')") | ||
|
||
alter table(:live_streams) do | ||
add :visibility, :live_stream_visibility, null: false, default: "unlisted" | ||
end | ||
|
||
execute "UPDATE live_streams SET visibility = 'public' WHERE NOT private" | ||
|
||
alter table(:live_streams) do | ||
remove :private | ||
end | ||
end | ||
|
||
def down do | ||
alter table(:live_streams) do | ||
add :private, :boolean, null: false, default: true | ||
end | ||
|
||
execute "UPDATE live_streams SET private = FALSE WHERE visibility = 'public'" | ||
|
||
alter table(:live_streams) do | ||
remove :visibility | ||
end | ||
|
||
execute("DROP TYPE live_stream_visibility") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters