autocompletion: use avatar URLs, not filenames.

Not all avatar-providing plugins generate a local filename;
just using a pregenerated URL is safer.
This commit is contained in:
Joshua Judson Rosen 2014-11-24 22:46:57 -05:00
parent 96867c8983
commit 6de248fe04
3 changed files with 3 additions and 4 deletions

View File

@ -73,11 +73,11 @@ class ApiQvitterAllFollowingAction extends ApiBareAuthAction
$this->profiles = $this->getProfiles();
// only keep id, name, nickname and avatar filename
// only keep id, name, nickname and avatar URL
foreach($this->profiles as $p) {
try {
$avatar = Avatar::byProfile($p, AVATAR_STREAM_SIZE);
$avatar = $avatar->filename;
$avatar = $avatar->url;
} catch (Exception $e) {
$avatar = false;
}

View File

@ -176,7 +176,6 @@ class QvitterAction extends ApiAction
?>;
window.timeBetweenPolling = <?php print QvitterPlugin::settings("timebetweenpolling"); ?>;
window.apiRoot = '<?php print common_path("api/", StatusNet::isHTTPS()); ?>';
window.avatarRoot = '<?php print common_path("avatar/", StatusNet::isHTTPS()); ?>';
window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>';
window.siteRootDomain = '<?php print $siterootdomain; ?>';
window.siteInstanceURL = '<?php print $instanceurl; ?>';

View File

@ -324,7 +324,7 @@ function doLogin(streamToSet) {
var i=0;
$.each(data,function(k,v){
if(v[2] === false) { var avatar = window.defaultAvatarStreamSize; }
else { var avatar = window.avatarRoot + v[2]; }
else { var avatar = v[2]; }
v[0] = v[0] || v[1]; // if name is null we go with username there too
window.following[i] = { 'id': k,'name': v[0], 'username': v[1],'avatar': avatar };
i++;