[fix] Local profil are not detected with static avatar server

- detectLocalOrExternalUserObject compare with base url of the server
- if static avatar used : return always external (even with local user)
This commit is contained in:
Denis Chenu 2017-04-15 20:29:21 +02:00
parent 155195c529
commit 1f31150932
2 changed files with 4 additions and 3 deletions

View File

@ -302,10 +302,8 @@ class QvitterAction extends ApiAction
} }
} }
?> ?>
<script> <script>
/* /*
@licstart The following is the entire license notice for the @licstart The following is the entire license notice for the
JavaScript code in this page. JavaScript code in this page.
@ -373,6 +371,7 @@ class QvitterAction extends ApiAction
window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>'; window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>';
window.siteRootDomain = '<?php print $siterootdomain; ?>'; window.siteRootDomain = '<?php print $siterootdomain; ?>';
window.siteInstanceURL = '<?php print $instanceurl; ?>'; window.siteInstanceURL = '<?php print $instanceurl; ?>';
window.avatarServer= <?php print json_encode(common_config('avatar', 'server')) ?>;
window.defaultLinkColor = '<?php print QvitterPlugin::settings("defaultlinkcolor"); ?>'; window.defaultLinkColor = '<?php print QvitterPlugin::settings("defaultlinkcolor"); ?>';
window.defaultBackgroundColor = '<?php print QvitterPlugin::settings("defaultbackgroundcolor"); ?>'; window.defaultBackgroundColor = '<?php print QvitterPlugin::settings("defaultbackgroundcolor"); ?>';
window.siteBackground = '<?php print QvitterPlugin::settings("sitebackground"); ?>'; window.siteBackground = '<?php print QvitterPlugin::settings("sitebackground"); ?>';

View File

@ -1054,7 +1054,9 @@ function userArrayCacheGetUserNicknameById(id) {
function detectLocalOrExternalUserObject(userObject) { function detectLocalOrExternalUserObject(userObject) {
var dataProfileImageUrlWithoutProtocol = removeProtocolFromUrl(userObject.profile_image_url); var dataProfileImageUrlWithoutProtocol = removeProtocolFromUrl(userObject.profile_image_url);
var siteInstanceURLWithoutProtocol = removeProtocolFromUrl(window.siteInstanceURL); var siteInstanceURLWithoutProtocol = removeProtocolFromUrl(window.siteInstanceURL);
if(dataProfileImageUrlWithoutProtocol.substring(0,siteInstanceURLWithoutProtocol.length) == siteInstanceURLWithoutProtocol){ if(dataProfileImageUrlWithoutProtocol.substring(0,siteInstanceURLWithoutProtocol.length) == siteInstanceURLWithoutProtocol
|| dataProfileImageUrlWithoutProtocol.substring(0,window.avatarServer.length) == window.avatarServer
){
return 'local'; return 'local';
} }
else { else {