diff --git a/mod/forum/amd/build/posts_list.min.js b/mod/forum/amd/build/posts_list.min.js index df43413cab2..b888a7fb6b2 100644 --- a/mod/forum/amd/build/posts_list.min.js +++ b/mod/forum/amd/build/posts_list.min.js @@ -1 +1 @@ -define(["jquery","core/templates","core/notification","mod_forum/selectors","mod_forum/inpage_reply"],function(a,b,c,d,e){var f=function(f){f.on("click",d.post.inpageReplyLink,function(f){if(f.preventDefault(),window.location.hash){var g=window.location.href.split("#")[0];history.pushState({},document.title,g)}var h=a(f.currentTarget).parents(d.post.forumCoreContent),i=h.find(d.post.forumSubject),j=a(f.currentTarget).parents(d.post.forumContent),k={postid:a(j).data("post-id"),reply_url:a(f.currentTarget).attr("href"),sesskey:M.cfg.sesskey,parentsubject:i.html(),canreplyprivately:a(f.currentTarget).data("can-reply-privately"),postformat:e.CONTENT_FORMATS.MOODLE};if(j.find(d.post.inpageReplyContent).length){var l=j.find(d.post.inpageReplyContent);l.slideToggle(300),l.is(":visible")&&l.find("textarea").focus()}else b.render("mod_forum/inpage_reply",k).then(function(a,c){return b.appendNodeContents(h,a,c)}).then(function(){return j.find(d.post.inpageReplyContent).slideToggle(300).find("textarea").focus()}).fail(c.exception)})};return{init:function(a){f(a),e.init(a)}}}); \ No newline at end of file +define(["jquery","core/templates","core/notification","mod_forum/selectors","mod_forum/inpage_reply"],function(a,b,c,d,e){var f=function(f){f.on("click",d.post.inpageReplyLink,function(f){if(f.preventDefault(),window.location.hash){var g=window.location.href.split("#")[0];history.pushState({},document.title,g)}var h=a(f.currentTarget).parents(d.post.forumCoreContent),i=h.find(d.post.forumSubject),j=a(f.currentTarget).parents(d.post.forumContent),k={postid:a(j).data("post-id"),reply_url:a(f.currentTarget).attr("href"),sesskey:M.cfg.sesskey,parentsubject:i.data("replySubject"),canreplyprivately:a(f.currentTarget).data("can-reply-privately"),postformat:e.CONTENT_FORMATS.MOODLE};if(j.find(d.post.inpageReplyContent).length){var l=j.find(d.post.inpageReplyContent);l.slideToggle(300),l.is(":visible")&&l.find("textarea").focus()}else b.render("mod_forum/inpage_reply",k).then(function(a,c){return b.appendNodeContents(h,a,c)}).then(function(){return j.find(d.post.inpageReplyContent).slideToggle(300).find("textarea").focus()}).fail(c.exception)})};return{init:function(a){f(a),e.init(a)}}}); \ No newline at end of file diff --git a/mod/forum/amd/src/posts_list.js b/mod/forum/amd/src/posts_list.js index 5e24d7a5baf..3fbc5933c73 100644 --- a/mod/forum/amd/src/posts_list.js +++ b/mod/forum/amd/src/posts_list.js @@ -59,7 +59,7 @@ define([ postid: $(currentRoot).data('post-id'), "reply_url": $(e.currentTarget).attr('href'), sesskey: M.cfg.sesskey, - parentsubject: currentSubject.html(), + parentsubject: currentSubject.data('replySubject'), canreplyprivately: $(e.currentTarget).data('can-reply-privately'), postformat: InPageReply.CONTENT_FORMATS.MOODLE }; diff --git a/mod/forum/classes/local/exporters/post.php b/mod/forum/classes/local/exporters/post.php index 4528c602d8e..a5bff7d43c3 100644 --- a/mod/forum/classes/local/exporters/post.php +++ b/mod/forum/classes/local/exporters/post.php @@ -92,6 +92,7 @@ class post extends exporter { return [ 'id' => ['type' => PARAM_INT], 'subject' => ['type' => PARAM_TEXT], + 'replysubject' => ['type' => PARAM_TEXT], 'message' => ['type' => PARAM_RAW], 'messageformat' => ['type' => PARAM_INT], 'author' => ['type' => author_exporter::read_properties_definition()], @@ -401,9 +402,16 @@ class post extends exporter { } } + $replysubject = $subject; + $strre = get_string('re', 'forum'); + if (!(substr($replysubject, 0, strlen($strre)) == $strre)) { + $replysubject = "{$strre} {$replysubject}"; + } + return [ 'id' => $post->get_id(), 'subject' => $subject, + 'replysubject' => $replysubject, 'message' => $message, 'messageformat' => $post->get_message_format(), 'author' => $exportedauthor, diff --git a/mod/forum/lang/en/deprecated.txt b/mod/forum/lang/en/deprecated.txt new file mode 100644 index 00000000000..dd59859d3d3 --- /dev/null +++ b/mod/forum/lang/en/deprecated.txt @@ -0,0 +1 @@ +inpagereplysubject,mod_forum diff --git a/mod/forum/lang/en/forum.php b/mod/forum/lang/en/forum.php index 12b78249fd5..89a544f64b6 100644 --- a/mod/forum/lang/en/forum.php +++ b/mod/forum/lang/en/forum.php @@ -323,7 +323,6 @@ $string['invalidforcesubscribe'] = 'Invalid force subscription mode'; $string['invalidforumid'] = 'Forum ID was incorrect'; $string['invalidparentpostid'] = 'Parent post ID was incorrect'; $string['invalidpostid'] = 'Invalid post ID - {$a}'; -$string['inpagereplysubject'] = 'Re: {$a}'; $string['lastpost'] = 'Last post'; $string['learningforums'] = 'Learning forums'; $string['lockdiscussionafter'] = 'Lock discussions after period of inactivity'; @@ -673,3 +672,6 @@ $string['yournewtopic'] = 'Your new discussion topic'; $string['yourreply'] = 'Your reply'; $string['forumsubjectdeleted'] = 'This forum post has been removed'; $string['forumbodydeleted'] = 'The content of this forum post has been removed and can no longer be accessed.'; + +// Deprecated since Moodle 3.8. +$string['inpagereplysubject'] = 'Re: {$a}'; diff --git a/mod/forum/templates/forum_discussion_post.mustache b/mod/forum/templates/forum_discussion_post.mustache index bf8c39f6ae1..7b9279255a6 100644 --- a/mod/forum/templates/forum_discussion_post.mustache +++ b/mod/forum/templates/forum_discussion_post.mustache @@ -68,7 +68,11 @@ {{#parentauthorname}} {{#str}} inreplyto, mod_forum, {{.}} {{/str}} {{/parentauthorname}} -