Update variable name and JSdoc for improved clarity.

This commit is contained in:
Richard Lewis 2017-11-08 17:44:54 +00:00
parent ca1ffdfa9f
commit be0a76dbd6

View file

@ -59,20 +59,20 @@ export default React.createClass({
}, },
/** /**
* Set initial component state when the App wUrl (widget URL) is being updated * Set initial component state when the App wUrl (widget URL) is being updated. Component props *must* be passed (rather than relying on this.props).
* @param {Object} props The component props *must* be passed (rather than using this.props) so that it can be called with future props, e.g. from componentWillReceiveProps. * @param {Object} newProps The new properties of the component
* @return {Object} Updated component state to be set with setState * @return {Object} Updated component state to be set with setState
*/ */
_getNewUrlState(props) { _getNewUrlState(newProps) {
const widgetPermissionId = [props.room.roomId, encodeURIComponent(props.url)].join('_'); const widgetPermissionId = [newProps.room.roomId, encodeURIComponent(newProps.url)].join('_');
const hasPermissionToLoad = localStorage.getItem(widgetPermissionId); const hasPermissionToLoad = localStorage.getItem(widgetPermissionId);
return { return {
initialising: true, // True while we are mangling the widget URL initialising: true, // True while we are mangling the widget URL
loading: true, // True while the iframe content is loading loading: true, // True while the iframe content is loading
widgetUrl: props.url, widgetUrl: newProps.url,
widgetPermissionId: widgetPermissionId, widgetPermissionId: widgetPermissionId,
// Assume that widget has permission to load if we are the user who added it to the room, or if explicitly granted by the user // Assume that widget has permission to load if we are the user who added it to the room, or if explicitly granted by the user
hasPermissionToLoad: hasPermissionToLoad === 'true' || props.userId === props.creatorUserId, hasPermissionToLoad: hasPermissionToLoad === 'true' || newProps.userId === newProps.creatorUserId,
error: null, error: null,
deleting: false, deleting: false,
}; };