Commit 3968aba9 by hannes

mastodon fixes for last commit

parent a37a4cb9
......@@ -54,7 +54,6 @@ class ApiExternalUserShowAction extends ApiPrivateAuthAction
$this->profile = new stdClass();
$this->profile->external = null;
$this->profile->local = null;
$this->profile->ostatus = null;
// the user might not exist in our db yet, try to use the Ostatus plugin
// to get it in there
......@@ -112,6 +111,8 @@ class ApiExternalUserShowAction extends ApiPrivateAuthAction
if($local_profile instanceof Profile) {
$this->profile->local = $this->twitterUserArray($local_profile);
// if profile url is not ending with nickname, this is probably a single user instance
if(!substr($local_profile->profileurl, -strlen($local_profile->nickname))===$local_profile->nickname) {
$external_instance_url = $local_profile->profileurl;
......@@ -128,7 +129,6 @@ class ApiExternalUserShowAction extends ApiPrivateAuthAction
}
$this->profile->external = $external_profile;
$this->profile->local = $this->twitterUserArray($local_profile);
return true;
}
......
......@@ -1096,6 +1096,11 @@ function guessInstanceUrlWithoutProtocolFromProfileUrlAndNickname(profileUrl, ni
guessedInstanceUrl = guessedInstanceUrl.slice(0,-1);
}
// fix new mastodon style profile urls
if(guessedInstanceUrl.indexOf('/@') > -1) {
guessedInstanceUrl = guessedInstanceUrl.substring(0, guessedInstanceUrl.indexOf('/@'));
}
return guessedInstanceUrl;
}
......
......@@ -532,6 +532,7 @@ $('#find-someone input').keyup(function(e){
var domain = val.substring(val.indexOf('@')+1);
var urlToTry = 'https://' + domain + '/' + username;
var secondUrlToTry = 'http://' + domain + '/' + username;
var thirdUrlToTry = 'https://' + domain + '/@' + username; // mastodon
getFromAPI('qvitter/external_user_show.json?profileurl=' + encodeURIComponent(urlToTry),function(data){
if(data && data.local !== null) {
......@@ -547,7 +548,16 @@ $('#find-someone input').keyup(function(e){
});
}
else {
cantFindSomeone(thisFindSomeoneInput);
getFromAPI('qvitter/external_user_show.json?profileurl=' + encodeURIComponent(thirdUrlToTry),function(data){
if(data && data.local !== null) {
setNewCurrentStream(pathToStreamRouter('user/' + data.local.id),true,false,function(){
foundSomeone(thisFindSomeoneInput);
});
}
else {
cantFindSomeone(thisFindSomeoneInput);
}
});
}
});
}
......@@ -559,7 +569,6 @@ $('#find-someone input').keyup(function(e){
}
});
function cantFindSomeone(thisFindSomeoneInput) {
thisFindSomeoneInput.css('background-color','pink');
thisFindSomeoneInput.effect('shake',{distance:5,times:3,duration:700},function(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment