Update logging for unmanaged widgets, and add TODO comments for other areas

Just a minor thing that is bothersome. Renaming classes and functions is a bit more of an impact than is worth right now, so have settled for littering TODO comments all over the place.
pull/21833/head
Travis Ralston 2020-04-22 00:34:08 -06:00
parent 02ed921d57
commit 3a360b91b9
4 changed files with 8 additions and 2 deletions

View File

@ -27,6 +27,8 @@ import SdkConfig from "./SdkConfig";
// The version of the integration manager API we're intending to work with // The version of the integration manager API we're intending to work with
const imApiVersion = "1.1"; const imApiVersion = "1.1";
// TODO: Generify the name of this class and all components within - it's not just for Scalar.
export default class ScalarAuthClient { export default class ScalarAuthClient {
constructor(apiUrl, uiUrl) { constructor(apiUrl, uiUrl) {
this.apiUrl = apiUrl; this.apiUrl = apiUrl;

View File

@ -16,6 +16,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// TODO: Generify the name of this and all components within - it's not just for scalar.
/* /*
Listens for incoming postMessage requests from the integrations UI URL. The following API is exposed: Listens for incoming postMessage requests from the integrations UI URL. The following API is exposed:
{ {

View File

@ -188,13 +188,14 @@ export default class AppTile extends React.Component {
} }
} }
// TODO: Generify the name of this function. It's not just scalar tokens.
/** /**
* Adds a scalar token to the widget URL, if required * Adds a scalar token to the widget URL, if required
* Component initialisation is only complete when this function has resolved * Component initialisation is only complete when this function has resolved
*/ */
setScalarToken() { setScalarToken() {
if (!WidgetUtils.isScalarUrl(this.props.app.url)) { if (!WidgetUtils.isScalarUrl(this.props.app.url)) {
console.warn('Non-scalar widget, not setting scalar token!', url); console.warn('Widget does not match integration manager, refusing to set auth token', url);
this.setState({ this.setState({
error: null, error: null,
widgetUrl: this._addWurlParams(this.props.app.url), widgetUrl: this._addWurlParams(this.props.app.url),
@ -218,7 +219,7 @@ export default class AppTile extends React.Component {
const defaultManager = managers.getPrimaryManager(); const defaultManager = managers.getPrimaryManager();
if (!WidgetUtils.isScalarUrl(defaultManager.apiUrl)) { if (!WidgetUtils.isScalarUrl(defaultManager.apiUrl)) {
console.warn('Non-scalar manager, not setting scalar token!', url); console.warn('Unknown integration manager, refusing to set auth token', url);
this.setState({ this.setState({
error: null, error: null,
widgetUrl: this._addWurlParams(this.props.app.url), widgetUrl: this._addWurlParams(this.props.app.url),

View File

@ -72,6 +72,7 @@ export default class WidgetUtils {
return room.currentState.maySendStateEvent('im.vector.modular.widgets', me); return room.currentState.maySendStateEvent('im.vector.modular.widgets', me);
} }
// TODO: Generify the name of this function. It's not just scalar.
/** /**
* Returns true if specified url is a scalar URL, typically https://scalar.vector.im/api * Returns true if specified url is a scalar URL, typically https://scalar.vector.im/api
* @param {[type]} testUrlString URL to check * @param {[type]} testUrlString URL to check