Skip to content

Commit 910d40a

Browse files
committed
Added unlisted videos limitations
1 parent 14b33fe commit 910d40a

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

apps/cf/lib/videos/videos.ex

+4-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ defmodule CF.Videos do
8080
Can also throw if bad permissions.
8181
"""
8282
def create!(user, video_url, params \\ []) do
83-
UserPermissions.check!(user, :add, :video)
83+
case Keyword.get(params, :unlisted, false) do
84+
false -> UserPermissions.check!(user, :add, :video)
85+
true -> UserPermissions.check!(user, :add, :unlisted_video)
86+
end
8487

8588
with metadata_fetcher when not is_nil(metadata_fetcher) <- get_metadata_fetcher(video_url),
8689
{:ok, metadata} <- metadata_fetcher.(video_url) do

apps/cf/priv/limitations.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ create:
77
statement: [ 0 , 3 , 6 , 12 , 15 , 25 , 30 , 30 , 30 ]
88
speaker: [ 0 , 0 , 0 , 3 , 6 , 15 , 30 , 40 , 50 ]
99
add:
10+
unlisted_video: [ 0 , 0 , 1 , 1 , 1 , 2 , 3 , 5 , 10 ]
1011
video: [ 0 , 0 , 0 , 0 , 1 , 2 , 3 , 5 , 10 ]
1112
speaker: [ 0 , 0 , 0 , 3 , 6 , 15 , 30 , 40 , 50 ]
1213
update:

apps/db/lib/db_type/entity.ex

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ defenum(
88
comment: 4,
99
fact: 5,
1010
user_action: 6,
11-
user: 7
11+
user: 7,
12+
unlisted_video: 8
1213
)

0 commit comments

Comments
 (0)