diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-16 21:37:17 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-16 21:37:17 +0100 |
commit | 5101105ef91bfe478f97546b78b321882da2079c (patch) | |
tree | a3deec88917fecb8f4299c710bab9ba7679b4803 /server/models | |
parent | 86e054b20fabb5934e09d0bcb096840dd28d69fd (diff) | |
download | PeerTube-5101105ef91bfe478f97546b78b321882da2079c.tar.gz PeerTube-5101105ef91bfe478f97546b78b321882da2079c.tar.zst PeerTube-5101105ef91bfe478f97546b78b321882da2079c.zip |
Video lib/model/reqvalidator refractoring
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/videos.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/server/models/videos.js b/server/models/videos.js index 436c08bfd..fd02ec9e1 100644 --- a/server/models/videos.js +++ b/server/models/videos.js | |||
@@ -31,8 +31,6 @@ var Videos = { | |||
31 | add: add, | 31 | add: add, |
32 | addRemotes: addRemotes, | 32 | addRemotes: addRemotes, |
33 | get: get, | 33 | get: get, |
34 | getVideoState: getVideoState, | ||
35 | isOwned: isOwned, | ||
36 | list: list, | 34 | list: list, |
37 | listOwned: listOwned, | 35 | listOwned: listOwned, |
38 | removeOwned: removeOwned, | 36 | removeOwned: removeOwned, |
@@ -102,38 +100,6 @@ function get (id, callback) { | |||
102 | }) | 100 | }) |
103 | } | 101 | } |
104 | 102 | ||
105 | function getVideoState (id, callback) { | ||
106 | get(id, function (err, video) { | ||
107 | if (err) return callback(err) | ||
108 | |||
109 | var exist = (video !== null) | ||
110 | var owned = false | ||
111 | if (exist === true) { | ||
112 | owned = (video.namePath !== null) | ||
113 | } | ||
114 | |||
115 | return callback(null, { exist: exist, owned: owned }) | ||
116 | }) | ||
117 | } | ||
118 | |||
119 | function isOwned (id, callback) { | ||
120 | VideosDB.findById(id, function (err, video) { | ||
121 | if (err || !video) { | ||
122 | if (!err) err = new Error('Cannot find this video.') | ||
123 | logger.error('Cannot find this video.') | ||
124 | return callback(err) | ||
125 | } | ||
126 | |||
127 | if (video.namePath === null) { | ||
128 | var error_string = 'Cannot remove the video of another pod.' | ||
129 | logger.error(error_string) | ||
130 | return callback(new Error(error_string), false, video) | ||
131 | } | ||
132 | |||
133 | callback(null, true, video) | ||
134 | }) | ||
135 | } | ||
136 | |||
137 | function list (callback) { | 103 | function list (callback) { |
138 | VideosDB.find(function (err, videos_list) { | 104 | VideosDB.find(function (err, videos_list) { |
139 | if (err) { | 105 | if (err) { |