Use m.accepted_terms account data

To remember what policies the user has agreed to
This commit is contained in:
David Baker 2019-07-11 10:53:45 +01:00
parent 90a0f93215
commit f77e7fc3e8
2 changed files with 62 additions and 8 deletions

View file

@ -47,7 +47,12 @@ export default class TermsDialog extends React.PureComponent {
* Array of [Service, terms] pairs, where terms is the response from the
* /terms endpoint for that service
*/
policiesAndServicePairs: PropTypes.arrayOf(PropTypes.object).isRequired,
policiesAndServicePairs: PropTypes.array.isRequired,
/**
* urls that the user has already agreed to
*/
agreedUrls: PropTypes.arrayOf(PropTypes.string),
/**
* Called with:
@ -57,12 +62,15 @@ export default class TermsDialog extends React.PureComponent {
onFinished: PropTypes.func.isRequired,
}
constructor() {
constructor(props) {
super();
this.state = {
// url -> boolean
agreedUrls: {},
};
for (const url of props.agreedUrls) {
this.state.agreedUrls[url] = true;
}
}
_onCancelClick = () => {