Merge pull request #3327 from matrix-org/travis/discover-terms
Handle terms agreement in Discovery section of user settings
This commit is contained in:
commit
04bb2ed322
9 changed files with 317 additions and 50 deletions
|
@ -25,38 +25,7 @@ import dis from "../../../dispatcher";
|
|||
import { getThreepidBindStatus } from '../../../boundThreepids';
|
||||
import IdentityAuthClient from "../../../IdentityAuthClient";
|
||||
import {SERVICE_TYPES} from "matrix-js-sdk";
|
||||
|
||||
/**
|
||||
* If a url has no path component, etc. abbreviate it to just the hostname
|
||||
*
|
||||
* @param {string} u The url to be abbreviated
|
||||
* @returns {string} The abbreviated url
|
||||
*/
|
||||
function abbreviateUrl(u) {
|
||||
if (!u) return '';
|
||||
|
||||
const parsedUrl = url.parse(u);
|
||||
// if it's something we can't parse as a url then just return it
|
||||
if (!parsedUrl) return u;
|
||||
|
||||
if (parsedUrl.path == '/') {
|
||||
// we ignore query / hash parts: these aren't relevant for IS server URLs
|
||||
return parsedUrl.host;
|
||||
}
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
function unabbreviateUrl(u) {
|
||||
if (!u) return '';
|
||||
|
||||
let longUrl = u;
|
||||
if (!u.startsWith('https://')) longUrl = 'https://' + u;
|
||||
const parsed = url.parse(longUrl);
|
||||
if (parsed.hostname === null) return u;
|
||||
|
||||
return longUrl;
|
||||
}
|
||||
import {abbreviateUrl, unabbreviateUrl} from "../../../utils/UrlUtils";
|
||||
|
||||
/**
|
||||
* Check an IS URL is valid, including liveness check
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue