Skip to content

Commit

Permalink
Added unlisted videos limitations
Browse files Browse the repository at this point in the history
  • Loading branch information
wdestin committed Mar 15, 2021
1 parent 14b33fe commit 910d40a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion apps/cf/lib/videos/videos.ex
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ defmodule CF.Videos do
Can also throw if bad permissions.
"""
def create!(user, video_url, params \\ []) do
UserPermissions.check!(user, :add, :video)
case Keyword.get(params, :unlisted, false) do
false -> UserPermissions.check!(user, :add, :video)
true -> UserPermissions.check!(user, :add, :unlisted_video)
end

with metadata_fetcher when not is_nil(metadata_fetcher) <- get_metadata_fetcher(video_url),
{:ok, metadata} <- metadata_fetcher.(video_url) do
Expand Down
1 change: 1 addition & 0 deletions apps/cf/priv/limitations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ create:
statement: [ 0 , 3 , 6 , 12 , 15 , 25 , 30 , 30 , 30 ]
speaker: [ 0 , 0 , 0 , 3 , 6 , 15 , 30 , 40 , 50 ]
add:
unlisted_video: [ 0 , 0 , 1 , 1 , 1 , 2 , 3 , 5 , 10 ]
video: [ 0 , 0 , 0 , 0 , 1 , 2 , 3 , 5 , 10 ]
speaker: [ 0 , 0 , 0 , 3 , 6 , 15 , 30 , 40 , 50 ]
update:
Expand Down
3 changes: 2 additions & 1 deletion apps/db/lib/db_type/entity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ defenum(
comment: 4,
fact: 5,
user_action: 6,
user: 7
user: 7,
unlisted_video: 8
)

0 comments on commit 910d40a

Please sign in to comment.