Merge remote-tracking branch 'origin/develop' into dbkr/groupview_edit

This commit is contained in:
David Baker 2017-07-18 11:14:27 +01:00
commit fc470cd20d
21 changed files with 131 additions and 189 deletions

View file

@ -16,7 +16,7 @@ limitations under the License.
"use strict";
var q = require("q");
import Promise from 'bluebird';
var Matrix = require("matrix-js-sdk");
var Room = Matrix.Room;
var CallHandler = require('matrix-react-sdk/lib/CallHandler');
@ -53,11 +53,11 @@ ConferenceCall.prototype._joinConferenceUser = function() {
// Make sure the conference user is in the group chat room
var groupRoom = this.client.getRoom(this.groupRoomId);
if (!groupRoom) {
return q.reject("Bad group room ID");
return Promise.reject("Bad group room ID");
}
var member = groupRoom.getMember(this.confUserId);
if (member && member.membership === "join") {
return q();
return Promise.resolve();
}
return this.client.invite(this.groupRoomId, this.confUserId);
};
@ -75,7 +75,7 @@ ConferenceCall.prototype._getConferenceUserRoom = function() {
}
}
if (confRoom) {
return q(confRoom);
return Promise.resolve(confRoom);
}
return this.client.createRoom({
preset: "private_chat",

View file

@ -28,7 +28,7 @@ var linkify = require('linkifyjs');
var linkifyString = require('linkifyjs/string');
var linkifyMatrix = require('matrix-react-sdk/lib/linkify-matrix');
var sanitizeHtml = require('sanitize-html');
var q = require('q');
import Promise from 'bluebird';
import { _t } from 'matrix-react-sdk/lib/languageHandler';
@ -117,7 +117,7 @@ module.exports = React.createClass({
},
getMoreRooms: function() {
if (!MatrixClientPeg.get()) return q();
if (!MatrixClientPeg.get()) return Promise.resolve();
const my_filter_string = this.state.filterString;
const my_server = this.state.roomServer;
@ -266,7 +266,7 @@ module.exports = React.createClass({
},
onFillRequest: function(backwards) {
if (backwards || !this.nextBatch) return q(false);
if (backwards || !this.nextBatch) return Promise.resolve(false);
return this.getMoreRooms();
},

View file

@ -17,7 +17,7 @@ limitations under the License.
'use strict';
import q from 'q';
import Promise from 'bluebird';
import React from 'react';
import classNames from 'classnames';
import sdk from 'matrix-react-sdk';
@ -61,7 +61,7 @@ module.exports = React.createClass({
const roomId = this.props.room.roomId;
var cli = MatrixClientPeg.get();
if (!cli.isGuest()) {
q.delay(500).then(function() {
Promise.delay(500).then(function() {
if (tagNameOff !== null && tagNameOff !== undefined) {
cli.deleteRoomTag(roomId, tagNameOff).finally(function() {
// Close the context menu
@ -212,7 +212,7 @@ module.exports = React.createClass({
RoomNotifs.setRoomNotifsState(this.props.room.roomId, newState).done(() => {
// delay slightly so that the user can see their state change
// before closing the menu
return q.delay(500).then(() => {
return Promise.delay(500).then(() => {
if (this._unmounted) return;
// Close the context menu
if (this.props.onFinished) {

View file

@ -17,7 +17,7 @@ limitations under the License.
'use strict';
var React = require('react');
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler';
var q = require("q");
import Promise from 'bluebird';
var sdk = require('matrix-react-sdk');
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
var UserSettingsStore = require('matrix-react-sdk/lib/UserSettingsStore');
@ -236,7 +236,7 @@ module.exports = React.createClass({
}
}
q.all(deferreds).done(function() {
Promise.all(deferreds).done(function() {
self._refreshFromServer();
}, function(error) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
@ -306,7 +306,7 @@ module.exports = React.createClass({
}
}
q.all(deferreds).done(function(resps) {
Promise.all(deferreds).done(function(resps) {
self._refreshFromServer();
}, function(error) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
@ -361,7 +361,7 @@ module.exports = React.createClass({
}
// Then, add the new ones
q.all(removeDeferreds).done(function(resps) {
Promise.all(removeDeferreds).done(function(resps) {
var deferreds = [];
var pushRuleVectorStateKind = self.state.vectorContentRules.vectorState;
@ -399,7 +399,7 @@ module.exports = React.createClass({
}
}
q.all(deferreds).done(function(resps) {
Promise.all(deferreds).done(function(resps) {
self._refreshFromServer();
}, onError);
}, onError);
@ -431,7 +431,9 @@ module.exports = React.createClass({
'global', kind, LEGACY_RULES[rule.rule_id], portLegacyActions(rule.actions)
).then( function() {
return cli.deletePushRule('global', kind, rule.rule_id);
})
}).catch( (e) => {
console.warn(`Error when porting legacy rule: ${e}`);
});
}(kind, rule));
}
}
@ -440,7 +442,7 @@ module.exports = React.createClass({
if (needsUpdate.length > 0) {
// If some of the rules need to be ported then wait for the porting
// to happen and then fetch the rules again.
return q.allSettled(needsUpdate).then( function() {
return Promise.all(needsUpdate).then( function() {
return cli.getPushRules();
});
} else {
@ -594,7 +596,7 @@ module.exports = React.createClass({
self.setState({pushers: resp.pushers});
});
q.all([pushRulesPromise, pushersPromise]).then(function() {
Promise.all([pushRulesPromise, pushersPromise]).then(function() {
self.setState({
phase: self.phases.DISPLAY
});

View file

@ -41,6 +41,7 @@
@import "./matrix-react-sdk/views/messages/_RoomAvatarEvent.scss";
@import "./matrix-react-sdk/views/messages/_TextualEvent.scss";
@import "./matrix-react-sdk/views/messages/_UnknownBody.scss";
@import "./matrix-react-sdk/views/rooms/_AppsDrawer.scss";
@import "./matrix-react-sdk/views/rooms/_Autocomplete.scss";
@import "./matrix-react-sdk/views/rooms/_EntityTile.scss";
@import "./matrix-react-sdk/views/rooms/_EventTile.scss";
@ -56,9 +57,7 @@
@import "./matrix-react-sdk/views/rooms/_RoomSettings.scss";
@import "./matrix-react-sdk/views/rooms/_RoomTile.scss";
@import "./matrix-react-sdk/views/rooms/_SearchableEntityList.scss";
@import "./matrix-react-sdk/views/rooms/_TabCompleteBar.scss";
@import "./matrix-react-sdk/views/rooms/_TopUnreadMessagesBar.scss";
@import "./matrix-react-sdk/views/rooms/_AppsDrawer.scss";
@import "./matrix-react-sdk/views/settings/_DevicesPanel.scss";
@import "./matrix-react-sdk/views/settings/_IntegrationsManager.scss";
@import "./matrix-react-sdk/views/voip/_CallView.scss";

View file

@ -140,11 +140,6 @@ limitations under the License.
cursor: pointer;
}
.mx_RoomStatusBar_tabCompleteBar {
padding-top: 10px;
color: $primary-fg-color;
}
.mx_RoomStatusBar_typingBar {
height: 50px;
line-height: 50px;
@ -155,26 +150,6 @@ limitations under the License.
display: block;
}
.mx_RoomStatusBar_tabCompleteWrapper {
display: flex;
height: 26px;
}
.mx_RoomStatusBar_tabCompleteWrapper .mx_TabCompleteBar {
flex: 1 1 auto;
}
.mx_RoomStatusBar_tabCompleteEol {
flex: 0 0 auto;
color: $accent-color;
}
.mx_RoomStatusBar_tabCompleteEol object {
vertical-align: middle;
margin-right: 8px;
margin-top: -2px;
}
.mx_MatrixChat_useCompactLayout {
.mx_RoomStatusBar {
min-height: 40px;

View file

@ -3,17 +3,21 @@
// --Matthew
.mx_UserPill {
color: white;
color: $accent-fg-color;
background-color: $accent-color;
padding: 2px 8px;
padding: 1px 5px 0px 2px;
border-radius: 16px;
}
.mx_UserPill img, .mx_RoomPill img {
vertical-align: -2px;
margin-right: 1px
}
.mx_RoomPill {
background-color: white;
color: $accent-color;
border: 1px solid $accent-color;
padding: 2px 8px;
background-color: $rte-room-pill-color;
color: $accent-fg-color;
padding: 1px 5px 0px 2px;
border-radius: 16px;
}

View file

@ -76,6 +76,16 @@ limitations under the License.
.mx_AppTileMenuBarWidget {
// pointer-events: none;
cursor: pointer;
width: 10px;
height: 10px;
padding: 1px;
transition-duration: 500ms;
border: 1px solid transparent;
}
.mx_AppTileMenuBarWidget:hover {
border: 1px solid $primary-hairline-color;
border-radius: 2px;
}
.mx_AppTileBody iframe {

View file

@ -100,6 +100,11 @@ limitations under the License.
word-break: break-word;
}
.mx_MessageComposer_input .DraftEditor-root .DraftEditor-editorContainer {
/* Ensure mx_UserPill and mx_RoomPill (see _RichText) are not obscured from the top */
padding-top: 2px;
}
.mx_MessageComposer_input blockquote {
color: $blockquote-fg-color;
margin: 0 0 16px;

View file

@ -1,56 +0,0 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
.mx_TabCompleteBar {
overflow: hidden;
}
.mx_TabCompleteBar_item {
display: inline-block;
margin-right: 15px;
margin-bottom: 2px;
cursor: pointer;
}
.mx_TabCompleteBar_command {
margin-right: 8px;
background-color: $accent-color;
padding-left: 8px;
padding-right: 8px;
padding-top: 2px;
padding-bottom: 2px;
margin-bottom: 6px;
border-radius: 30px;
position: relative;
top: 1px;
}
.mx_TabCompleteBar_command .mx_TabCompleteBar_text {
opacity: 1.0;
vertical-align: initial;
color: $accent-fg-color;
}
.mx_TabCompleteBar_item img {
margin-right: 8px;
vertical-align: middle;
}
.mx_TabCompleteBar_text {
color: $primary-fg-color;
vertical-align: middle;
opacity: 0.5;
}

View file

@ -78,6 +78,7 @@ $voip-accept-color: #80f480;
$rte-bg-color: #e9e9e9;
$rte-code-bg-color: rgba(0, 0, 0, 0.04);
$rte-room-pill-color: #aaa;
// ********************

View file

@ -65,7 +65,7 @@ var sdk = require("matrix-react-sdk");
const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
sdk.loadSkin(require('../component-index'));
var VectorConferenceHandler = require('../VectorConferenceHandler');
var q = require('q');
import Promise from 'bluebird';
var request = require('browser-request');
import * as UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
import * as languageHandler from 'matrix-react-sdk/lib/languageHandler';
@ -187,11 +187,11 @@ var makeRegistrationUrl = function(params) {
window.addEventListener('hashchange', onHashChange);
function getConfig() {
let deferred = q.defer();
function getConfig(configJsonFilename) {
let deferred = Promise.defer();
request(
{ method: "GET", url: "config.json" },
{ method: "GET", url: configJsonFilename },
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
// Lack of a config isn't an error, we should
@ -261,10 +261,20 @@ async function loadApp() {
}
}
// Load the config file. First try to load up a domain-specific config of the
// form "config.$domain.json" and if that fails, fall back to config.json.
let configJson;
let configError;
try {
configJson = await getConfig();
try {
configJson = await getConfig(`config.${document.domain}.json`);
// 404s succeed with an empty json config, so check that there are keys
if (Object.keys(configJson).length === 0) {
throw new Error(); // throw to enter the catch
}
} catch (e) {
configJson = await getConfig("config.json");
}
} catch (e) {
configError = e;
}

View file

@ -20,7 +20,7 @@ limitations under the License.
import VectorBasePlatform, {updateCheckStatusEnum} from './VectorBasePlatform';
import dis from 'matrix-react-sdk/lib/dispatcher';
import { _t } from 'matrix-react-sdk/lib/languageHandler';
import q from 'q';
import Promise from 'bluebird';
import {remote, ipcRenderer} from 'electron';
import rageshake from '../rageshake';
@ -173,7 +173,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
getAppVersion(): Promise<string> {
return q(remote.app.getVersion());
return Promise.resolve(remote.app.getVersion());
}
startUpdateCheck() {
@ -201,7 +201,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
isElectron(): boolean { return true; }
requestNotificationPermission(): Promise<string> {
return q('granted');
return Promise.resolve('granted');
}
reload() {

View file

@ -21,7 +21,7 @@ import VectorBasePlatform, {updateCheckStatusEnum} from './VectorBasePlatform';
import request from 'browser-request';
import dis from 'matrix-react-sdk/lib/dispatcher.js';
import { _t } from 'matrix-react-sdk/lib/languageHandler';
import q from 'q';
import Promise from 'bluebird';
import url from 'url';
import UAParser from 'ua-parser-js';
@ -68,7 +68,7 @@ export default class WebPlatform extends VectorBasePlatform {
// annoyingly, the latest spec says this returns a
// promise, but this is only supported in Chrome 46
// and Firefox 47, so adapt the callback API.
const defer = q.defer();
const defer = Promise.defer();
global.Notification.requestPermission((result) => {
defer.resolve(result);
});
@ -103,7 +103,7 @@ export default class WebPlatform extends VectorBasePlatform {
}
_getVersion(): Promise<string> {
const deferred = q.defer();
const deferred = Promise.defer();
// We add a cachebuster to the request to make sure that we know about
// the most recent version on the origin server. That might not
@ -132,7 +132,7 @@ export default class WebPlatform extends VectorBasePlatform {
getAppVersion(): Promise<string> {
if (this.runningVersion !== null) {
return q(this.runningVersion);
return Promise.resolve(this.runningVersion);
}
return this._getVersion();
}

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import q from "q";
import Promise from 'bluebird';
// This module contains all the code needed to log the console, persist it to
// disk and submit bug reports. Rationale is as follows:
@ -116,7 +116,7 @@ class IndexedDBLogStore {
*/
connect() {
let req = this.indexedDB.open("logs");
return q.Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
req.onsuccess = (event) => {
this.db = event.target.result;
// Periodically flush logs to local storage / indexeddb
@ -193,7 +193,7 @@ class IndexedDBLogStore {
}
// there is no flush promise or there was but it has finished, so do
// a brand new one, destroying the chain which may have been built up.
this.flushPromise = q.Promise((resolve, reject) => {
this.flushPromise = new Promise((resolve, reject) => {
if (!this.db) {
// not connected yet or user rejected access for us to r/w to
// the db.
@ -277,7 +277,7 @@ class IndexedDBLogStore {
}
function deleteLogs(id) {
return q.Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
const txn = db.transaction(
["logs", "logslastmod"], "readwrite"
);
@ -375,7 +375,7 @@ class IndexedDBLogStore {
*/
function selectQuery(store, keyRange, resultMapper) {
const query = store.openCursor(keyRange);
return q.Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
let results = [];
query.onerror = (event) => {
reject(new Error("Query failed: " + event.target.errorCode));

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import pako from 'pako';
import q from "q";
import Promise from 'bluebird';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
@ -100,7 +100,7 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
}
function _submitReport(endpoint, body, progressCallback) {
const deferred = q.defer();
const deferred = Promise.defer();
const req = new XMLHttpRequest();
req.open("POST", endpoint);