MDL-65034 mod_forum: fix author for single discussion forum
This commit is contained in:
@@ -193,6 +193,7 @@ class renderer {
|
||||
if ($forum->get_type() == 'single' && !$exportedpost->hasparent) {
|
||||
// Remove the author from any posts that don't have a parent.
|
||||
unset($exportedpost->author);
|
||||
unset($exportedpost->html['authorsubheading']);
|
||||
}
|
||||
|
||||
$exportedpost->firstpost = false;
|
||||
@@ -221,7 +222,13 @@ class renderer {
|
||||
// Set the parent author name on the replies. This is used for screen
|
||||
// readers to help them identify the structure of the discussion.
|
||||
$sortedreplies = array_map(function($reply) use ($post) {
|
||||
$reply->parentauthorname = $post->author->fullname;
|
||||
if (isset($post->author)) {
|
||||
$reply->parentauthorname = $post->author->fullname;
|
||||
} else {
|
||||
// The only time the author won't be set is for a single discussion
|
||||
// forum. See above for where it gets unset.
|
||||
$reply->parentauthorname = get_string('firstpost', 'mod_forum');
|
||||
}
|
||||
return $reply;
|
||||
}, $sortedreplies);
|
||||
$post->replies = $sortedreplies;
|
||||
|
||||
@@ -229,6 +229,7 @@ $string['everyoneissubscribed'] = 'Everyone is subscribed to this forum';
|
||||
$string['existingsubscribers'] = 'Existing subscribers';
|
||||
$string['exportdiscussion'] = 'Export whole discussion to portfolio';
|
||||
$string['exportattachmentname'] = 'Export attachment {$a} to portfolio';
|
||||
$string['firstpost'] = 'First post';
|
||||
$string['forcedreadtracking'] = 'Allow forced read tracking';
|
||||
$string['forcedreadtracking_desc'] = 'Allows forums to be set to forced read tracking. Will result in decreased performance for some users, particularly on courses with many forums and posts. When off, any forums previously set to Forced are treated as optional.';
|
||||
$string['forcesubscribed_help'] = 'This forum has been configured so that you cannot unsubscribe from discussions.';
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
aria-label='{{#str}} postbyuser, mod_forum, {"post": "{{subject}}", "user": "{{author.fullname}}"} {{/str}}'
|
||||
>
|
||||
{{#isfirstunread}}<a id="unread" aria-hidden="true"></a>{{/isfirstunread}}
|
||||
<div style="width: 45px;">
|
||||
{{^isdeleted}}
|
||||
{{#author}}
|
||||
{{^isdeleted}}
|
||||
{{#author}}
|
||||
<div style="width: 45px;">
|
||||
{{#urls.profileimage}}
|
||||
<img
|
||||
class="rounded-circle w-100"
|
||||
@@ -57,15 +57,17 @@
|
||||
>
|
||||
{{/urls.profileimage}}
|
||||
{{#groups}}
|
||||
<img
|
||||
class="rounded-circle w-100"
|
||||
src="{{{urls.image}}}"
|
||||
alt="{{#str}} pictureof, core, {{name}} {{/str}}"
|
||||
>
|
||||
{{#urls.image}}
|
||||
<img
|
||||
class="rounded-circle w-100"
|
||||
src="{{{.}}}"
|
||||
alt="{{#str}} pictureof, core, {{name}} {{/str}}"
|
||||
>
|
||||
{{/urls.image}}
|
||||
{{/groups}}
|
||||
{{/author}}
|
||||
{{/isdeleted}}
|
||||
</div>
|
||||
</div>
|
||||
{{/author}}
|
||||
{{/isdeleted}}
|
||||
|
||||
<div class="d-flex flex-column ml-2 w-100">
|
||||
<header id="post-header-{{id}}" class="mb-2 header row">
|
||||
@@ -75,7 +77,12 @@
|
||||
<h3 class="h6 font-weight-bold mb-0">{{$subject}}{{{subject}}}{{/subject}}</h3>
|
||||
{{^isdeleted}}
|
||||
<address tabindex="-1">
|
||||
{{{html.authorsubheading}}}
|
||||
{{#html.authorsubheading}}{{{.}}}{{/html.authorsubheading}}
|
||||
{{^html.authorsubheading}}
|
||||
<time>
|
||||
{{#userdate}} {{timecreated}}, {{#str}} strftimedaydatetime, core_langconfig {{/str}} {{/userdate}}
|
||||
</time>
|
||||
{{/html.authorsubheading}}
|
||||
</address>
|
||||
{{/isdeleted}}
|
||||
{{#isprivatereply}}
|
||||
@@ -159,6 +166,7 @@
|
||||
href="{{{urls.view}}}"
|
||||
class="btn btn-link"
|
||||
title="{{#str}} permanentlinktopost, mod_forum {{/str}}"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} permalink, mod_forum {{/str}}
|
||||
</a>
|
||||
@@ -169,6 +177,7 @@
|
||||
data-region="post-action"
|
||||
href="{{{urls.markasread}}}"
|
||||
class="btn btn-link"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} markread, mod_forum {{/str}}
|
||||
</a>
|
||||
@@ -178,6 +187,7 @@
|
||||
data-region="post-action"
|
||||
href="{{{urls.markasunread}}}"
|
||||
class="btn btn-link"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} markunread, mod_forum {{/str}}
|
||||
</a>
|
||||
@@ -189,6 +199,7 @@
|
||||
href="{{{.}}}"
|
||||
class="btn btn-link"
|
||||
title="{{#str}} permanentlinktoparentpost, mod_forum {{/str}}"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} parent, mod_forum {{/str}}
|
||||
</a>
|
||||
@@ -198,6 +209,7 @@
|
||||
data-region="post-action"
|
||||
href="{{{urls.edit}}}"
|
||||
class="btn btn-link"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} edit, mod_forum {{/str}}
|
||||
</a>
|
||||
@@ -207,6 +219,7 @@
|
||||
data-region="post-action"
|
||||
href="{{{urls.split}}}"
|
||||
class="btn btn-link"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} prune, mod_forum {{/str}}
|
||||
</a>
|
||||
@@ -216,6 +229,7 @@
|
||||
data-region="post-action"
|
||||
href="{{{urls.delete}}}"
|
||||
class="btn btn-link"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} delete, mod_forum {{/str}}
|
||||
</a>
|
||||
@@ -226,6 +240,7 @@
|
||||
data-region="post-action"
|
||||
href="{{{urls.reply}}}"
|
||||
class="btn btn-link"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} reply, mod_forum {{/str}}
|
||||
</a>
|
||||
@@ -236,6 +251,7 @@
|
||||
data-region="post-action"
|
||||
href="{{{urls.export}}}"
|
||||
class="btn btn-link"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} addtoportfolio, core_portfolio {{/str}}
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user