Skip to content

Commit 390de4c

Browse files
Merge pull request #325 from openedx/mroytman/MST-1769-pii-sharing-consent-dialog-button-bugs
Fix bug in rending buttons and message in PII sharing consent dialog.
2 parents 53823ea + d95de6e commit 390de4c

3 files changed

Lines changed: 23 additions & 8 deletions

File tree

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Please See the [releases tab](https://github.com/openedx/xblock-lti-consumer/rel
1616
Unreleased
1717
~~~~~~~~~~
1818

19+
7.2.3 - 2023-01-24
20+
------------------
21+
* This release fixes a bug in the way that the PII sharing consent dialog renders. The bug resulted in the "OK" and
22+
"Cancel" buttons as well as the text of the PII sharing consent prompt appearing inside an inappropriate component
23+
when there was more than one LTI component in a unit.
24+
1925
7.2.2 - 2023-01-12
2026
------------------
2127
* Fixes LTI 1.3 grade injection vulnerability that allowed LTI integrations to modify scores for any block.

lti_consumer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from .apps import LTIConsumerApp
55
from .lti_xblock import LtiConsumerXBlock
66

7-
__version__ = '7.2.2'
7+
__version__ = '7.2.3'

lti_consumer/static/js/xblock_lti_consumer.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,30 +107,39 @@ function LtiConsumerXBlock(runtime, element) {
107107

108108
function confirmDialog(message, triggerElement, showCancelButton) {
109109
var def = $.Deferred();
110+
111+
// In order to scope the dialog container to the lti-consumer-container, grab the ID of the
112+
// lti-consumer-container ancestor and append it to the ID of the dialog container.
113+
var container_id = triggerElement.closest(".lti-consumer-container").attr("id");
114+
var dialog_container_id = "dialog-container-" + container_id;
115+
110116
// Hide the button that triggered the event, i.e. the launch button.
111117
triggerElement.hide();
112118

113-
$('<div id="dialog-container"></div>').insertAfter(triggerElement) // TODO: this will need some cute styling. It looks like trash but it works.
119+
$('<div id="' + dialog_container_id + '"></div>').insertAfter(triggerElement) // TODO: this will need some cute styling. It looks like trash but it works.
114120
.append('<p>' + message + '</p>')
121+
122+
var $dialog_container = $("#" + dialog_container_id);
123+
115124
if (showCancelButton) {
116-
$('#dialog-container')
125+
$dialog_container
117126
.append('<button style="margin-right:1rem" id="cancel-button">Cancel</button>');
118127
}
119-
$('#dialog-container').append('<button id="confirm-button">OK</button>');
128+
$dialog_container.append('<button id="confirm-button">OK</button>');
120129

121130
// When a learner clicks "OK" or "Cancel" in the consent dialog, remove the consent dialog, show the launch
122131
// button, and resolve the promise.
123-
$('#confirm-button').click(function () {
132+
$dialog_container.find('#confirm-button').click(function () {
124133
// Show the button that triggered the event, i.e. the launch button.
125134
triggerElement.show();
126-
$("#dialog-container").remove()
135+
$dialog_container.remove()
127136
$('body').append('<h1>Confirm Dialog Result: <i>Yes</i></h1>');
128137
def.resolve("OK");
129138
})
130-
$('#cancel-button').click(function () {
139+
$dialog_container.find('#cancel-button').click(function () {
131140
// Hide the button that triggered the event, i.e. the launch button.
132141
triggerElement.show()
133-
$("#dialog-container").remove()
142+
$dialog_container.remove()
134143
$('body').append('<h1>Confirm Dialog Result: <i>No</i></h1>');
135144
def.resolve("Cancel");
136145
})

0 commit comments

Comments
 (0)