Skip to content
Snippets Groups Projects
Commit f112b9ed authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

Resolve "Wiki Änderungen seit letztem Besuch zeigt zu viel Text an"

Closes #3972

Merge request studip/studip!2823
parent 1fe008a1
No related branches found
No related tags found
No related merge requests found
......@@ -55,36 +55,39 @@
<td>
<?
$authors = [$page->user_id => $page->user];
$versions = [$page];
$oldcontent = "";
$oldversion = $page;
while ($oldversion = $oldversion->predecessor) {
if ($oldversion->mkdate >= $last_visit && $oldversion->user_id !== User::findCurrent()->id) {
$oldcontent = $oldversion->content;
if (!isset($authors[$oldversion->user_id])) {
$versions[] = $oldversion;
$authors[$oldversion->user_id] = $oldversion->user;
}
} else {
break;
}
}
$oldcontent = $oldversion->content;
$oldcontent = strip_tags(wikiReady($oldcontent));
$content = strip_tags(wikiReady($page->content));
$commonFromStart = $controller->findLongestCommonSubstring($content, $oldcontent);
$commonFromEnd = $controller->findLongestCommonSubstring($content, $oldcontent, true);
$content = mb_substr($content, $commonFromStart, $commonFromEnd);
$oldcontent = mb_substr($oldcontent, $commonFromStart, $commonFromEnd);
$oldcontent = mb_substr($oldcontent, $commonFromStart, mb_strlen($oldcontent) - mb_strlen($content));
$content = mb_substr($content, $commonFromStart, $commonFromEnd - $commonFromStart);
if ($content) {
echo htmlReady(mila($content, 300), true, true);
} elseif ($oldcontent) {
echo _('Gelöscht') . ': ' . htmlReady($oldcontent, true, true);
echo _('Gelöscht') . ': ' . htmlReady(mila($oldcontent, 300), true, true);
}
?>
</td>
<td>
<ul class="wiki_authors">
<? foreach ($authors as $user) : ?>
<? foreach ($authors as $user_id => $user) : ?>
<li>
<? if ($user): ?>
<a href="<?= URLHelper::getLink('dispatch.php/profile', ['username' => $user->username]) ?>"
......@@ -95,6 +98,15 @@
<? else: ?>
<?= _('unbekannt') ?>
<? endif; ?>
<? foreach ($versions as $version) : ?>
<? if ($version->user_id === $user_id) : ?>
<a href="<?= $controller->versiondiff($page, is_a($version, 'WikiVersion') ? $version->id : null) ?>"
title="<?= _('Einzelne Änderung anzeigen') ?>"
data-dialog>
<?= Icon::create('log')->asImg(['class' => 'text-bottom']) ?>
</a>
<? endif ?>
<? endforeach ?>
</li>
<? endforeach ?>
</ul>
......
......@@ -190,12 +190,12 @@ article.studip.wiki {
padding: 0;
li {
margin-bottom: 5px;
display: flex;
}
a {
background-position: left top;
background-repeat: no-repeat;
background-size: var(--avatar-small);
display: block;
min-height: var(--avatar-small);
padding-left: calc(var(--avatar-small) + 1ex);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment