Forums/Discussions: Can't move forum conversation from duplicate forum to original forum topic
Description
Attachments
- 17 Sep 2021, 03:57 PM
Activity
Steve Waldeck October 30, 2021 at 4:13 AM
Verified on 22x https://qa22-mysql.nightly.sakaiproject.org/
Server: ip-172-31-7-189 Build Info: 20f364a7
Win10 (Chrome/Edge/Firefox), macOS Big Sur (Safari 15.0)
Austin September 20, 2021 at 2:38 PM
Shawn Foster September 20, 2021 at 1:39 PM
@Austin, if you submit a Pull Request, the devs can discuss your method of fixing this in the PR.
Austin September 17, 2021 at 3:51 PMEdited
here's a potential patch
diff --git a/msgcntr/messageforums-app/src/webapp/js/forum_movethread.js b/msgcntr/messageforums-app/src/webapp/js/forum_movethread.js
index 8a4a8e5e65..6b0121f283 100644
--- a/msgcntr/messageforums-app/src/webapp/js/forum_movethread.js
+++ b/msgcntr/messageforums-app/src/webapp/js/forum_movethread.js
@@ -167,15 +167,15 @@ Licenses.
var topics= getJSONData("topics").topics;
var totalTopics= topics.length;
for (var j = 0; j < totalTopics; j++) {
- var sourcetitle = $(".sourcetitle").text();
- var currtopic = topics[j].topictitle ;
- if ( sourcetitle == currtopic) {
- // if current topic, greyed out disable radio selection
- itemHTML += makeSourceListItemDisabled(topics[j]);
- }
- else {
- itemHTML += makeSourceListItem(topics[j]);
- }
+ var sourcetopicid = $("#sourcetopicid").attr("data-id");^M
+ var currtopicid = topics[j].topicid;^M
+ if (sourcetopicid == currtopicid) {^M
+ // if current topic, greyed out disable radio selection^M
+ itemHTML += makeSourceListItemDisabled(topics[j]);^M
+ }^M
+ else {^M
+ itemHTML += makeSourceListItem(topics[j]);^M
+ }^M
}
$(sourceList).html(itemHTML);
/*
diff --git a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/moveThreadPicker.jsp b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/moveThreadPicker.jsp
index afc93dc37e..aca5a5576e 100644
--- a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/moveThreadPicker.jsp
+++ b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/moveThreadPicker.jsp
@@ -2,8 +2,9 @@
<div class="selected-threads-to-move">
<div>
<h:outputText value="#{msgs.move_thread_info1}" />
- <h:outputText styleClass="sourcetitle" escape="true" value="#{ForumTool.selectedTopic.topic.title}" />
- <h:outputText value="#{msgs.move_thread_info2}" />
+ <h:outputText styleClass="sourcetitle" escape="true" value=" #{ForumTool.selectedTopic.topic.title} " />^M
+ <h:outputText value="#{msgs.move_thread_info2}" />^M
+ <span id="sourcetopicid" data-id='<h:outputText value="#{ForumTool.selectedTopic.topic.id}" />' hidden></span>^M
</div>
<div class="threads-to-move" escape="true"></div>
<input class="checkbox-reminder" id="checkbox-reminder" type="checkbox" name="checkbox-reminder" /> <h:outputText value="#{msgs.leave_reminder}" />
but i'm not sure if that's the best way to fix it. I'm adding a "hidden" span using a "data-*" attribute to the jsp, which the JS can retrieve later.
the topicid could be scraped from the page in other places but the most likely place that I found (element with id msgForum:topic_setting), but that code changed between 19 and 20, so I don't know if it'll change again. Plus it would involve a somewhat janky foreach() function to parse the value of that element's onclick attrib to get the topic id. I thought it would be easier to add the hidden span. One caveat is if the "data-*" attribute will be able to be retrieved in IE 10 and below. Sorry I don't have IE 10 to test, but it worked on IE 11
Can't move forum conversation from duplicate forum to original forum topic. It looks like the code checks if other topics have the same title as the current topic and if so, it greys out the radio button so you can't select it. I think it would make more sense to compare the topic id rather than the title.