Discussion's refetches data after initial discussion_topics_post
fixes VICE-3041 Test plan 1. With discussionr design enabled... 2. Create a Discussion Topic with "reply before showing post" enabled 3. Post an initial response as the creator of the Topic 4. Change to student account, go to Topic 5. Notice, there are no posts showing 6. Make a reply, when clicking reply, notice the page requires and post from teacher is now visible Change-Id: Ia01ac5150651484d61baf7def954b20503b670d0 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/302952 QA-Review: Caleb Guanzon <cguanzon@instructure.com> Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com> Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
891c0374c2
commit
60c1ba2e2d
|
@ -456,5 +456,28 @@ describe "threaded discussions" do
|
|||
expect(authors).not_to include("student")
|
||||
end
|
||||
end
|
||||
|
||||
context "users must post before seeing replies" do
|
||||
it "requires a post before seeing replies for students" do
|
||||
topic = create_discussion("must see replies", "threaded")
|
||||
topic.require_initial_post = true
|
||||
topic.save!
|
||||
topic.reload
|
||||
topic.discussion_entries.create!(
|
||||
user: @teacher,
|
||||
message: "students can only see this if they reply"
|
||||
)
|
||||
user_session(@student)
|
||||
get "/courses/#{@course.id}/discussion_topics/#{topic.id}"
|
||||
expect(fj("div:contains('You must post before seeing replies.')")).to be_present
|
||||
expect(f("body")).not_to contain_jqcss("div:contains('students can only see this if they reply')")
|
||||
f("button[data-testid='discussion-topic-reply']").click
|
||||
type_in_tiny("textarea", "student here")
|
||||
fj("button:contains('Reply')").click
|
||||
wait_for_ajaximations
|
||||
expect(f("body")).to contain_jqcss("div:contains('students can only see this if they reply')")
|
||||
expect(f("body")).to contain_jqcss("div:contains('student here')")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -262,6 +262,15 @@ const DiscussionTopicManager = props => {
|
|||
})
|
||||
}}
|
||||
isHighlighted={isTopicHighlighted}
|
||||
onDiscussionReplyPost={() => {
|
||||
// When post requires a reply, check to see if we can refatch after initial post
|
||||
if (
|
||||
discussionTopicQuery.data.legacyNode.availableForUser &&
|
||||
discussionTopicQuery.data.legacyNode.initialPostRequiredForCurrentUser
|
||||
) {
|
||||
discussionTopicQuery.refetch(variables)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{discussionTopicQuery.data.legacyNode.discussionEntriesConnection.nodes.length === 0 &&
|
||||
(searchTerm || filter === 'unread') ? (
|
||||
|
|
|
@ -502,6 +502,7 @@ export const DiscussionTopicContainer = ({createDiscussionEntry, ...props}) => {
|
|||
if (createDiscussionEntry) {
|
||||
createDiscussionEntry(message, anonymousAuthorState)
|
||||
setExpandedReply(false)
|
||||
props.onDiscussionReplyPost()
|
||||
}
|
||||
}}
|
||||
onCancel={() => {
|
||||
|
@ -583,6 +584,10 @@ DiscussionTopicContainer.propTypes = {
|
|||
* useState Boolean to toggle highlight
|
||||
*/
|
||||
isHighlighted: PropTypes.bool,
|
||||
/**
|
||||
* Callback to be called when discussion post is submitted
|
||||
*/
|
||||
onDiscussionReplyPost: PropTypes.func,
|
||||
}
|
||||
|
||||
export default DiscussionTopicContainer
|
||||
|
|
Loading…
Reference in New Issue