Merge remote-tracking branch 'mike/master' into dev

This commit is contained in:
Mario Vavti 2018-04-13 11:59:09 +02:00
commit 88ca6fc12e
4 changed files with 65 additions and 50 deletions

View file

@ -117,6 +117,8 @@ class Enotify {
$always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices'); $always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices');
$vnotify = get_pconfig($recip['channel_id'],'system','vnotify'); $vnotify = get_pconfig($recip['channel_id'],'system','vnotify');
$salutation = $recip['channel_name'];
// e.g. "your post", "David's photo", etc. // e.g. "your post", "David's photo", etc.
$possess_desc = t('%s <!item_type!>'); $possess_desc = t('%s <!item_type!>');
@ -124,7 +126,7 @@ class Enotify {
logger('notification: mail'); logger('notification: mail');
$subject = sprintf( t('[$Projectname:Notify] New mail received at %s'),$sitename); $subject = sprintf( t('[$Projectname:Notify] New mail received at %s'),$sitename);
$preamble = sprintf( t('%1$s, %2$s sent you a new private message at %3$s.'),$recip['channel_name'], $sender['xchan_name'],$sitename); $preamble = sprintf( t('%1$s sent you a new private message at %2$s.'), $sender['xchan_name'],$sitename);
$epreamble = sprintf( t('%1$s sent you %2$s.'),'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=$itemlink]' . t('a private message') . '[/zrl]'); $epreamble = sprintf( t('%1$s sent you %2$s.'),'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=$itemlink]' . t('a private message') . '[/zrl]');
$sitelink = t('Please visit %s to view and/or reply to your private messages.'); $sitelink = t('Please visit %s to view and/or reply to your private messages.');
$tsitelink = sprintf( $sitelink, $siteurl . '/mail/' . $params['item']['id'] ); $tsitelink = sprintf( $sitelink, $siteurl . '/mail/' . $params['item']['id'] );
@ -196,8 +198,7 @@ class Enotify {
//$possess_desc = str_replace('<!item_type!>',$possess_desc); //$possess_desc = str_replace('<!item_type!>',$possess_desc);
// "a post" // "a post"
$dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]a %5$s[/zrl]'), $dest_str = sprintf(t('%1$s %2$s [zrl=%3$s]a %4$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$action, $action,
$itemlink, $itemlink,
@ -205,8 +206,7 @@ class Enotify {
// "George Bull's post" // "George Bull's post"
if($p) if($p)
$dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]%5$s\'s %6$s[/zrl]'), $dest_str = sprintf(t('%1$s %2$s [zrl=%3$s]%4$s\'s %5$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$action, $action,
$itemlink, $itemlink,
@ -215,8 +215,7 @@ class Enotify {
// "your post" // "your post"
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall'])) if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall']))
$dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]your %5$s[/zrl]'), $dest_str = sprintf(t('%1$s %2$s [zrl=%3$s]your %4$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$action, $action,
$itemlink, $itemlink,
@ -231,7 +230,7 @@ class Enotify {
$subject = sprintf( t('[$Projectname:Notify] Moderated Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']); $subject = sprintf( t('[$Projectname:Notify] Moderated Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
else else
$subject = sprintf( t('[$Projectname:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']); $subject = sprintf( t('[$Projectname:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
$preamble = sprintf( t('%1$s, %2$s commented on an item/conversation you have been following.'), $recip['channel_name'], $sender['xchan_name']); $preamble = sprintf( t('%1$s commented on an item/conversation you have been following.'), $sender['xchan_name']);
$epreamble = $dest_str; $epreamble = $dest_str;
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = t('Please visit %s to view and/or reply to the conversation.');
@ -297,8 +296,7 @@ class Enotify {
// "your post" // "your post"
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall'])) if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall']))
$dest_str = sprintf(t('%1$s, %2$s liked [zrl=%3$s]your %4$s[/zrl]'), $dest_str = sprintf(t('%1$s liked [zrl=%2$s]your %3$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$itemlink, $itemlink,
$item_post_type); $item_post_type);
@ -313,7 +311,7 @@ class Enotify {
// differents subjects for messages on the same thread. // differents subjects for messages on the same thread.
$subject = sprintf( t('[$Projectname:Notify] Like received to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']); $subject = sprintf( t('[$Projectname:Notify] Like received to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
$preamble = sprintf( t('%1$s, %2$s liked an item/conversation you created.'), $recip['channel_name'], $sender['xchan_name']); $preamble = sprintf( t('%1$s liked an item/conversation you created.'), $sender['xchan_name']);
$epreamble = $dest_str; $epreamble = $dest_str;
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = t('Please visit %s to view and/or reply to the conversation.');
@ -326,10 +324,9 @@ class Enotify {
if($params['type'] == NOTIFY_WALL) { if($params['type'] == NOTIFY_WALL) {
$subject = sprintf( t('[$Projectname:Notify] %s posted to your profile wall') , $sender['xchan_name']); $subject = sprintf( t('[$Projectname:Notify] %s posted to your profile wall') , $sender['xchan_name']);
$preamble = sprintf( t('%1$s, %2$s posted to your profile wall at %3$s') , $recip['channel_name'], $sender['xchan_name'], $sitename); $preamble = sprintf( t('%1$s posted to your profile wall at %2$s') , $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s, %2$s posted to [zrl=%3$s]your wall[/zrl]') , $epreamble = sprintf( t('%1$s posted to [zrl=%2$s]your wall[/zrl]') ,
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$params['link']); $params['link']);
@ -353,9 +350,8 @@ class Enotify {
} }
$subject = sprintf( t('[$Projectname:Notify] %s tagged you') , $sender['xchan_name']); $subject = sprintf( t('[$Projectname:Notify] %s tagged you') , $sender['xchan_name']);
$preamble = sprintf( t('%1$s, %2$s tagged you at %3$s') , $recip['channel_name'], $sender['xchan_name'], $sitename); $preamble = sprintf( t('%1$s tagged you at %2$s') , $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s, %2$s [zrl=%3$s]tagged you[/zrl].') , $epreamble = sprintf( t('%1$s [zrl=%2$s]tagged you[/zrl].') ,
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$params['link']); $params['link']);
@ -367,9 +363,8 @@ class Enotify {
if ($params['type'] == NOTIFY_POKE) { if ($params['type'] == NOTIFY_POKE) {
$subject = sprintf( t('[$Projectname:Notify] %1$s poked you') , $sender['xchan_name']); $subject = sprintf( t('[$Projectname:Notify] %1$s poked you') , $sender['xchan_name']);
$preamble = sprintf( t('%1$s, %2$s poked you at %3$s') , $recip['channel_name'], $sender['xchan_name'], $sitename); $preamble = sprintf( t('%1$s poked you at %2$s') , $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s, %2$s [zrl=%2$s]poked you[/zrl].') , $epreamble = sprintf( t('%1$s [zrl=%2$s]poked you[/zrl].') ,
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$params['link']); $params['link']);
@ -385,9 +380,8 @@ class Enotify {
if ($params['type'] == NOTIFY_TAGSHARE) { if ($params['type'] == NOTIFY_TAGSHARE) {
$subject = sprintf( t('[$Projectname:Notify] %s tagged your post') , $sender['xchan_name']); $subject = sprintf( t('[$Projectname:Notify] %s tagged your post') , $sender['xchan_name']);
$preamble = sprintf( t('%1$s, %2$s tagged your post at %3$s') , $recip['channel_name'],$sender['xchan_name'], $sitename); $preamble = sprintf( t('%1$s tagged your post at %2$s'),$sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s, %2$s tagged [zrl=%3$s]your post[/zrl]') , $epreamble = sprintf( t('%1$s tagged [zrl=%2$s]your post[/zrl]') ,
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$itemlink); $itemlink);
@ -399,9 +393,8 @@ class Enotify {
if ($params['type'] == NOTIFY_INTRO) { if ($params['type'] == NOTIFY_INTRO) {
$subject = sprintf( t('[$Projectname:Notify] Introduction received')); $subject = sprintf( t('[$Projectname:Notify] Introduction received'));
$preamble = sprintf( t('%1$s, you\'ve received an new connection request from \'%2$s\' at %3$s'), $recip['channel_name'], $sender['xchan_name'], $sitename); $preamble = sprintf( t('You\'ve received an new connection request from \'%1$s\' at %2$s'), $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s, you\'ve received [zrl=%2$s]a new connection request[/zrl] from %3$s.'), $epreamble = sprintf( t('You\'ve received [zrl=%1$s]a new connection request[/zrl] from %2$s.'),
$recip['channel_name'],
$siteurl . '/connections/ifpending', $siteurl . '/connections/ifpending',
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]'); '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]');
$body = sprintf( t('You may visit their profile at %s'),$sender['xchan_url']); $body = sprintf( t('You may visit their profile at %s'),$sender['xchan_url']);
@ -414,9 +407,8 @@ class Enotify {
if ($params['type'] == NOTIFY_SUGGEST) { if ($params['type'] == NOTIFY_SUGGEST) {
$subject = sprintf( t('[$Projectname:Notify] Friend suggestion received')); $subject = sprintf( t('[$Projectname:Notify] Friend suggestion received'));
$preamble = sprintf( t('%1$s, you\'ve received a friend suggestion from \'%2$s\' at %3$s'), $recip['channel_name'], $sender['xchan_name'], $sitename); $preamble = sprintf( t('You\'ve received a friend suggestion from \'%1$s\' at %2$s'), $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s, you\'ve received [zrl=%2$s]a friend suggestion[/zrl] for %3$s from %4$s.'), $epreamble = sprintf( t('You\'ve received [zrl=%1$s]a friend suggestion[/zrl] for %2$s from %3$s.'),
$recip['channel_name'],
$itemlink, $itemlink,
'[zrl=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/zrl]', '[zrl=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/zrl]',
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]'); '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]');
@ -665,7 +657,7 @@ class Enotify {
'$banner' => $datarray['banner'], '$banner' => $datarray['banner'],
'$notify_icon' => \Zotlabs\Lib\System::get_notify_icon(), '$notify_icon' => \Zotlabs\Lib\System::get_notify_icon(),
'$product' => $datarray['product'], '$product' => $datarray['product'],
'$preamble' => $datarray['preamble'], '$preamble' => $salutation . '<br><br>' . $datarray['preamble'],
'$sitename' => $datarray['sitename'], '$sitename' => $datarray['sitename'],
'$siteurl' => $datarray['siteurl'], '$siteurl' => $datarray['siteurl'],
'$source_name' => $datarray['source_name'], '$source_name' => $datarray['source_name'],
@ -687,7 +679,7 @@ class Enotify {
$email_text_body = replace_macros($tpl, array( $email_text_body = replace_macros($tpl, array(
'$banner' => $datarray['banner'], '$banner' => $datarray['banner'],
'$product' => $datarray['product'], '$product' => $datarray['product'],
'$preamble' => $datarray['preamble'], '$preamble' => $salutation . "\n\n" . $datarray['preamble'],
'$sitename' => $datarray['sitename'], '$sitename' => $datarray['sitename'],
'$siteurl' => $datarray['siteurl'], '$siteurl' => $datarray['siteurl'],
'$source_name' => $datarray['source_name'], '$source_name' => $datarray['source_name'],

View file

@ -44,9 +44,9 @@ class WebServer {
* We have to do it here because the session was just now opened. * We have to do it here because the session was just now opened.
*/ */
if(array_key_exists('system_language',$_POST)) { if(array_key_exists('system_language',$_REQUEST)) {
if(strlen($_POST['system_language'])) if(strlen($_REQUEST['system_language']))
$_SESSION['language'] = $_POST['system_language']; $_SESSION['language'] = $_REQUEST['system_language'];
else else
unset($_SESSION['language']); unset($_SESSION['language']);
} }

View file

@ -364,12 +364,14 @@ Note: In previous releases, forums were delivered by using @forum+ with a plus s
[h4]Private Mentions[/h4] [h4]Private Mentions[/h4]
If you wish to restrict a post to a single person or a number of people, you can do this by selecting channels or privacy groups from the privacy tool. You can also just tag them with a privacy tag. A privacy tag is a name preceded by the two characters @! - and in addition to tagging these channels, will also change the privacy permissions of the post to only include them. You can have more than one privacy tag, for instance @!bob and @!linda will send the post only to Bob and Linda. This mechanism over-rides the privacy selector. If you wish to restrict a post to a single person or a number of people, you can do this by selecting channels or privacy groups from the privacy tool. You can also just tag them with a privacy tag. A privacy tag is a name preceded by the two characters @! - and in addition to tagging these channels, will also change the privacy permissions of the post to only include them. You can have more than one privacy tag, for instance @!bob and @!linda will send the post only to Bob and Linda. This mechanism over-rides the privacy selector.
Forums may be mentioned in the same way. !!dogs will post to the dogs forum privately. The forum will redeliver the post to all the forum members, but your own followers will not see the post unless they are also members of the dogs forum.
You may also tag privacy groups which are "public". When you create or edit a privacy group, there is a checkbox to allow the group members to be seen by others. If this box is checked for a group and you tag (for instance) @!Friends - the post will be restricted to the Friends group. Check that the group is public before doing this - as there is no way to take back a post except to delete it. The group name will appear in the post and will alert members of that group that they are members of it. You may also tag privacy groups which are "public". When you create or edit a privacy group, there is a checkbox to allow the group members to be seen by others. If this box is checked for a group and you tag (for instance) @!Friends - the post will be restricted to the Friends group. Check that the group is public before doing this - as there is no way to take back a post except to delete it. The group name will appear in the post and will alert members of that group that they are members of it.
[h4]Mentions and Comments[/h4] [h4]Mentions and Comments[/h4]
The above mechanisms only apply to "top-level" posts you create. Mentioning a channel with any of the above mechanisms has no effect in comments, except that the mentioned channel may receive a notification if they were already included as a recipient in the conversation. The above mechanisms only apply to "top-level" posts you create. Mentioning a channel with any of the above mechanisms has no effect in comments, except that the mentioned channel may receive a notification if they were already included as a recipient in the conversation.
[h4]Topical Tags[/h4] [h4]Topical Tags (also known as Hashtags)[/h4]
Topical tags are indicated by preceding the tag name with the # character. This will create a link in the post to a generalised site search for the term provided. For example, #[zrl=[baseurl]/search?tag=cars]cars[/zrl] will provide a search link for all posts mentioning 'cars' on your site. Topical tags are generally a minimum of three characters in length. Shorter search terms are not likely to yield any search results, although this depends on the database configuration. Topical tags are indicated by preceding the tag name with the # character. This will create a link in the post to a generalised site search for the term provided. For example, #[zrl=[baseurl]/search?tag=cars]cars[/zrl] will provide a search link for all posts mentioning 'cars' on your site. Topical tags are generally a minimum of three characters in length. Shorter search terms are not likely to yield any search results, although this depends on the database configuration.
Topical tags are also not linked if they are purely numeric, e.g. #1. If you wish to use a numeric hashtag, please add some descriptive text such as #2012-elections. Topical tags are also not linked if they are purely numeric, e.g. #1. If you wish to use a numeric hashtag, please add some descriptive text such as #2012-elections.

View file

@ -168,15 +168,6 @@ function handle_comment_form(e) {
$('#' + commentElm).attr('tabindex','9'); $('#' + commentElm).attr('tabindex','9');
$('#' + submitElm).attr('tabindex','10'); $('#' + submitElm).attr('tabindex','10');
if(auto_save_draft) {
var commentBody = localStorage.getItem("comment_body");
if(commentBody && $('#' + commentElm).val() === '') {
$('#' + commentElm).val(commentBody);
}
} else {
localStorage.removeItem("comment_body");
}
form.find(':not(:visible)').show(); form.find(':not(:visible)').show();
} }
@ -199,24 +190,31 @@ function handle_comment_form(e) {
var commentSaveTimer = null; var commentSaveTimer = null;
var emptyCommentElm = form.find('.comment-edit-text').attr('id'); var emptyCommentElm = form.find('.comment-edit-text').attr('id');
var convId = emptyCommentElm.replace('comment-edit-text-','');
$(document).on('focusout','#' + emptyCommentElm,function(e){ $(document).on('focusout','#' + emptyCommentElm,function(e){
if(commentSaveTimer) if(commentSaveTimer)
clearTimeout(commentSaveTimer); clearTimeout(commentSaveTimer);
commentSaveChanges(true); commentSaveChanges(convId,true);
commentSaveTimer = null; commentSaveTimer = null;
}); });
$(document).on('focusin','#' + emptyCommentElm,function(e){ $(document).on('focusin','#' + emptyCommentElm,function(e){
commentSaveTimer = setTimeout(function () { commentSaveTimer = setTimeout(function () {
commentSaveChanges(false); commentSaveChanges(convId,false);
},10000); },10000);
}); });
function commentSaveChanges(isFinal = false) { function commentSaveChanges(convId,isFinal = false) {
if(auto_save_draft) { if(auto_save_draft) {
localStorage.setItem("comment_body", $('#' + emptyCommentElm).val()); tmp = $('#' + emptyCommentElm).val();
if(tmp) {
localStorage.setItem("comment_body-" + convId, tmp);
}
else {
localStorage.removeItem("comment_body-" + convId);
}
if( !isFinal) { if( !isFinal) {
commentSaveTimer = setTimeout(commentSaveChanges,10000); commentSaveTimer = setTimeout(commentSaveChanges,10000,convId);
} }
} }
} }
@ -600,8 +598,10 @@ function updateConvItems(mode,data) {
$('.thread-wrapper.toplevel_item',data).each(function() { $('.thread-wrapper.toplevel_item',data).each(function() {
var ident = $(this).attr('id'); var ident = $(this).attr('id');
var convId = ident.replace('thread-wrapper-','');
var commentWrap = $('#'+ident+' .collapsed-comments').attr('id'); var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
var itmId = 0; var itmId = 0;
var isVisible = false; var isVisible = false;
@ -612,6 +612,9 @@ function updateConvItems(mode,data) {
if($('#collapsed-comments-'+itmId).is(':visible')) if($('#collapsed-comments-'+itmId).is(':visible'))
isVisible = true; isVisible = true;
// insert the content according to the mode and first_page // insert the content according to the mode and first_page
// and whether or not the content exists already (overwrite it) // and whether or not the content exists already (overwrite it)
@ -633,6 +636,24 @@ function updateConvItems(mode,data) {
if(isVisible) if(isVisible)
showHideComments(itmId); showHideComments(itmId);
var commentBody = localStorage.getItem("comment_body-" + convId);
if(commentBody) {
var commentElm = $('#comment-edit-text-' + convId);
if(auto_save_draft) {
if($(commentElm).val() === '') {
$('#comment-edit-form-' + convId).show();
$(commentElm).addClass("expanded");
openMenu("comment-tools-" + convId);
$(commentElm).val(commentBody);
}
} else {
localStorage.removeItem("comment_body-" + convId);
}
}
// trigger the autotime function on all newly created content // trigger the autotime function on all newly created content
$("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();