From f112b9ed5d1b5e81e0a88992b980fbe8849829bd Mon Sep 17 00:00:00 2001 From: Rasmus Fuhse <fuhse@data-quest.de> Date: Mon, 8 Apr 2024 09:45:37 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20"Wiki=20=C3=84nderungen=20seit=20letz?= =?UTF-8?q?tem=20Besuch=20zeigt=20zu=20viel=20Text=20an"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3972 Merge request studip/studip!2823 --- app/views/course/wiki/newpages.php | 20 ++++++++++++++++---- resources/assets/stylesheets/scss/wiki.scss | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/views/course/wiki/newpages.php b/app/views/course/wiki/newpages.php index d9e0dceea89..d165819feec 100644 --- a/app/views/course/wiki/newpages.php +++ b/app/views/course/wiki/newpages.php @@ -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> diff --git a/resources/assets/stylesheets/scss/wiki.scss b/resources/assets/stylesheets/scss/wiki.scss index e19b9b1aa1c..323fbb5e8a4 100644 --- a/resources/assets/stylesheets/scss/wiki.scss +++ b/resources/assets/stylesheets/scss/wiki.scss @@ -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); } -- GitLab