Commit 789e00c8 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Reduce whitespace in messages in inbox blocktypes (bug #630371)


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 1a4e8b09
......@@ -88,7 +88,7 @@ class PluginBlocktypeInbox extends SystemBlocktype {
if ($records) {
require_once('activity.php');
foreach ($records as &$r) {
$r->message = format_notification_whitespace($r->message);
$r->message = format_notification_whitespace($r->message, $r->type);
}
}
......
......@@ -12,7 +12,7 @@
<td>
{if $i->message}
<a href="{if $i->url}{$i->url}{else}{$WWWROOT}account/activity{/if}" class="inbox-showmessage{if !$i->read} unread{/if}">{$i->subject}</a>
<div class="inbox-message messagebody hidden" id="inbox-message-{$i->id}">{$i->message|safe}
<div class="inbox-message hidden messagebody messagebody-{$i->type}" id="inbox-message-{$i->id}">{$i->message|safe}
{if $i->url}<br><a href="{$i->url}">{if $i->urltext}{$i->urltext} &raquo;{else}{str tag="more..."}{/if}</a>{/if}
</div>
{elseif $i->url}
......
......@@ -962,10 +962,15 @@ abstract class ActivityTypePlugin extends ActivityType {
}
function format_notification_whitespace($message) {
function format_notification_whitespace($message, $type=null) {
$message = preg_replace('/^(\s|<br( ?\/)?>|&nbsp;|\xc2\xa0)*/', '', $message);
$message = format_whitespace($message);
return preg_replace('/(<br( ?\/)?>\s*){2,}/', '<br><br>', $message);
// @todo: Sensibly distinguish html notifications, notifications where the full text
// appears on another page and this is just an abbreviated preview, and text-only
// notifications where the entire text must appear here because there's nowhere else
// to see it.
$replace = ($type == 'newpost' || $type == 'feedback') ? '<br>' : '<br><br>';
return preg_replace('/(<br( ?\/)?>\s*){2,}/', $replace, $message);
}
/**
......
......@@ -214,6 +214,9 @@ table.fixwidth {
white-space: pre-wrap;
overflow: auto;
}
.messagebody-newpost, .messagebody-feedback {
white-space: normal;
}
/* table without border */
#bloglist th {
border: 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment