Fixed handling too long sources in pasted URLs
This commit is contained in:
parent
6219446f3e
commit
a0c407e39d
1 changed files with 7 additions and 2 deletions
|
@ -262,8 +262,9 @@ App.Presenters.PostUploadPresenter = function(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPostFromUrl(url) {
|
function addPostFromUrl(url) {
|
||||||
var post = _.extend({}, getDefaultPost(), {url: url, source: url, fileName: url});
|
var post = _.extend({}, getDefaultPost(), {url: url, fileName: url});
|
||||||
postAdded(post);
|
postAdded(post);
|
||||||
|
setPostsSource([post], url);
|
||||||
|
|
||||||
var matches = url.match(/watch.*?=([a-zA-Z0-9_-]+)/);
|
var matches = url.match(/watch.*?=([a-zA-Z0-9_-]+)/);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
|
@ -431,7 +432,11 @@ App.Presenters.PostUploadPresenter = function(
|
||||||
|
|
||||||
function setPostsSource(posts, newSource) {
|
function setPostsSource(posts, newSource) {
|
||||||
_.each(posts, function(post) {
|
_.each(posts, function(post) {
|
||||||
//todo: take care of max source length
|
var maxSourceLength = 200;
|
||||||
|
console.log(newSource);
|
||||||
|
if (newSource.length > maxSourceLength) {
|
||||||
|
newSource = newSource.substring(0, maxSourceLength - 5) + '(...)';
|
||||||
|
}
|
||||||
post.source = newSource;
|
post.source = newSource;
|
||||||
postChanged(post);
|
postChanged(post);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue