Merge branch 'master' into develop

This commit is contained in:
David Baker 2019-03-06 11:28:54 +00:00
commit 1e7af106b0
6 changed files with 186 additions and 6 deletions

View file

@ -820,7 +820,7 @@ export default React.createClass({
const hostingSignupLink = getHostingLink('community-settings');
let hostingSignup = null;
if (hostingSignupLink) {
if (hostingSignupLink && this.state.isUserPrivileged) {
hostingSignup = <div className="mx_GroupView_hostingSignup">
{_t(
"Want more than a community? <a>Get your own server</a>", {},

View file

@ -338,8 +338,13 @@ export function getCurrentLanguage() {
function getLangsJson() {
return new Promise((resolve, reject) => {
// LANGUAGES_FILE is a webpack compile-time define, see webpack config
const url = (typeof LANGUAGES_FILE === "string") ? require(LANGUAGES_FILE) : (i18nFolder + 'languages.json');
let url;
try {
// $webapp is a webpack resolve alias pointing to the output directory, see webpack config
url = require('$webapp/i18n/languages.json');
} catch (e) {
url = i18nFolder + 'languages.json';
}
request(
{ method: "GET", url },
(err, response, body) => {

View file

@ -18,12 +18,15 @@ import url from 'url';
import qs from 'qs';
import SdkConfig from '../SdkConfig';
import MatrixClientPeg from '../MatrixClientPeg';
export function getHostingLink(campaign) {
const hostingLink = SdkConfig.get().hosting_signup_link;
if (!hostingLink) return null;
if (!campaign) return hostingLink;
if (MatrixClientPeg.get().getDomain() !== 'matrix.org') return null;
try {
const hostingUrl = url.parse(hostingLink);
const params = qs.parse(hostingUrl.query);