update from git.gnu.io

This commit is contained in:
Hannes Mannerheim 2016-02-25 11:10:55 +01:00
parent 8dc071c955
commit 2570877580
9 changed files with 162 additions and 68 deletions

View File

@ -528,16 +528,16 @@ class QvitterPlugin extends Plugin {
$oembed = File_oembed::getKV('file_id',$attachment->id);
if($oembed instanceof File_oembed) {
$oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags
if($oembed->provider == 'Twitter' && strstr($oembed_html, '>— '.$oembed->author_name)) {
$oembed_html = substr($oembed_html,0,strpos($oembed_html, '>— '.$oembed->author_name)+1); // remove user data from twitter oembed html (we have it in )
$twitter_username = substr($oembed->html,strpos($oembed->html, '>— '.$oembed->author_name)+strlen('>— '.$oembed->author_name));
if($oembed->provider == 'Twitter' && strstr($oembed_html, '> '.$oembed->author_name)) {
$oembed_html = substr($oembed_html,0,strpos($oembed_html, '> '.$oembed->author_name)+1); // remove user data from twitter oembed html (we have it in )
$twitter_username = substr($oembed->html,strpos($oembed->html, '> '.$oembed->author_name)+strlen('> '.$oembed->author_name));
$twitter_username = substr($twitter_username, strpos($twitter_username,'(@')+1);
$twitter_username = substr($twitter_username, 0,strpos($twitter_username,')'));
$oembed->title = $twitter_username;
}
$oembed_html = str_replace('…','...',$oembed_html); // ellipsis is sometimes stored as html in db, for some reason
$oembed_html = mb_substr(trim(strip_tags(html_entity_decode($oembed_html,ENT_QUOTES))),0,250); // sometimes we have html charachters that we want to decode and then strip
$oembed_title = trim(strip_tags(html_entity_decode($oembed->title,ENT_QUOTES)));
$oembed_html = mb_substr(trim(strip_tags($oembed_html)),0,250);
$oembed_title = trim(strip_tags(html_entity_decode($oembed->title,ENT_QUOTES))); // sometimes we have html charachters that we want to decode and then strip
$oembed_provider = trim(strip_tags(html_entity_decode($oembed->provider,ENT_QUOTES)));
$oembed_author_name = trim(strip_tags(html_entity_decode($oembed->author_name,ENT_QUOTES)));
$attachment_url_to_id[$enclosure_o->url]['oembed'] = array(
@ -703,11 +703,33 @@ class QvitterPlugin extends Plugin {
// reply-to profile url
try {
$reply = $notice->getParent();
$twitter_status['in_reply_to_profileurl'] = $reply->getProfile()->getUrl();
$reply_profile = $reply->getProfile();
$twitter_status['in_reply_to_profileurl'] = $reply_profile->getUrl();
$twitter_status['in_reply_to_ostatus_uri'] = $reply_profile->getUri();
} catch (ServerException $e) {
$twitter_status['in_reply_to_profileurl'] = null;
$twitter_status['in_reply_to_ostatus_uri'] = null;
}
// attentions
try {
$attentions = $notice->getAttentionProfiles();
$attentions_array = array();
foreach ($attentions as $attn) {
if(!$attn->isGroup()) {
$attentions_array[] = array(
'id' => $attn->getID(),
'screen_name' => $attn->getNickname(),
'fullname' => $attn->getStreamName(),
'profileurl' => $attn->getUrl(),
'ostatus_uri' => $attn->getUri(),
);
}
}
$twitter_status['attentions'] = $attentions_array;
} catch (Exception $e) {
//
}
// fave number
$faves = Fave::byNotice($notice);

View File

@ -109,14 +109,18 @@ class ApiQvitterBlocksAction extends ApiPrivateAuthAction
$blocks = QvitterBlocked::getBlocked($this->target->id, $offset, $limit);
$profiles = array();
if($blocks) {
$profiles = array();
while ($blocks->fetch()) {
$this_profile_block = clone($blocks);
$profiles[] = $this->getTargetProfile($this_profile_block->blocked);
while ($blocks->fetch()) {
$this_profile_block = clone($blocks);
$profiles[] = $this->getTargetProfile($this_profile_block->blocked);
}
return $profiles;
} else {
return false;
}
return $profiles;
}
/**

View File

@ -158,6 +158,17 @@ class QvitterAction extends ApiAction
print ' <link title="FOAF for '.$nickname.'" type="application/rdf+xml" href="'.$instanceurl.$nickname.'/foaf" rel="meta">'."\n";
print ' <link href="'.$instanceurl.$nickname.'/microsummary" rel="microsummary">'."\n";
// rel="me" for the IndieWeb audience
$relMes = array(
['href' => $user->getProfile()->getHomepage(),
'text' => _('Homepage'),
'image' => null],
);
Event::handle('OtherAccountProfiles', array($user->getProfile(), &$relMes));
foreach ($relMes as $relMe) {
print ' <link href="'.htmlspecialchars($relMe['href']).'" title="'.$relMe['text'].'" rel="me" />'."\n";
}
// maybe openid
if (array_key_exists('OpenID', StatusNet::getActivePlugins())) {
print ' <link rel="openid2.provider" href="'.common_local_url('openidserver').'"/>'."\n";

View File

@ -49,7 +49,12 @@ class QvitterBlocked extends Profile_block
public static function getBlocked($profile_id, $offset = 0, $limit = PROFILES_PER_PAGE)
{
$ids = self::getBlockedIDs($profile_id, $offset, $limit);
return Profile_block::listFind('blocked', $ids);
try {
$blocked = Profile_block::listFind('blocked', $ids);
return $blocked;
} catch(NoResultException $e) {
return false;
}
}

View File

@ -3218,7 +3218,8 @@ ul.stats .avatar-row .avatar {
.permalink-link {
color: #999999 !important;
}
.permalink-link:hover {
.permalink-link:hover,
.longdate a:hover {
text-decoration:underline;
}

View File

@ -1224,8 +1224,6 @@ function expand_queet(q,doScrolling) {
if($.inArray(attachment_mimetype, ['video/mp4', 'video/ogg', 'video/quicktime', 'video/webm']) >=0) {
if(q.children('.queet').find('.expanded-content').children('.media').children('video').children('source[href="' + attachment_title + '"]').length < 1) { // not if already showed
console.log('video!');
// local attachment with a thumbnail
var attachment_poster = '';
if(typeof this.thumb_url != 'undefined') {
@ -1337,32 +1335,40 @@ function replyFormHtml(streamItem,qid) {
var cachedText = encodeURIComponent(data);
}
// object with ostatus-uri as key to avoid duplicates
var screenNamesToAdd = {};
// add the screen name to the one we're replying to (if it's not me)
if(!thisIsALinkToMyProfile(q.find('.account-group').attr('href'))) {
var replyToScreenName = q.find('.account-group span.screen-name').html().replace('@','');
screenNamesToAdd[q.find('.account-group').attr('href')] = replyToScreenName;
// add the screen name to the one we're replying to first (if it's not me)
if(!thisIsALinkToMyProfile(streamItem.attr('data-user-profile-url')) && typeof streamItem.attr('data-user-ostatus-uri') != 'undefined') {
screenNamesToAdd[streamItem.attr('data-user-ostatus-uri')] = streamItem.attr('data-user-screen-name');
}
// add the screen name to the one who the one we're replying to is replying to (if it's not me)
if(q.find('i.addressees > span.reply-to').length > 0
&& !thisIsALinkToMyProfile(q.find('i.addressees > span.reply-to > a').attr('href'))) {
var replyToScreenName = q.find('i.addressees > span.reply-to > a').html().replace('@','');
if(typeof screenNamesToAdd[q.find('i.addressees > span.reply-to > a').attr('href')] == 'undefined') {
screenNamesToAdd[q.find('i.addressees > span.reply-to > a').attr('href')] = replyToScreenName;
}
// old style notice (probably cached, this can be removed later)
else if (typeof streamItem.attr('data-user-ostatus-uri') == 'undefined') {
screenNamesToAdd[q.find('.account-group').attr('href')] = q.find('.screen-name').text().replace('@','');
}
// get all other mentions (if it's not me)
$.each(q.find('.queet-text').find('.mention'),function(key,obj){
if(!thisIsALinkToMyProfile($(obj).attr('href'))) {
if(typeof screenNamesToAdd[$(obj).attr('href')] == 'undefined') {
var thisMention = $(obj).html().replace('@','');
screenNamesToAdd[$(obj).attr('href')] = thisMention;
}
// add the rest of the attentions (not me)
if(q.children('script.attentions-json').length > 0
&& q.children('script.attentions-json').text() != 'undefined') {
try {
var attentionsParsed = JSON.parse(q.children('script.attentions-json').text());
}
});
catch(e) {
var attentionsParsed = false;
console.log('could not parse attentions json: ' + e);
console.log("attentions-json: " + q.children('script.attentions-json').text());
}
if(attentionsParsed !== false) {
$.each(attentionsParsed, function() {
if(!thisIsALinkToMyProfile(this.profileurl)
&& typeof screenNamesToAdd[this.ostatus_uri] == 'undefined') {
screenNamesToAdd[this.ostatus_uri] = this.screen_name;
}
});
}
}
// build reply/rant strings
var repliesText = '';
@ -2035,8 +2041,19 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat
// reply-to html
var reply_to_html = '';
if(obj.in_reply_to_screen_name !== null && obj.in_reply_to_profileurl !== null && obj.in_reply_to_screen_name != obj.user.screen_name) {
reply_to_html = '<span class="reply-to"><a class="h-card mention" href="' + obj.in_reply_to_profileurl + '">@' + obj.in_reply_to_screen_name + '</a></span> ';
if(obj.in_reply_to_screen_name !== null
&& obj.in_reply_to_profileurl !== null
&& obj.in_reply_to_profileurl != obj.user.statusnet_profile_url) {
var replyToProfileurl = obj.in_reply_to_profileurl;
var replyToScreenName = obj.in_reply_to_screen_name;
}
// if we don't have a reply-to, we might have attentions, in that case use the first one as reply
else if(typeof obj.attentions != 'undefined' && typeof obj.attentions[0] != 'undefined') {
var replyToProfileurl = obj.attentions[0].profileurl;
var replyToScreenName = obj.attentions[0].screen_name;
}
if(typeof replyToProfileurl != 'undefined' && typeof replyToScreenName != 'undefined') {
reply_to_html = '<span class="reply-to"><a class="h-card mention" href="' + replyToProfileurl + '">@' + replyToScreenName + '</a></span> ';
}
// in-groups html
@ -2092,26 +2109,37 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat
statusnetHTML = statusnetHTML.slice(0,-4);
}
// external
var ostatusHtml = '';
if(obj.is_local === false) {
if(obj.user.is_local === false) {
ostatusHtml = '<a target="_blank" data-tooltip="' + window.sL.goToOriginalNotice + '" class="ostatus-link" href="' + obj.external_url + '"></a>';
var qSource = '<a href="' + obj.external_url + '">' + getHost(obj.external_url) + '</a>';
}
else {
var qSource = obj.source;
}
var queetTime = parseTwitterDate(obj.created_at);
var queetHtml = '<div \
id="' + idPrepend + 'stream-item-' + idInStream + '" \
data-uri="' + URItoUse + '" \
class="stream-item notice ' + extraClasses + '" \
data-source="' + escape(obj.source) + '" \
data-source="' + escape(qSource) + '" \
data-quitter-id="' + obj.id + '" \
data-conversation-id="' + obj.statusnet_conversation_id + '" \
data-quitter-id-in-stream="' + idInStream + '" \
data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" \
data-in-reply-to-profile-url="' + obj.in_reply_to_profileurl + '" \
data-in-reply-to-profile-ostatus-uri="' + obj.in_reply_to_ostatus_uri + '" \
data-in-reply-to-status-id="' + obj.in_reply_to_status_id + '"\
data-user-id="' + obj.user.id + '"\
data-user-screen-name="' + obj.user.screen_name + '"\
data-user-ostatus-uri="' + obj.user.ostatus_uri + '"\
data-user-profile-url="' + obj.user.statusnet_profile_url + '"\
' + requeetedByMe + '>\
<div class="queet" id="' + idPrepend + 'q-' + idInStream + '"' + blockingTooltip + '>\
<script class="attachment-json" type="application/json">' + JSON.stringify(obj.attachments) + '</script>\
<script class="attentions-json" type="application/json">' + JSON.stringify(obj.attentions) + '</script>\
' + requeetHtml + '\
' + ostatusHtml + '\
<div class="queet-content">\

File diff suppressed because one or more lines are too long

View File

@ -2952,17 +2952,18 @@ $('body').on('keyup paste input', 'div.queet-box-syntax', function() {
}
// long enough match, create a mention span
else {
// don't include ending char, if any of these
// don't include ending char, if any of these (but tags can contain and end with . and -)
if(currentMatch[0].slice(-1) == '<'
|| currentMatch[0].slice(-1) == '&'
|| currentMatch[0].slice(-1) == '?'
|| currentMatch[0].slice(-1) == '!'
|| currentMatch[0].slice(-1) == ' '
|| currentMatch[0].slice(-1) == '-'
|| (currentMatch[0].slice(-1) == '-' && k != 'tag')
|| currentMatch[0].slice(-1) == ':'
|| currentMatch[0].slice(-1) == '.'
|| (currentMatch[0].slice(-1) == '.' && k != 'tag')
|| currentMatch[0].slice(-1) == ','
|| currentMatch[0].slice(-1) == ')') {
|| currentMatch[0].slice(-1) == ')'
|| currentMatch[0].slice(-1) == '\'') {
currentMatch[0] = currentMatch[0].slice(0,-1);
}

View File

@ -6,13 +6,13 @@
"loginSignIn": "Sign in",
"loginRememberMe": "Remember me",
"loginForgotPassword": "Forgot password?",
"notices": "Notices",
"notices": "Quips",
"followers": "Followers",
"following": "Following",
"groups": "Groups",
"compose": "Compose a new notice...",
"compose": "What's quipping?",
"queetVerb": "Send",
"queetsNounPlural": "Notices",
"queetsNounPlural": "Quips",
"logout": "Sign out",
"languageSelected": "Language:",
"viewMyProfilePage": "View my profile page",
@ -21,18 +21,18 @@
"details": "Details",
"expandFullConversation": "Expand full conversation",
"replyVerb": "Reply",
"requeetVerb": "Repeat",
"requeetVerb": "Requip",
"favoriteVerb": "Favorite",
"requeetedVerb": "Repeated",
"requeetedVerb": "Requipped",
"favoritedVerb": "Favorited",
"replyTo": "Reply to",
"requeetedBy": "Repeated by {requeeted-by}",
"requeetedBy": "Requipped by {requeeted-by}",
"favoriteNoun": "Favorite",
"favoritesNoun": "Favorites",
"requeetNoun": "Repeat",
"requeetsNoun": "Repeats",
"newQueet": "{new-notice-count} new notice",
"newQueets": "{new-notice-count} new notices",
"requeetNoun": "Requip",
"requeetsNoun": "Requips",
"newQueet": "{new-notice-count} new quip",
"newQueets": "{new-notice-count} new quips",
"longmonthsJanuary": "January",
"longmonthsFebruary": "February",
"longmonthsMars": "March",
@ -76,7 +76,7 @@
"searchVerb": "Search",
"deleteVerb": "Delete",
"cancelVerb": "Cancel",
"deleteConfirmation": "Are you sure you want to delete this notice?",
"deleteConfirmation": "Are you sure you want to delete this quip?",
"userExternalFollow": "Remote follow",
"userExternalFollowHelp": "Your account ID (e.g. user@rainbowdash.net).",
"userFollow": "Follow",
@ -108,8 +108,8 @@
"otherServers": "Alternatively you can create an account on another server of the GNU social network. <a href=\"http://federation.skilledtests.com/select_your_server.html\">Comparison</a>",
"editMyProfile": "Edit profile",
"notifications": "Notifications",
"xFavedYourQueet": "favorited your Queet",
"xRepeatedYourQueet": "requeeted you",
"xFavedYourQueet": "favorited your quip",
"xRepeatedYourQueet": "requipped you",
"xStartedFollowingYou": "followed you",
"followsYou": "follows you",
"FAQ": "FAQ",
@ -119,7 +119,7 @@
"showTerms": "Read our Terms of Use",
"ellipsisMore": "More",
"blockUser": "Block {username}",
"goToOriginalNotice": "Go to original notice",
"goToOriginalNotice": "Go to the original quip",
"goToTheUsersRemoteProfile": "Go to the user's remote profile",
"clickToDrag":"Click to drag",
"keyboardShortcuts":"Keyboard shortcuts",
@ -128,7 +128,7 @@
"tooltipBookmarkStream":"Add this stream to your bookmarks",
"tooltipTopMenu":"Menu and settings",
"tooltipAttachImage":"Attach an image",
"tooltipShortenUrls":"Shorten all URLs in the Queet",
"tooltipShortenUrls":"Shorten all URLs in the quip",
"tooltipReloadStream":"Refresh this stream",
"tooltipRemoveBookmark":"Remove this bookmark",
"clearHistory":"Clear browsing history",
@ -137,21 +137,21 @@
"ERRORcouldNotFindUserWithNickname":"Could not find a user with nickname \"{nickname}\" on this server",
"ERRORcouldNotFindGroupWithNickname":"Could not find a group with nickname \"{nickname}\" on this server",
"ERRORcouldNotFindPage":"Could not find that page.",
"ERRORnoticeRemoved": "This notice has been removed.",
"ERRORnoticeRemoved": "This quip has been removed.",
"ERRORnoContactWithServer": "Can not establish a connection to the server. The server could be overloaded, or there might be a problem with your internet connection. Please try again later!",
"ERRORattachmentUploadFailed": "The upload failed. The format might be unsupported or the size too large.",
"hideRepliesToPeopleIDoNotFollow":"Hide replies to people I don't follow",
"markAllNotificationsAsSeen":"Mark all notifications as seen",
"notifyRepliesAndMentions":"Mentions and replies",
"notifyFavs":"Favorites",
"notifyRepeats":"Requeets",
"notifyRepeats":"Requips",
"notifyFollows":"New followers",
"timelineOptions":"Timeline options",
"ERRORfailedSavingYourSetting":"Failed saving your setting",
"ERRORfailedMarkingAllNotificationsAsRead":"Failed marking all notifications as seen.",
"newNotification": "{new-notice-count} new notification",
"newNotifications": "{new-notice-count} new notifications",
"thisIsANoticeFromABlockedUser":"Warning: This is a notice from a user you have blocked. Click to show it.",
"thisIsANoticeFromABlockedUser":"Warning: This is a quip from a user you have blocked. Click to show it.",
"nicknamesListWithListName":"{nickname}s list: {list-name}",
"myListWithListName":"My list: {list-name}",
"listMembers":"Members",