Minor detail in No translation
Merge branch 'master' of https://github.com/hannesmannerheim/qvitter
This commit is contained in:
commit
a3bb8f981e
|
@ -198,6 +198,12 @@ class QvitterPlugin extends Plugin {
|
|||
'qvitter');
|
||||
}
|
||||
|
||||
// if qvitter is opt-out, disable the default register page
|
||||
if(self::settings('enabledbydefault')) {
|
||||
$m->connect('main/register',
|
||||
array('action' => 'qvitter'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -91,10 +91,18 @@ class ApiQvitterNotificationsAction extends ApiPrivateAuthAction
|
|||
|
||||
foreach($this->notifications as $notification) {
|
||||
|
||||
|
||||
// all but follow has an notice
|
||||
if($notification->ntype != 'follow') {
|
||||
|
||||
// we need a notice id here, skip this notification if notice id is null
|
||||
if($notification->notice_id === null) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
$notice = self::twitterSimpleStatusArray(Notice::getKV($notification->notice_id));
|
||||
}
|
||||
}
|
||||
|
||||
$notifications_populated[] = array(
|
||||
'id'=> $notification->id,
|
||||
|
|
|
@ -386,11 +386,11 @@ class QvitterAction extends ApiAction
|
|||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery.minicolors.min.js"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery.jWindowCrop.js"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/load-image.min.js"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions.js?v=24"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions.js?v=19"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions.js?v=11"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions.js?v=26"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions.js?v=21"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions.js?v=12"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lan.js?v=25"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter.js?v=20"></script>
|
||||
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter.js?v=23"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -87,7 +87,8 @@ class ApiAuthAction extends ApiAction
|
|||
|
||||
|
||||
// qvitterfix, accepts regular login session
|
||||
if ($this->scoped) {
|
||||
if (common_logged_in()) {
|
||||
$this->scoped = Profile::current();
|
||||
$this->auth_user = $this->scoped->getUser();
|
||||
$this->access = self::READ_WRITE;
|
||||
}
|
||||
|
@ -290,7 +291,7 @@ class ApiAuthAction extends ApiAction
|
|||
|
||||
// show error if the user clicks 'cancel'
|
||||
// TRANS: Client error thrown when authentication fails becaus a user clicked "Cancel".
|
||||
$this->clientError(_('Could not authenticate you.'), 401);
|
||||
$this->clientError(_('Could not authenticate you.'), 400);
|
||||
|
||||
} elseif($required) {
|
||||
|
||||
|
@ -319,7 +320,7 @@ class ApiAuthAction extends ApiAction
|
|||
);
|
||||
$this->logAuthFailure($msg);
|
||||
// TRANS: Client error thrown when authentication fails.
|
||||
$this->clientError(_('Could not authenticate you.'), 401);
|
||||
$this->clientError(_('Could not authenticate you.'), 400);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
|
|
@ -92,6 +92,14 @@ function getFromAPI(stream, actionOnSuccess) {
|
|||
$.ajax({ url: window.apiRoot + stream + qOrAmp(stream) + 't=' + timeNow(),
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
statusCode: {
|
||||
400:function() {
|
||||
location.reload(); // we may have been logged out in another tab, reload page
|
||||
},
|
||||
404:function() {
|
||||
window.location.replace(window.siteInstanceURL); // redirect to frontpage, probably when trying to access non-existing users
|
||||
}
|
||||
},
|
||||
success: function(data) {
|
||||
|
||||
data = convertEmptyObjectToEmptyArray(data);
|
||||
|
|
|
@ -842,7 +842,9 @@ function expand_queet(q,doScrolling) {
|
|||
if(q.hasClass('expanded') && !q.hasClass('collapsing')) {
|
||||
var sel = getSelection().toString();
|
||||
|
||||
if(!sel && !q.find('.queet-button').children('button').hasClass('enabled')) { // don't collapse if text is selected, or if queet has an active queet button
|
||||
if(!sel
|
||||
&& !q.find('.queet-button').children('button').hasClass('enabled')
|
||||
&& !q.find('.queet-button').children('button').hasClass('too-long')) { // don't collapse if text is selected, or if queet has an active queet button, or if queet text is too long
|
||||
|
||||
// remove some things right away
|
||||
q.find('.inline-reply-caret').remove();
|
||||
|
@ -1403,7 +1405,7 @@ function checkForHiddenConversationQueets(qid) {
|
|||
·
|
||||
· · · · · · · · · · · · · */
|
||||
|
||||
function addToFeed(feed, after, extraClasses) {
|
||||
function addToFeed(feed, after, extraClasses, isReply) {
|
||||
|
||||
// some streams, e.g. /statuses/show/1234.json is not enclosed in an array, make sure it is
|
||||
if(!$.isArray(feed)) {
|
||||
|
@ -1414,8 +1416,9 @@ function addToFeed(feed, after, extraClasses) {
|
|||
|
||||
var extraClassesThisRun = extraClasses;
|
||||
|
||||
// if this is the notifications feed
|
||||
if(window.currentStream.substring(0,35) == 'qvitter/statuses/notifications.json') {
|
||||
// if this is the notifications feed, but not if it is a reply
|
||||
if(window.currentStream.substring(0,35) == 'qvitter/statuses/notifications.json'
|
||||
&& !isReply) {
|
||||
|
||||
|
||||
// only if this notification isn't already in stream
|
||||
|
@ -1431,12 +1434,12 @@ function addToFeed(feed, after, extraClasses) {
|
|||
if(obj.ntype == 'like') {
|
||||
var noticeTime = parseTwitterDate(obj.notice.created_at);
|
||||
obj.notice = convertNewGNUSocialURItoURL(obj.notice);
|
||||
var notificationHtml = '<div data-quitter-id-in-stream="' + obj.id + '" id="stream-item-' + obj.id + '" class="stream-item ' + extraClassesThisRun + ' notification like"><div class="queet"><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '" title="' + obj.created_at + '">' + notificationTime + '</small><a class="account-group" href="' + obj.from_profile.statusnet_profile_url + '"><span class="dogear"></span><img class="avatar" src="' + obj.from_profile.profile_image_url + '" /><strong class="name" data-user-id="' + obj.from_profile.id + '" title="@' + obj.from_profile.screen_name + '">' + obj.from_profile.name + '</strong></a> ' + window.sL.xFavedYourQueet + '</div><div class="small-grey-notice"><a href="' + obj.notice.uri + '">' + noticeTime + '</a>: ' + $.trim(obj.notice.statusnet_html) + '</div></div></div></div>';
|
||||
var notificationHtml = '<div data-quitter-id-in-stream="' + obj.id + '" id="stream-item-n-' + obj.id + '" class="stream-item ' + extraClassesThisRun + ' notification like"><div class="queet"><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '" title="' + obj.created_at + '">' + notificationTime + '</small><a class="account-group" href="' + obj.from_profile.statusnet_profile_url + '"><span class="dogear"></span><img class="avatar" src="' + obj.from_profile.profile_image_url + '" /><strong class="name" data-user-id="' + obj.from_profile.id + '" title="@' + obj.from_profile.screen_name + '">' + obj.from_profile.name + '</strong></a> ' + window.sL.xFavedYourQueet + '</div><div class="small-grey-notice"><a href="' + obj.notice.uri + '">' + noticeTime + '</a>: ' + $.trim(obj.notice.statusnet_html) + '</div></div></div></div>';
|
||||
}
|
||||
else if(obj.ntype == 'repeat') {
|
||||
obj.notice = convertNewGNUSocialURItoURL(obj.notice);
|
||||
var noticeTime = parseTwitterDate(obj.notice.created_at);
|
||||
var notificationHtml = '<div data-quitter-id-in-stream="' + obj.id + '" id="stream-item-' + obj.id + '" class="stream-item ' + extraClassesThisRun + ' notification repeat"><div class="queet"><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '" title="' + obj.created_at + '">' + notificationTime + '</small><a class="account-group" href="' + obj.from_profile.statusnet_profile_url + '"><span class="dogear"></span><img class="avatar" src="' + obj.from_profile.profile_image_url + '" /><strong class="name" data-user-id="' + obj.from_profile.id + '" title="@' + obj.from_profile.screen_name + '">' + obj.from_profile.name + '</strong></a> ' + window.sL.xRepeatedYourQueet + '</div><div class="small-grey-notice"><a href="' + obj.notice.uri + '">' + noticeTime + '</a>: ' + $.trim(obj.notice.statusnet_html) + '</div></div></div></div>';
|
||||
var notificationHtml = '<div data-quitter-id-in-stream="' + obj.id + '" id="stream-item-n-' + obj.id + '" class="stream-item ' + extraClassesThisRun + ' notification repeat"><div class="queet"><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '" title="' + obj.created_at + '">' + notificationTime + '</small><a class="account-group" href="' + obj.from_profile.statusnet_profile_url + '"><span class="dogear"></span><img class="avatar" src="' + obj.from_profile.profile_image_url + '" /><strong class="name" data-user-id="' + obj.from_profile.id + '" title="@' + obj.from_profile.screen_name + '">' + obj.from_profile.name + '</strong></a> ' + window.sL.xRepeatedYourQueet + '</div><div class="small-grey-notice"><a href="' + obj.notice.uri + '">' + noticeTime + '</a>: ' + $.trim(obj.notice.statusnet_html) + '</div></div></div></div>';
|
||||
}
|
||||
else if(obj.ntype == 'mention') {
|
||||
var notificationHtml = buildQueetHtml(obj.notice, obj.id, extraClassesThisRun + ' notification mention');
|
||||
|
@ -1445,7 +1448,7 @@ function addToFeed(feed, after, extraClasses) {
|
|||
var notificationHtml = buildQueetHtml(obj.notice, obj.id, extraClassesThisRun + ' notification reply');
|
||||
}
|
||||
else if(obj.ntype == 'follow') {
|
||||
var notificationHtml = '<div data-quitter-id-in-stream="' + obj.id + '" id="stream-item-' + obj.id + '" class="stream-item ' + extraClassesThisRun + ' notification follow"><div class="queet"><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '" title="' + obj.created_at + '">' + notificationTime + '</small><a class="account-group" href="' + obj.from_profile.statusnet_profile_url + '"><img class="avatar" src="' + obj.from_profile.profile_image_url + '" /><strong class="name" data-user-id="' + obj.from_profile.id + '" title="@' + obj.from_profile.screen_name + '">' + obj.from_profile.name + '</strong></a> ' + window.sL.xStartedFollowingYou + '</div></div></div></div>';
|
||||
var notificationHtml = '<div data-quitter-id-in-stream="' + obj.id + '" id="stream-item-n-' + obj.id + '" class="stream-item ' + extraClassesThisRun + ' notification follow"><div class="queet"><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '" title="' + obj.created_at + '">' + notificationTime + '</small><a class="account-group" href="' + obj.from_profile.statusnet_profile_url + '"><img class="avatar" src="' + obj.from_profile.profile_image_url + '" /><strong class="name" data-user-id="' + obj.from_profile.id + '" title="@' + obj.from_profile.screen_name + '">' + obj.from_profile.name + '</strong></a> ' + window.sL.xStartedFollowingYou + '</div></div></div></div>';
|
||||
}
|
||||
|
||||
if(after) {
|
||||
|
|
|
@ -514,8 +514,8 @@ function qOrAmp(stream) {
|
|||
|
||||
function countCharsInQueetBox(src,trgt,btn) {
|
||||
|
||||
var $src_txt = $('<div/>').append($.trim(src.html()).replace(/ /gi,' ').replace(/<br>/i,'').replace(/<br>/gi,"x"));
|
||||
var numchars = ($.trim($src_txt.text())).length;
|
||||
var $src_txt = $('<div/>').append($.trim(src.text().replace(/^\s+|\s+$/g, '')));
|
||||
var numchars = ($src_txt.text()).length;
|
||||
|
||||
// check for long urls and disable/enable url shorten button if present
|
||||
var longurls = 0;
|
||||
|
@ -535,6 +535,7 @@ function countCharsInQueetBox(src,trgt,btn) {
|
|||
if(numchars > 0 && numchars < window.textLimit+1) {
|
||||
btn.removeClass('disabled');
|
||||
btn.addClass('enabled');
|
||||
btn.removeClass('too-long');
|
||||
|
||||
// deactivate button if it's equal to the start text
|
||||
var queetBox = btn.closest('.inline-reply-queetbox').children('.queet-box-syntax');
|
||||
|
@ -546,9 +547,15 @@ function countCharsInQueetBox(src,trgt,btn) {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(numchars > window.textLimit){
|
||||
btn.removeClass('enabled');
|
||||
btn.addClass('disabled');
|
||||
btn.addClass('too-long');
|
||||
}
|
||||
else {
|
||||
btn.removeClass('enabled');
|
||||
btn.addClass('disabled');
|
||||
btn.removeClass('too-long');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1376,7 +1376,7 @@ $('body').on('click', '.queet-toolbar button',function () {
|
|||
var queetBox = $(this).parent().parent().siblings('.queet-box');
|
||||
var queetBoxID = queetBox.attr('id');
|
||||
|
||||
var queetText = $.trim(queetBox.html().replace(/\n/g,'').replace(/<br>/g,"\n"));
|
||||
var queetText = $.trim(queetBox.text().replace(/^\s+|\s+$/g, ''));
|
||||
var queetHtml = '<div id="' + tempPostId + '" class="stream-item conversation temp-post" style="opacity:1"><div class="queet"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group"><img class="avatar" src="' + $('#user-avatar').attr('src') + '" /><strong class="name">' + $('#user-name').html() + '</strong> <span class="screen-name">@' + $('#user-screen-name').html() + '</span></a><small class="created-at">posting</small></div><div class="queet-text">' + queetText.replace(/\n/g,'<br>') + '</div><div class="stream-item-footer"><span class="stream-item-expand"> </span></div></div></div></div>';
|
||||
queetHtml = detectRTL(queetHtml);
|
||||
|
||||
|
@ -1420,7 +1420,7 @@ $('body').on('click', '.queet-toolbar button',function () {
|
|||
// show real queet
|
||||
var new_queet = Array();
|
||||
new_queet[0] = data;
|
||||
addToFeed(new_queet,tempPostId,'visible');
|
||||
addToFeed(new_queet,tempPostId,'visible', true);
|
||||
|
||||
// remove temp queet
|
||||
$('#' + tempPostId).remove();
|
||||
|
|
Loading…
Reference in New Issue
Block a user