Skip to content

Commit

Permalink
Merge pull request #319 from lookit/develop
Browse files Browse the repository at this point in the history
Deploy development changes to production.
  • Loading branch information
okaycj committed Dec 15, 2022
2 parents 4b0c8c5 + 19e7b36 commit f30d617
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/dubnium
lts/erbium
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dist: trusty
language: node_js
node_js:
- 10
- 12

sudo: false

Expand Down
3 changes: 3 additions & 0 deletions app/components/exp-lookit-video-consent/doc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ prompt_only_adults [Boolean | ``false``]
[Templates 5+ only] Whether to prompt only the adult for consent for themselves to participate, rather than also referencing a child.
This is for occasional studies running an adult comparison group.

consent_statement_text [String]
[Templates 5+ only] Replace the default spoken consent statement with your custom text.

omit_injury_phrase [Boolean | ``false``]
[Templates 5+ only] Whether to omit the phrase "or in the very unlikely event of a research-related injury" from
the contact section. (This was required by the Northwestern IRB.)
Expand Down
2 changes: 1 addition & 1 deletion app/components/exp-lookit-video-consent/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
</div>

<div class="well video-consent-prompt">
<span class="breaklines exp-lookit-video-consent-prompt">"{{#if prompt_only_adults}}{{ t "exp-lookit-video-consent.prompt-adult-only" }}{{else}}{{ t "exp-lookit-video-consent.prompt" }}{{/if}}"</span>
<span class="breaklines exp-lookit-video-consent-prompt">"{{#if consent_statement_text}}{{consent_statement_text}}{{else if prompt_only_adults}}{{ t "exp-lookit-video-consent.prompt-adult-only"}}{{else}}{{t "exp-lookit-video-consent.prompt"}}{{/if}}"</span>
</div>

{{#if prompt_all_adults}}
Expand Down
7 changes: 6 additions & 1 deletion app/components/exp-player/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import layout from './template';

import FullScreen from '../../mixins/full-screen';
import ExperimentParser from '../../utils/parse-experiment';
import { addSearchParams } from '../../utils/add-search-params';

let {
$
Expand Down Expand Up @@ -192,7 +193,11 @@ export default Ember.Component.extend(FullScreen, {
},

_exit() {
this.get('session').save().then(() => window.location = this.get('experiment.exitURL') || '/');
const exitUrl = this.get('experiment.exitURL');
const hashChildId = this.get('session.hash_child_id');
const responseId = this.get('session.id');

this.get('session').save().then(() => window.location = addSearchParams(exitUrl, responseId, hashChildId) );
},

actions: {
Expand Down
3 changes: 2 additions & 1 deletion app/models/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export default DS.Model.extend({
study: DS.belongsTo('study'),
demographicSnapshot: DS.belongsTo('demographic'),
createdOn: DS.attr('date'),
isPreview: DS.attr('boolean', {defaultValue: false})
isPreview: DS.attr('boolean', {defaultValue: false}),
hash_child_id: DS.attr('string')
});
25 changes: 25 additions & 0 deletions app/utils/add-search-params.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const addSearchParams = function(exitUrl, responseId, hashChildId){
try {
// Parse URL and search params
const url = new URL(exitUrl);
const params = new URLSearchParams(url.search);

// Set child and response values
// params.set('child', this.get('session.hash_child_id'));
// params.set('response', this.get('session.id'))
params.set('child', hashChildId);
params.set('response', responseId);

// Set these changes to the URL
url.search = params;

// Return updated URL
return url.toString();

} catch (TypeError) {
// If the provided URL can't be parsed, return root.
return '/'
}
};

export { addSearchParams };
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/lookit/ember-lookit-frameplayer.git"
},
"engines": {
"node": ">=8"
"node": ">=12"
},
"author": "",
"license": "MIT",
Expand Down Expand Up @@ -99,4 +99,4 @@
"node": true
}
}
}
}
12 changes: 12 additions & 0 deletions tests/unit/utils/add-search-params-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { module, test} from 'qunit';
import { addSearchParams } from '../../../utils/add-search-params';

module('Unit | Utility | add search params');

test('Test add search params function', function(assert) {
assert.expect(3);
assert.equal(addSearchParams('https://lookit.mit.edu', 'repsonse-id', 'hash-child-id'), 'https://lookit.mit.edu/?child=hash-child-id&response=repsonse-id');
assert.equal(addSearchParams('not-a-url', 'repsonse-id', 'hash-child-id'), '/');
assert.equal(addSearchParams(undefined, 'repsonse-id', 'hash-child-id'), '/');
});

0 comments on commit f30d617

Please sign in to comment.