Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into t3chguy/optional_new_behaviour_roomsublist
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Jul 4, 2018
2 parents 1b003ca + 4b4864a commit 168edbc
Show file tree
Hide file tree
Showing 23 changed files with 582 additions and 143 deletions.
1 change: 1 addition & 0 deletions src/GroupAddressPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import React from 'react';
import Modal from './Modal';
import sdk from './';
import MultiInviter from './utils/MultiInviter';
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/MatrixChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ export default React.createClass({

const dft = new DecryptionFailureTracker((total) => {
// TODO: Pass reason for failure as third argument to trackEvent
Analytics.trackEvent('E2E', 'Decryption failure', null, total);
Analytics.trackEvent('E2E', 'Decryption failure', 'unspecified_error', total);
});

// Shelved for later date when we have time to think about persisting history of
Expand Down
26 changes: 14 additions & 12 deletions src/components/views/elements/PersistedElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,24 @@ limitations under the License.

const React = require('react');
const ReactDOM = require('react-dom');
const PropTypes = require('prop-types');

// Shamelessly ripped off Modal.js. There's probably a better way
// of doing reusable widgets like dialog boxes & menus where we go and
// pass in a custom control as the actual body.

const ContainerId = "mx_PersistedElement";

function getOrCreateContainer() {
let container = document.getElementById(ContainerId);
function getOrCreateContainer(containerId) {
let container = document.getElementById(containerId);

if (!container) {
container = document.createElement("div");
container.id = ContainerId;
container.id = containerId;
document.body.appendChild(container);
}

return container;
}

// Greater than that of the ContextualMenu
const PE_Z_INDEX = 5000;

/*
* Class of component that renders its children in a separate ReactDOM virtual tree
* in a container element appended to document.body.
Expand All @@ -50,6 +46,14 @@ const PE_Z_INDEX = 5000;
* bounding rect as the parent of PE.
*/
export default class PersistedElement extends React.Component {

static propTypes = {
// Unique identifier for this PersistedElement instance
// Any PersistedElements with the same persistKey will use
// the same DOM container.
persistKey: PropTypes.string.isRequired,
};

constructor() {
super();
this.collectChildContainer = this.collectChildContainer.bind(this);
Expand Down Expand Up @@ -97,18 +101,16 @@ export default class PersistedElement extends React.Component {
left: parentRect.left + 'px',
width: parentRect.width + 'px',
height: parentRect.height + 'px',
zIndex: PE_Z_INDEX,
});
}

render() {
const content = <div ref={this.collectChild}>
const content = <div ref={this.collectChild} style={this.props.style}>
{this.props.children}
</div>;

ReactDOM.render(content, getOrCreateContainer());
ReactDOM.render(content, getOrCreateContainer('mx_persistedElement_'+this.props.persistKey));

return <div ref={this.collectChildContainer}></div>;
}
}

1 change: 1 addition & 0 deletions src/components/views/messages/MStickerBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

'use strict';

import React from 'react';
import MImageBody from './MImageBody';
import sdk from '../../../index';

Expand Down
54 changes: 37 additions & 17 deletions src/components/views/rooms/MemberInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,40 @@ module.exports = withMatrixClient(React.createClass({
});
},

onMuteToggle: function() {
_warnSelfDemote: function() {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
return new Promise((resolve) => {
Modal.createTrackedDialog('Demoting Self', '', QuestionDialog, {
title: _t("Demote yourself?"),
description:
<div>
{ _t("You will not be able to undo this change as you are demoting yourself, " +
"if you are the last privileged user in the room it will be impossible " +
"to regain privileges.") }
</div>,
button: _t("Demote"),
onFinished: resolve,
});
});
},

onMuteToggle: async function() {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
const roomId = this.props.member.roomId;
const target = this.props.member.userId;
const room = this.props.matrixClient.getRoom(roomId);
if (!room) return;

// if muting self, warn as it may be irreversible
if (target === this.props.matrixClient.getUserId()) {
try {
if (!(await this._warnSelfDemote())) return;
} catch (e) {
console.error("Failed to warn about self demotion: ", e);
return;
}
}

const powerLevelEvent = room.currentState.getStateEvents("m.room.power_levels", "");
if (!powerLevelEvent) return;

Expand Down Expand Up @@ -436,7 +463,7 @@ module.exports = withMatrixClient(React.createClass({
}).done();
},

onPowerChange: function(powerLevel) {
onPowerChange: async function(powerLevel) {
const roomId = this.props.member.roomId;
const target = this.props.member.userId;
const room = this.props.matrixClient.getRoom(roomId);
Expand All @@ -455,20 +482,12 @@ module.exports = withMatrixClient(React.createClass({

// If we are changing our own PL it can only ever be decreasing, which we cannot reverse.
if (myUserId === target) {
Modal.createTrackedDialog('Demoting Self', '', QuestionDialog, {
title: _t("Warning!"),
description:
<div>
{ _t("You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.") }<br />
{ _t("Are you sure?") }
</div>,
button: _t("Continue"),
onFinished: (confirmed) => {
if (confirmed) {
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
}
},
});
try {
if (!(await this._warnSelfDemote())) return;
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
} catch (e) {
console.error("Failed to warn about self demotion: ", e);
}
return;
}

Expand All @@ -478,7 +497,8 @@ module.exports = withMatrixClient(React.createClass({
title: _t("Warning!"),
description:
<div>
{ _t("You will not be able to undo this change as you are promoting the user to have the same power level as yourself.") }<br />
{ _t("You will not be able to undo this change as you are promoting the user " +
"to have the same power level as yourself.") }<br />
{ _t("Are you sure?") }
</div>,
button: _t("Continue"),
Expand Down
6 changes: 5 additions & 1 deletion src/components/views/rooms/Stickerpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import WidgetUtils from '../../../utils/WidgetUtils';

const widgetType = 'm.stickerpicker';

// We sit in a context menu, so the persisted element container needs to float
// above it, so it needs a greater z-index than the ContextMenu
const STICKERPICKER_Z_INDEX = 5000;

export default class Stickerpicker extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -211,7 +215,7 @@ export default class Stickerpicker extends React.Component {
width: this.popoverWidth,
}}
>
<PersistedElement>
<PersistedElement containerId="mx_persisted_stickerPicker" style={{zIndex: STICKERPICKER_Z_INDEX}}>
<AppTile
collectWidgetMessaging={this._collectWidgetMessaging}
id={stickerpickerWidget.id}
Expand Down
29 changes: 28 additions & 1 deletion src/i18n/strings/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -1181,5 +1181,32 @@
"To continue using the %(homeserverDomain)s homeserver you must review and agree to our terms and conditions.": "За да продължите да ползвате %(homeserverDomain)s е необходимо да прегледате и да се съгласите с правилата и условията за ползване.",
"Review terms and conditions": "Прегледай правилата и условията",
"Failed to indicate account erasure": "Неуспешно указване на желанието за изтриване на акаунта",
"Try the app first": "Първо пробвайте приложението"
"Try the app first": "Първо пробвайте приложението",
"Encrypting": "Шифроване",
"Encrypted, not sent": "Шифровано, неизпратено",
"Share Link to User": "Сподели връзка с потребител",
"Share room": "Сподели стая",
"Share Room": "Споделяне на стая",
"Link to most recent message": "Създай връзка към най-новото съобщение",
"Share User": "Споделяне на потребител",
"Share Community": "Споделяне на общност",
"Share Room Message": "Споделяне на съобщение от стая",
"Link to selected message": "Създай връзка към избраното съобщение",
"COPY": "КОПИРАЙ",
"Share Message": "Сподели съобщението",
"No Audio Outputs detected": "Не са открити аудио изходи",
"Audio Output": "Аудио изходи",
"Jitsi Conference Calling": "Jitsi конферентни разговори",
"Call in Progress": "Тече разговор",
"A call is already in progress!": "В момента вече тече разговор!",
"You have no historical rooms": "Нямате стаи в архива",
"In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.": "В шифровани стаи като тази, по подразбиране URL прегледите са изключени, за да се подсигури че сървърът (където става генерирането на прегледите) не може да събира информация за връзките споделени в стаята.",
"When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.": "Когато някой сподели URL връзка в съобщение, може да бъде показан URL преглед даващ повече информация за връзката (заглавие, описание и картинка от уебсайта).",
"The email field must not be blank.": "Имейл полето не може да бъде празно.",
"The user name field must not be blank.": "Полето за потребителско име не може да е празно.",
"The phone number field must not be blank.": "Полето за телефонен номер не може да е празно.",
"The password field must not be blank.": "Полето за парола не може да е празно.",
"You can't send any messages until you review and agree to <consentLink>our terms and conditions</consentLink>.": "Не можете да изпращате съобщения докато не прегледате и се съгласите с <consentLink>нашите правила и условия</consentLink>.",
"Demote yourself?": "Понижете себе си?",
"Demote": "Понижение"
}
6 changes: 5 additions & 1 deletion src/i18n/strings/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1076,5 +1076,9 @@
"Collapse panel": "Sbalit panel",
"With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!": "Vzhled a chování aplikace může být ve vašem aktuální prohlížeči nesprávné a některé nebo všechny funkce mohou být chybné. Chcete-li i přes to pokračovat, nebudeme vám bránit, ale se všemi problémy, na které narazíte, si musíte poradit sami!",
"Checking for an update...": "Kontrola aktualizací...",
"There are advanced notifications which are not shown here": "Jsou k dispozici pokročilá upozornění, která zde nejsou zobrazena"
"There are advanced notifications which are not shown here": "Jsou k dispozici pokročilá upozornění, která zde nejsou zobrazena",
"The platform you're on": "Platforma na které jsi",
"The version of Riot.im": "Verze Riot.im",
"Whether or not you're logged in (we don't record your user name)": "Jestli jsi, nebo nejsi přihlášen (tvou přezdívku neukládáme)",
"Your language of choice": "Tvá jazyková volba"
}
13 changes: 12 additions & 1 deletion src/i18n/strings/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -1195,5 +1195,16 @@
"Share Message": "Teile Nachricht",
"No Audio Outputs detected": "Keine Ton-Ausgabe erkannt",
"Audio Output": "Ton-Ausgabe",
"Try the app first": "App erst ausprobieren"
"Try the app first": "App erst ausprobieren",
"Jitsi Conference Calling": "Jitsi-Konferenz Anruf",
"In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.": "In verschlüsselten Räumen, wie diesem, ist die Link-Vorschau standardmäßig deaktiviert damit dein Heimserver (auf dem die Vorschau erzeugt wird) keine Informationen über Links in diesem Raum bekommt.",
"When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.": "Wenn jemand eine Nachricht mit einem Link schickt, kann die Link-Vorschau mehr Informationen, wie Titel, Beschreibung und Bild der Webseite, über den Link anzeigen.",
"The email field must not be blank.": "Das E-Mail-Feld darf nicht leer sein.",
"The user name field must not be blank.": "Das Benutzername-Feld darf nicht leer sein.",
"The phone number field must not be blank.": "Das Telefonnummern-Feld darf nicht leer sein.",
"The password field must not be blank.": "Das Passwort-Feld darf nicht leer sein.",
"Call in Progress": "Gespräch läuft",
"A call is already in progress!": "Ein Gespräch läuft bereits!",
"You have no historical rooms": "Du hast keine historischen Räume",
"You can't send any messages until you review and agree to <consentLink>our terms and conditions</consentLink>.": "Du kannst keine Nachrichten senden bis du die <consentLink>unsere Geschläftsbedingungen</consentLink> gelesen und akzeptiert hast."
}
7 changes: 5 additions & 2 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,14 @@
"Unban this user?": "Unban this user?",
"Ban this user?": "Ban this user?",
"Failed to ban user": "Failed to ban user",
"Demote yourself?": "Demote yourself?",
"You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.": "You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.",
"Demote": "Demote",
"Failed to mute user": "Failed to mute user",
"Failed to toggle moderator status": "Failed to toggle moderator status",
"Failed to change power level": "Failed to change power level",
"You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.": "You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.",
"Are you sure?": "Are you sure?",
"You will not be able to undo this change as you are promoting the user to have the same power level as yourself.": "You will not be able to undo this change as you are promoting the user to have the same power level as yourself.",
"Are you sure?": "Are you sure?",
"No devices with registered encryption keys": "No devices with registered encryption keys",
"Devices": "Devices",
"Unignore": "Unignore",
Expand Down Expand Up @@ -770,6 +772,7 @@
"Room directory": "Room directory",
"Start chat": "Start chat",
"And %(count)s more...|other": "And %(count)s more...",
"Share Link to User": "Share Link to User",
"ex. @bob:example.com": "ex. @bob:example.com",
"Add User": "Add User",
"Matrix ID": "Matrix ID",
Expand Down
13 changes: 12 additions & 1 deletion src/i18n/strings/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -1195,5 +1195,16 @@
"COPY": "KOPIATU",
"Share Message": "Partekatu mezua",
"No Audio Outputs detected": "Ez da audio irteerarik antzeman",
"Audio Output": "Audio irteera"
"Audio Output": "Audio irteera",
"Jitsi Conference Calling": "Jitsi konferentzia deia",
"In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.": "Zifratutako gelatan, honetan esaterako, URL-en aurrebistak lehenetsita desgaituta daude zure hasiera-zerbitzariak gela honetan ikusten dituzun estekei buruzko informaziorik jaso ez dezan, hasiera-zerbitzarian sortzen baitira aurrebistak.",
"When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.": "Norbaitek mezu batean URL bat jartzen duenean, URL aurrebista bat erakutsi daiteke estekaren informazio gehiago erakusteko, adibidez webgunearen izenburua, deskripzioa eta irudi bat.",
"The email field must not be blank.": "E-mail eremua ezin da hutsik laga.",
"The user name field must not be blank.": "Erabiltzaile-izen eremua ezin da hutsik laga.",
"The phone number field must not be blank.": "Telefono zenbakia eremua ezin da hutsik laga.",
"The password field must not be blank.": "Pasahitza eremua ezin da hutsik laga.",
"Call in Progress": "Deia abian",
"A call is already in progress!": "Badago dei bat abian!",
"You have no historical rooms": "Ez duzu gelen historialik",
"You can't send any messages until you review and agree to <consentLink>our terms and conditions</consentLink>.": "Ezin duzu mezurik bidali <consentLink>gure termino eta baldintzak</consentLink> irakurri eta onartu arte."
}
Loading

0 comments on commit 168edbc

Please sign in to comment.