small fixes

This commit is contained in:
Hannes Mannerheim 2015-11-19 18:32:46 +01:00
parent f3161ec32f
commit cff9c53f78
5 changed files with 68 additions and 52 deletions

View File

@ -334,16 +334,9 @@ class QvitterPlugin extends Plugin {
} }
if($user instanceof User) { if($user instanceof User) {
if (common_logged_in()) {
$profilecurrent = Profile::current();
$currentuser = $profilecurrent->getUser();
header('Qvitter-User-Array: '.json_encode($this->qvitterTwitterUserArray($user->getProfile(),$currentuser)));
}
else {
header('Qvitter-User-Array: '.json_encode($this->qvitterTwitterUserArray($user->getProfile()))); header('Qvitter-User-Array: '.json_encode($this->qvitterTwitterUserArray($user->getProfile())));
} }
} }
}
break; break;
} }
@ -1096,7 +1089,7 @@ class QvitterPlugin extends Plugin {
} }
function qvitterTwitterUserArray($profile, $logged_in=false) function qvitterTwitterUserArray($profile)
{ {
$twitter_user = array(); $twitter_user = array();
@ -1159,14 +1152,14 @@ class QvitterPlugin extends Plugin {
$twitter_user['following'] = false; $twitter_user['following'] = false;
$twitter_user['statusnet_blocking'] = false; $twitter_user['statusnet_blocking'] = false;
$logged_in_profile = false;
if(common_logged_in()) {
$logged_in_profile = Profile::current(); $logged_in_profile = Profile::current();
if ($logged_in) { $twitter_user['following'] = $logged_in_profile->isSubscribed($profile);
$twitter_user['statusnet_blocking'] = $logged_in_profile->hasBlocked($profile);
$twitter_user['following'] = $logged_in->isSubscribed($profile);
$twitter_user['statusnet_blocking'] = $logged_in->hasBlocked($profile);
$logged_in_profile = $logged_in->getProfile();
} }

View File

@ -644,7 +644,7 @@ function setNewCurrentStream(streamObject,setLocation,fallbackId,actionOnSuccess
// blur any selected links // blur any selected links
$('a').blur(); $('a').blur();
// null any searches // null any pagings
$('#feed-body').removeAttr('data-search-page-number'); $('#feed-body').removeAttr('data-search-page-number');
// remember the most recent stream // remember the most recent stream
@ -844,6 +844,7 @@ function setNewCurrentStream(streamObject,setLocation,fallbackId,actionOnSuccess
$('#feed').animate({opacity:'1'},150); // fade in $('#feed').animate({opacity:'1'},150); // fade in
$('.reload-stream').show(); $('.reload-stream').show();
$('#feed-body').removeAttr('data-end-reached'); $('#feed-body').removeAttr('data-end-reached');
$('#feed-body').removeAttr('data-search-page-number');
$('body').removeClass('loading-older');$('body').removeClass('loading-newer'); $('body').removeClass('loading-older');$('body').removeClass('loading-newer');
$('html,body').scrollTop(0); // scroll to top $('html,body').scrollTop(0); // scroll to top
@ -1652,7 +1653,13 @@ function addToFeed(feed, after, extraClasses, isReply) {
if(typeof window.loggedIn.screen_name != 'undefined' // if logged in if(typeof window.loggedIn.screen_name != 'undefined' // if logged in
&& window.loggedIn.id != obj.id) { // not if this is me && window.loggedIn.id != obj.id) { // not if this is me
if(!(obj.statusnet_profile_url.indexOf('/twitter.com/')>-1 && obj.following === false)) { // only unfollow twitter users if(!(obj.statusnet_profile_url.indexOf('/twitter.com/')>-1 && obj.following === false)) { // only unfollow twitter users
var followButton = '<div class="user-actions"><button data-follow-user-id="' + obj.id + '" data-follow-user="' + obj.statusnet_profile_url + '" type="button" class="qvitter-follow-button ' + followingClass + '"><span class="button-text follow-text"><i class="follow"></i>' + window.sL.userFollow + '</span><span class="button-text following-text">' + window.sL.userFollowing + '</span><span class="button-text unfollow-text">' + window.sL.userUnfollow + '</span></button></div>'; var followButton = '<div class="user-actions">\
<button data-follow-user-id="' + obj.id + '" data-follow-user="' + obj.statusnet_profile_url + '" type="button" class="qvitter-follow-button ' + followingClass + '">\
<span class="button-text follow-text"><i class="follow"></i>' + window.sL.userFollow + '</span>\
<span class="button-text following-text">' + window.sL.userFollowing + '</span>\
<span class="button-text unfollow-text">' + window.sL.userUnfollow + '</span>\
</button>\
</div>';
} }
} }

View File

@ -645,17 +645,19 @@ function displayOrHideUnreadNotifications(notifications) {
· ·
· · · · · · · · · · · · · */ · · · · · · · · · · · · · */
function markAllNotificationsAsSeen() { function markAllNotificationsAsSeen(arg,callback) {
display_spinner(); display_spinner();
getFromAPI('qvitter/mark_all_notifications_as_seen.json',function(data){ getFromAPI('qvitter/mark_all_notifications_as_seen.json',function(data){
if(data === false) { if(data === false) {
showErrorMessage(window.sL.ERRORfailedMarkingAllNotificationsAsRead); showErrorMessage(window.sL.ERRORfailedMarkingAllNotificationsAsRead);
callback(true);
} }
else { else {
helloAPI(function(){ helloAPI(function(){
$('.not-seen-disc').remove(); $('.not-seen-disc').remove();
$('#new-queets-bar').trigger('click'); // show any hidden notifications (this will also remove the dropdown menu) $('#new-queets-bar').trigger('click'); // show any hidden notifications (this will also remove the dropdown menu)
remove_spinner(); remove_spinner();
callback(true);
}); });
} }
}); });

View File

@ -1150,6 +1150,16 @@ $('body').on('click',function(e){
· · · · · · · · · · · · · */ · · · · · · · · · · · · · */
$('body').on('click','.row-type-function',function(e){ $('body').on('click','.row-type-function',function(e){
var thisFunctionRow = $(this);
// don't invoke the function again if it's not finished last time
if(thisFunctionRow.hasClass('clicked')) {
return true;
}
thisFunctionRow.addClass('clicked');
var functionName = $(this).attr('data-function-name'); var functionName = $(this).attr('data-function-name');
if($(this).attr('data-function-arguments') == 'undefined') { if($(this).attr('data-function-arguments') == 'undefined') {
var functionArguments = false; var functionArguments = false;
@ -1157,7 +1167,11 @@ $('body').on('click','.row-type-function',function(e){
else { else {
var functionArguments = JSON.parse($(this).attr('data-function-arguments')); var functionArguments = JSON.parse($(this).attr('data-function-arguments'));
} }
window[functionName](functionArguments); window[functionName](functionArguments, function(success){
if(success) {
thisFunctionRow.removeClass('clicked');
}
});
}); });