Merge pull request #634 from matrix-org/dbkr/use_js_sdk_eslint

Use an eslint config based on the js-sdk
This commit is contained in:
Richard van der Hoff 2017-01-20 15:18:58 +00:00 committed by GitHub
commit f1bb07729f
110 changed files with 357 additions and 411 deletions

117
.eslintrc
View file

@ -1,117 +0,0 @@
{
"parser": "babel-eslint",
"plugins": [
"react",
"flowtype"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"impliedStrict": true
}
},
"env": {
"browser": true,
"amd": true,
"es6": true,
"node": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"rules": {
"no-undef": ["warn"],
"global-strict": ["off"],
"no-extra-semi": ["warn"],
"no-underscore-dangle": ["off"],
"no-console": ["off"],
"no-unused-vars": ["off"],
"no-trailing-spaces": ["warn", {
"skipBlankLines": true
}],
"no-unreachable": ["warn"],
"no-spaced-func": ["warn"],
"no-new-func": ["error"],
"no-new-wrappers": ["error"],
"no-invalid-regexp": ["error"],
"no-extra-bind": ["error"],
"no-magic-numbers": ["error", {
"ignore": [-1, 0, 1], // usually used in array/string indexing
"ignoreArrayIndexes": true,
"enforceConst": true,
"detectObjects": true
}],
"consistent-return": ["error"],
"valid-jsdoc": ["error"],
"no-use-before-define": ["error"],
"camelcase": ["warn"],
"array-callback-return": ["error"],
"dot-location": ["warn", "property"],
"guard-for-in": ["error"],
"no-useless-call": ["warn"],
"no-useless-escape": ["warn"],
"no-useless-concat": ["warn"],
"brace-style": ["warn", "1tbs"],
"comma-style": ["warn", "last"],
"space-before-function-paren": ["warn", "never"],
"space-before-blocks": ["warn", "always"],
"keyword-spacing": ["warn", {
"before": true,
"after": true
}],
// dangling commas required, but only for multiline objects/arrays
"comma-dangle": ["warn", "always-multiline"],
// always === instead of ==, unless dealing with null/undefined
"eqeqeq": ["error", "smart"],
// always use curly braces, even with single statements
"curly": ["error", "all"],
// phasing out var in favour of let/const is a good idea
"no-var": ["warn"],
// always require semicolons
"semi": ["error", "always"],
// prefer rest and spread over the Old Ways
"prefer-spread": ["warn"],
"prefer-rest-params": ["warn"],
/** react **/
// bind or arrow function in props causes performance issues
"react/jsx-no-bind": ["error", {
"ignoreRefs": true
}],
"react/jsx-key": ["error"],
"react/prefer-stateless-function": ["warn"],
/** flowtype **/
"flowtype/require-parameter-type": [
1,
{
"excludeArrowFunctions": true
}
],
"flowtype/define-flow-type": 1,
"flowtype/require-return-type": [
1,
"always",
{
"annotateUndefined": "never",
"excludeArrowFunctions": true
}
],
"flowtype/space-after-type-colon": [
1,
"always"
],
"flowtype/space-before-type-colon": [
1,
"never"
]
},
"settings": {
"flowtype": {
"onlyFilesWithFlowAnnotation": true
}
}
}

62
.eslintrc.js Normal file
View file

@ -0,0 +1,62 @@
module.exports = {
parser: "babel-eslint",
extends: ["./node_modules/matrix-js-sdk/.eslintrc.js"],
plugins: [
"react",
"flowtype",
],
env: {
es6: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
}
},
rules: {
/** react **/
// This just uses the react plugin to help eslint known when
// variables have been used in JSX
"react/jsx-uses-vars": "error",
// bind or arrow function in props causes performance issues
"react/jsx-no-bind": ["error", {
"ignoreRefs": true,
}],
"react/jsx-key": ["error"],
/** flowtype **/
"flowtype/require-parameter-type": ["warn", {
"excludeArrowFunctions": true,
}],
"flowtype/define-flow-type": "warn",
"flowtype/require-return-type": ["warn",
"always",
{
"annotateUndefined": "never",
"excludeArrowFunctions": true,
}
],
"flowtype/space-after-type-colon": ["warn", "always"],
"flowtype/space-before-type-colon": ["warn", "never"],
/*
* things that are errors in the js-sdk config that the current
* code does not adhere to, turned down to warn
*/
"max-len": ["warn"],
"valid-jsdoc": ["warn"],
"new-cap": ["warn"],
"key-spacing": ["warn"],
"arrow-parens": ["warn"],
"prefer-const": ["warn"],
// crashes currently: https://github.com/eslint/eslint/issues/6274
"generator-star-spacing": "off",
},
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
},
},
};

View file

@ -74,7 +74,7 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.5.2", "babel-cli": "^6.5.2",
"babel-core": "^6.14.0", "babel-core": "^6.14.0",
"babel-eslint": "^6.1.0", "babel-eslint": "^6.1.2",
"babel-loader": "^6.2.5", "babel-loader": "^6.2.5",
"babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-async-to-generator": "^6.16.0", "babel-plugin-transform-async-to-generator": "^6.16.0",
@ -86,9 +86,10 @@
"babel-preset-es2016": "^6.11.3", "babel-preset-es2016": "^6.11.3",
"babel-preset-es2017": "^6.14.0", "babel-preset-es2017": "^6.14.0",
"babel-preset-react": "^6.11.1", "babel-preset-react": "^6.11.1",
"eslint": "^2.13.1", "eslint": "^3.13.1",
"eslint-plugin-flowtype": "^2.17.0", "eslint-config-google": "^0.7.1",
"eslint-plugin-react": "^6.2.1", "eslint-plugin-flowtype": "^2.30.0",
"eslint-plugin-react": "^6.9.0",
"expect": "^1.16.0", "expect": "^1.16.0",
"json-loader": "^0.5.3", "json-loader": "^0.5.3",
"karma": "^0.13.22", "karma": "^0.13.22",

View file

@ -21,7 +21,7 @@ var MatrixClientPeg = require("./MatrixClientPeg");
* optionally, the identity servers. * optionally, the identity servers.
* *
* This involves getting an email token from the identity server to "prove" that * This involves getting an email token from the identity server to "prove" that
* the client owns the given email address, which is then passed to the * the client owns the given email address, which is then passed to the
* add threepid API on the homeserver. * add threepid API on the homeserver.
*/ */
class AddThreepid { class AddThreepid {

View file

@ -49,12 +49,12 @@ module.exports = {
}, },
defaultAvatarUrlForString: function(s) { defaultAvatarUrlForString: function(s) {
var images = [ '76cfa6', '50e2c2', 'f4c371' ]; var images = ['76cfa6', '50e2c2', 'f4c371'];
var total = 0; var total = 0;
for (var i = 0; i < s.length; ++i) { for (var i = 0; i < s.length; ++i) {
total += s.charCodeAt(i); total += s.charCodeAt(i);
} }
return 'img/' + images[total % images.length] + '.png'; return 'img/' + images[total % images.length] + '.png';
} }
} };

View file

@ -41,7 +41,7 @@ export default class BasePlatform {
* Returns true if the platform supports displaying * Returns true if the platform supports displaying
* notifications, otherwise false. * notifications, otherwise false.
*/ */
supportsNotifications() : boolean { supportsNotifications(): boolean {
return false; return false;
} }
@ -49,7 +49,7 @@ export default class BasePlatform {
* Returns true if the application currently has permission * Returns true if the application currently has permission
* to display notifications. Otherwise false. * to display notifications. Otherwise false.
*/ */
maySendNotifications() : boolean { maySendNotifications(): boolean {
return false; return false;
} }
@ -60,7 +60,7 @@ export default class BasePlatform {
* that is 'granted' if the user allowed the request or * that is 'granted' if the user allowed the request or
* 'denied' otherwise. * 'denied' otherwise.
*/ */
requestNotificationPermission() : Promise<string> { requestNotificationPermission(): Promise<string> {
} }
displayNotification(title: string, msg: string, avatarUrl: string, room: Object) { displayNotification(title: string, msg: string, avatarUrl: string, room: Object) {

View file

@ -159,10 +159,10 @@ function _setCallState(call, roomId, status) {
calls[roomId] = call; calls[roomId] = call;
if (status === "ringing") { if (status === "ringing") {
play("ringAudio") play("ringAudio");
} }
else if (call && call.call_state === "ringing") { else if (call && call.call_state === "ringing") {
pause("ringAudio") pause("ringAudio");
} }
if (call) { if (call) {

View file

@ -256,7 +256,7 @@ function uploadFile(matrixClient, roomId, file) {
}); });
}); });
} else { } else {
const basePromise = matrixClient.uploadContent(file); const basePromise = matrixClient.uploadContent(file);
const promise1 = basePromise.then(function(url) { const promise1 = basePromise.then(function(url) {
// If the attachment isn't encrypted then include the URL directly. // If the attachment isn't encrypted then include the URL directly.
return {"url": url}; return {"url": url};

View file

@ -48,5 +48,5 @@ module.exports = {
//return pad(date.getHours()) + ':' + pad(date.getMinutes()); //return pad(date.getHours()) + ':' + pad(date.getMinutes());
return ('00' + date.getHours()).slice(-2) + ':' + ('00' + date.getMinutes()).slice(-2); return ('00' + date.getHours()).slice(-2) + ':' + ('00' + date.getMinutes()).slice(-2);
} }
} };

View file

@ -136,6 +136,6 @@ module.exports = {
fromUsers: function(users, showInviteButton, inviteFn) { fromUsers: function(users, showInviteButton, inviteFn) {
return users.map(function(u) { return users.map(function(u) {
return new UserEntity(u, showInviteButton, inviteFn); return new UserEntity(u, showInviteButton, inviteFn);
}) });
} }
}; };

View file

@ -91,16 +91,16 @@ var sanitizeHtmlParams = {
], ],
allowedAttributes: { allowedAttributes: {
// custom ones first: // custom ones first:
font: [ 'color' ], // custom to matrix font: ['color'], // custom to matrix
a: [ 'href', 'name', 'target', 'rel' ], // remote target: custom to matrix a: ['href', 'name', 'target', 'rel'], // remote target: custom to matrix
// We don't currently allow img itself by default, but this // We don't currently allow img itself by default, but this
// would make sense if we did // would make sense if we did
img: [ 'src' ], img: ['src'],
}, },
// Lots of these won't come up by default because we don't allow them // Lots of these won't come up by default because we don't allow them
selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ], selfClosing: ['img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta'],
// URL schemes we permit // URL schemes we permit
allowedSchemes: [ 'http', 'https', 'ftp', 'mailto' ], allowedSchemes: ['http', 'https', 'ftp', 'mailto'],
// DO NOT USE. sanitize-html allows all URL starting with '//' // DO NOT USE. sanitize-html allows all URL starting with '//'
// so this will always allow links to whatever scheme the // so this will always allow links to whatever scheme the

View file

@ -53,5 +53,5 @@ module.exports = {
return Math.floor(heightMulti * fullHeight); return Math.floor(heightMulti * fullHeight);
} }
}, },
} };

View file

@ -55,7 +55,7 @@ export function inviteToRoom(roomId, addr) {
* @returns Promise * @returns Promise
*/ */
export function inviteMultipleToRoom(roomId, addrs) { export function inviteMultipleToRoom(roomId, addrs) {
this.inviter = new MultiInviter(roomId); const inviter = new MultiInviter(roomId);
return this.inviter.invite(addrs); return inviter.invite(addrs);
} }

View file

@ -18,7 +18,7 @@ import q from 'q';
import Matrix from 'matrix-js-sdk'; import Matrix from 'matrix-js-sdk';
import MatrixClientPeg from './MatrixClientPeg'; import MatrixClientPeg from './MatrixClientPeg';
import Notifier from './Notifier' import Notifier from './Notifier';
import UserActivity from './UserActivity'; import UserActivity from './UserActivity';
import Presence from './Presence'; import Presence from './Presence';
import dis from './dispatcher'; import dis from './dispatcher';
@ -140,7 +140,7 @@ function _loginWithToken(queryParams, defaultDeviceDisplayName) {
homeserverUrl: queryParams.homeserver, homeserverUrl: queryParams.homeserver,
identityServerUrl: queryParams.identityServer, identityServerUrl: queryParams.identityServer,
guest: false, guest: false,
}) });
}, (err) => { }, (err) => {
console.error("Failed to log in with login token: " + err + " " + console.error("Failed to log in with login token: " + err + " " +
err.data); err.data);

View file

@ -49,9 +49,9 @@ export default class Markdown {
dummy_renderer[k] = setNotPlain; dummy_renderer[k] = setNotPlain;
} }
// text and paragraph are just text // text and paragraph are just text
dummy_renderer.text = function(t) { return t; } dummy_renderer.text = function(t) { return t; };
dummy_renderer.softbreak = function(t) { return t; } dummy_renderer.softbreak = function(t) { return t; };
dummy_renderer.paragraph = function(t) { return t; } dummy_renderer.paragraph = function(t) { return t; };
const dummy_parser = new commonmark.Parser(); const dummy_parser = new commonmark.Parser();
dummy_renderer.render(dummy_parser.parse(this.input)); dummy_renderer.render(dummy_parser.parse(this.input));
@ -70,12 +70,12 @@ export default class Markdown {
// its own p tag to keep them as separate paragraphs. // its own p tag to keep them as separate paragraphs.
var par = node; var par = node;
while (par.parent) { while (par.parent) {
par = par.parent par = par.parent;
} }
if (par.firstChild != par.lastChild) { if (par.firstChild != par.lastChild) {
real_paragraph.call(this, node, entering); real_paragraph.call(this, node, entering);
} }
} };
var parsed = this.parser.parse(this.input); var parsed = this.parser.parse(this.input);
var rendered = this.renderer.render(parsed); var rendered = this.renderer.render(parsed);
@ -94,7 +94,7 @@ export default class Markdown {
this.renderer.out = function(s) { this.renderer.out = function(s) {
// The `lit` function adds a string literal to the output buffer. // The `lit` function adds a string literal to the output buffer.
this.lit(s); this.lit(s);
} };
this.renderer.paragraph = function(node, entering) { this.renderer.paragraph = function(node, entering) {
// If there is only one top level node, just return the // If there is only one top level node, just return the
@ -112,7 +112,7 @@ export default class Markdown {
this.lit('\n\n'); this.lit('\n\n');
} }
} }
} };
var parsed = this.parser.parse(this.input); var parsed = this.parser.parse(this.input);
var rendered = this.renderer.render(parsed); var rendered = this.renderer.render(parsed);

View file

@ -36,7 +36,7 @@ const AsyncWrapper = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
component: null, component: null,
} };
}, },
componentWillMount: function() { componentWillMount: function() {
@ -82,8 +82,8 @@ module.exports = {
return container; return container;
}, },
createDialog: function (Element, props, className) { createDialog: function(Element, props, className) {
return this.createDialogAsync((cb) => {cb(Element)}, props, className); return this.createDialogAsync((cb) => {cb(Element);}, props, className);
}, },
/** /**
@ -105,7 +105,7 @@ module.exports = {
* *
* @param {String} className CSS class to apply to the modal wrapper * @param {String} className CSS class to apply to the modal wrapper
*/ */
createDialogAsync: function (loader, props, className) { createDialogAsync: function(loader, props, className) {
var self = this; var self = this;
// never call this via modal.close() from onFinished() otherwise it will loop // never call this via modal.close() from onFinished() otherwise it will loop
var closeDialog = function() { var closeDialog = function() {

View file

@ -53,7 +53,7 @@ var Notifier = {
if (!msg) return; if (!msg) return;
var title; var title;
if (!ev.sender || room.name == ev.sender.name) { if (!ev.sender || room.name == ev.sender.name) {
title = room.name; title = room.name;
// notificationMessageForEvent includes sender, // notificationMessageForEvent includes sender,
// but we already have the sender here // but we already have the sender here
@ -88,7 +88,7 @@ var Notifier = {
if (e) { if (e) {
e.load(); e.load();
e.play(); e.play();
}; }
}, },
start: function() { start: function() {

View file

@ -64,7 +64,7 @@ module.exports.getKeyValueArrayDiffs = function(before, after) {
} else if (itemDelta[item] === -1) { } else if (itemDelta[item] === -1) {
results.push({ place: "del", key: muxedKey, val: item }); results.push({ place: "del", key: muxedKey, val: item });
} else { } else {
// itemDelta of 0 means it was unchanged between before/after // itemDelta of 0 means it was unchanged between before/after
} }
}); });
break; break;

View file

@ -111,7 +111,7 @@ class Presence {
this.timer = setTimeout(function() { this.timer = setTimeout(function() {
self._onUnavailableTimerFire(); self._onUnavailableTimerFire();
}, UNAVAILABLE_TIME_MS); }, UNAVAILABLE_TIME_MS);
} }
} }
module.exports = new Presence(); module.exports = new Presence();

View file

@ -12,7 +12,7 @@ import {
SelectionState, SelectionState,
Entity, Entity,
} from 'draft-js'; } from 'draft-js';
import * as sdk from './index'; import * as sdk from './index';
import * as emojione from 'emojione'; import * as emojione from 'emojione';
import {stateToHTML} from 'draft-js-export-html'; import {stateToHTML} from 'draft-js-export-html';
import {SelectionRange} from "./autocomplete/Autocompleter"; import {SelectionRange} from "./autocomplete/Autocompleter";
@ -109,7 +109,7 @@ export function getScopedRTDecorators(scope: any): CompositeDecorator {
return <span className="mx_UserPill">{avatar}{props.children}</span>; return <span className="mx_UserPill">{avatar}{props.children}</span>;
} }
}; };
let roomDecorator = { let roomDecorator = {
strategy: (contentBlock, callback) => { strategy: (contentBlock, callback) => {
findWithRegex(ROOM_REGEX, contentBlock, callback); findWithRegex(ROOM_REGEX, contentBlock, callback);

View file

@ -26,7 +26,7 @@ function tsOfNewestEvent(room) {
} }
function mostRecentActivityFirst(roomList) { function mostRecentActivityFirst(roomList) {
return roomList.sort(function(a,b) { return roomList.sort(function(a, b) {
return tsOfNewestEvent(b) - tsOfNewestEvent(a); return tsOfNewestEvent(b) - tsOfNewestEvent(a);
}); });
} }

View file

@ -146,7 +146,7 @@ function isRuleForRoom(roomId, rule) {
} }
const cond = rule.conditions[0]; const cond = rule.conditions[0];
if ( if (
cond.kind == 'event_match' && cond.kind == 'event_match' &&
cond.key == 'room_id' && cond.key == 'room_id' &&
cond.pattern == roomId cond.pattern == roomId
) { ) {

View file

@ -37,7 +37,7 @@ export function getOnlyOtherMember(room, me) {
if (joinedMembers.length === 2) { if (joinedMembers.length === 2) {
return joinedMembers.filter(function(m) { return joinedMembers.filter(function(m) {
return m.userId !== me.userId return m.userId !== me.userId;
})[0]; })[0];
} }

View file

@ -371,7 +371,7 @@ const onMessage = function(event) {
}, (err) => { }, (err) => {
console.error(err); console.error(err);
sendError(event, "Failed to lookup current room."); sendError(event, "Failed to lookup current room.");
}) });
}; };
module.exports = { module.exports = {

View file

@ -41,7 +41,7 @@ class Command {
} }
getUsage() { getUsage() {
return "Usage: " + this.getCommandWithArgs() return "Usage: " + this.getCommandWithArgs();
} }
} }
@ -84,7 +84,7 @@ var commands = {
var matches = args.match(/^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}))( +(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})))?$/); var matches = args.match(/^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}))( +(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})))?$/);
if (matches) { if (matches) {
Tinter.tint(matches[1], matches[4]); Tinter.tint(matches[1], matches[4]);
var colorScheme = {} var colorScheme = {};
colorScheme.primary_color = matches[1]; colorScheme.primary_color = matches[1];
if (matches[4]) { if (matches[4]) {
colorScheme.secondary_color = matches[4]; colorScheme.secondary_color = matches[4];
@ -288,7 +288,7 @@ var commands = {
// helpful aliases // helpful aliases
var aliases = { var aliases = {
j: "join" j: "join"
} };
module.exports = { module.exports = {
/** /**
@ -331,9 +331,9 @@ module.exports = {
// Return all the commands plus /me and /markdown which aren't handled like normal commands // Return all the commands plus /me and /markdown which aren't handled like normal commands
var cmds = Object.keys(commands).sort().map(function(cmdKey) { var cmds = Object.keys(commands).sort().map(function(cmdKey) {
return commands[cmdKey]; return commands[cmdKey];
}) });
cmds.push(new Command("me", "<action>", function(){})); cmds.push(new Command("me", "<action>", function() {}));
cmds.push(new Command("markdown", "<on|off>", function(){})); cmds.push(new Command("markdown", "<on|off>", function() {}));
return cmds; return cmds;
} }

View file

@ -112,7 +112,7 @@ class TabComplete {
return; return;
} }
// ES6 destructuring; ignore first element (the complete match) // ES6 destructuring; ignore first element (the complete match)
var [ , boundaryGroup, partialGroup] = res; var [, boundaryGroup, partialGroup] = res;
if (partialGroup.length === 0 && passive) { if (partialGroup.length === 0 && passive) {
return; return;
@ -254,7 +254,7 @@ class TabComplete {
if (ev.ctrlKey || ev.metaKey || ev.altKey) return; if (ev.ctrlKey || ev.metaKey || ev.altKey) return;
// tab key has been pressed at this point // tab key has been pressed at this point
this.handleTabPress(false, ev.shiftKey) this.handleTabPress(false, ev.shiftKey);
// prevent the default TAB operation (typically focus shifting) // prevent the default TAB operation (typically focus shifting)
ev.preventDefault(); ev.preventDefault();
@ -386,6 +386,6 @@ class TabComplete {
this.memberTabOrder[ev.getSender()] = this.memberOrderSeq++; this.memberTabOrder[ev.getSender()] = this.memberOrderSeq++;
} }
} }
}; }
module.exports = TabComplete; module.exports = TabComplete;

View file

@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var React = require("react");
var sdk = require("./index"); var sdk = require("./index");
class Entry { class Entry {
@ -90,7 +89,7 @@ CommandEntry.fromCommands = function(commandArray) {
return commandArray.map(function(cmd) { return commandArray.map(function(cmd) {
return new CommandEntry(cmd.getCommand(), cmd.getCommandWithArgs()); return new CommandEntry(cmd.getCommand(), cmd.getCommandWithArgs());
}); });
} };
class MemberEntry extends Entry { class MemberEntry extends Entry {
constructor(member) { constructor(member) {
@ -119,7 +118,7 @@ MemberEntry.fromMemberList = function(members) {
return members.map(function(m) { return members.map(function(m) {
return new MemberEntry(m); return new MemberEntry(m);
}); });
} };
module.exports.Entry = Entry; module.exports.Entry = Entry;
module.exports.MemberEntry = MemberEntry; module.exports.MemberEntry = MemberEntry;

View file

@ -75,7 +75,6 @@ function textForMemberEvent(ev) {
return targetName + " joined the room."; return targetName + " joined the room.";
} }
} }
return '';
case 'leave': case 'leave':
if (ev.getSender() === ev.getStateKey()) { if (ev.getSender() === ev.getStateKey()) {
if (ConferenceHandler && ConferenceHandler.isConferenceUser(ev.getStateKey())) { if (ConferenceHandler && ConferenceHandler.isConferenceUser(ev.getStateKey())) {
@ -203,4 +202,4 @@ module.exports = {
if (!hdlr) return ""; if (!hdlr) return "";
return hdlr(ev); return hdlr(ev);
} }
} };

View file

@ -14,9 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var dis = require("./dispatcher");
var sdk = require("./index");
// FIXME: these vars should be bundled up and attached to // FIXME: these vars should be bundled up and attached to
// module.exports otherwise this will break when included by both // module.exports otherwise this will break when included by both
// react-sdk and apps layered on top. // react-sdk and apps layered on top.
@ -152,7 +149,7 @@ function hexToRgb(color) {
function rgbToHex(rgb) { function rgbToHex(rgb) {
var val = (rgb[0] << 16) | (rgb[1] << 8) | rgb[2]; var val = (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
return '#' + (0x1000000 + val).toString(16).slice(1) return '#' + (0x1000000 + val).toString(16).slice(1);
} }
// List of functions to call when the tint changes. // List of functions to call when the tint changes.
@ -187,7 +184,7 @@ module.exports = {
} }
if (!secondaryColor) { if (!secondaryColor) {
var x = 0.16; // average weighting factor calculated from vector green & light green const x = 0.16; // average weighting factor calculated from vector green & light green
var rgb = hexToRgb(primaryColor); var rgb = hexToRgb(primaryColor);
rgb[0] = x * rgb[0] + (1 - x) * 255; rgb[0] = x * rgb[0] + (1 - x) * 255;
rgb[1] = x * rgb[1] + (1 - x) * 255; rgb[1] = x * rgb[1] + (1 - x) * 255;
@ -196,7 +193,7 @@ module.exports = {
} }
if (!tertiaryColor) { if (!tertiaryColor) {
var x = 0.19; const x = 0.19;
var rgb1 = hexToRgb(primaryColor); var rgb1 = hexToRgb(primaryColor);
var rgb2 = hexToRgb(secondaryColor); var rgb2 = hexToRgb(secondaryColor);
rgb1[0] = x * rgb1[0] + (1 - x) * rgb2[0]; rgb1[0] = x * rgb1[0] + (1 - x) * rgb2[0];

View file

@ -76,7 +76,7 @@ module.exports = React.createClass({
var startStyles = self.props.startStyles; var startStyles = self.props.startStyles;
if (startStyles.length > 0) { if (startStyles.length > 0) {
var startStyle = startStyles[0] var startStyle = startStyles[0];
newProps.style = startStyle; newProps.style = startStyle;
// console.log("mounted@startstyle0: "+JSON.stringify(startStyle)); // console.log("mounted@startstyle0: "+JSON.stringify(startStyle));
} }
@ -105,7 +105,7 @@ module.exports = React.createClass({
) { ) {
var startStyles = this.props.startStyles; var startStyles = this.props.startStyles;
var transitionOpts = this.props.enterTransitionOpts; var transitionOpts = this.props.enterTransitionOpts;
var domNode = ReactDom.findDOMNode(node); const domNode = ReactDom.findDOMNode(node);
// start from startStyle 1: 0 is the one we gave it // start from startStyle 1: 0 is the one we gave it
// to start with, so now we animate 1 etc. // to start with, so now we animate 1 etc.
for (var i = 1; i < startStyles.length; ++i) { for (var i = 1; i < startStyles.length; ++i) {
@ -145,7 +145,7 @@ module.exports = React.createClass({
// and the FAQ entry, "Preventing memory leaks when // and the FAQ entry, "Preventing memory leaks when
// creating/destroying large numbers of elements" // creating/destroying large numbers of elements"
// (https://github.com/julianshapiro/velocity/issues/47) // (https://github.com/julianshapiro/velocity/issues/47)
var domNode = ReactDom.findDOMNode(this.nodes[k]); const domNode = ReactDom.findDOMNode(this.nodes[k]);
Velocity.Utilities.removeData(domNode); Velocity.Utilities.removeData(domNode);
} }
this.nodes[k] = node; this.nodes[k] = node;

View file

@ -6,10 +6,12 @@ function bounce( p ) {
var pow2, var pow2,
bounce = 4; bounce = 4;
while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {
// just sets pow2
}
return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
} }
Velocity.Easings.easeOutBounce = function(p) { Velocity.Easings.easeOutBounce = function(p) {
return 1 - bounce(1 - p); return 1 - bounce(1 - p);
} };

View file

@ -46,4 +46,4 @@ module.exports = {
return names.join(', ') + ' and ' + lastPerson + ' are typing'; return names.join(', ') + ' and ' + lastPerson + ' are typing';
} }
} }
} };

View file

@ -26,7 +26,7 @@ export default class AutocompleteProvider {
} }
commandRegex.lastIndex = 0; commandRegex.lastIndex = 0;
let match; let match;
while ((match = commandRegex.exec(query)) != null) { while ((match = commandRegex.exec(query)) != null) {
let matchStart = match.index, let matchStart = match.index,

View file

@ -83,7 +83,7 @@ export default class CommandProvider extends AutocompleteProvider {
static getInstance(): CommandProvider { static getInstance(): CommandProvider {
if (instance == null) if (instance == null)
instance = new CommandProvider(); {instance = new CommandProvider();}
return instance; return instance;
} }

View file

@ -13,7 +13,7 @@ export default class DuckDuckGoProvider extends AutocompleteProvider {
constructor() { constructor() {
super(DDG_REGEX); super(DDG_REGEX);
} }
static getQueryUri(query: String) { static getQueryUri(query: String) {
return `https://api.duckduckgo.com/?q=${encodeURIComponent(query)}` return `https://api.duckduckgo.com/?q=${encodeURIComponent(query)}`
+ `&format=json&no_redirect=1&no_html=1&t=${encodeURIComponent(REFERRER)}`; + `&format=json&no_redirect=1&no_html=1&t=${encodeURIComponent(REFERRER)}`;

View file

@ -44,7 +44,7 @@ export default class EmojiProvider extends AutocompleteProvider {
static getInstance() { static getInstance() {
if (instance == null) if (instance == null)
instance = new EmojiProvider(); {instance = new EmojiProvider();}
return instance; return instance;
} }

View file

@ -52,12 +52,12 @@ export default class RoomProvider extends AutocompleteProvider {
getName() { getName() {
return '💬 Rooms'; return '💬 Rooms';
} }
static getInstance() { static getInstance() {
if (instance == null) { if (instance == null) {
instance = new RoomProvider(); instance = new RoomProvider();
} }
return instance; return instance;
} }

View file

@ -47,7 +47,7 @@ module.exports = {
return container; return container;
}, },
createMenu: function (Element, props) { createMenu: function(Element, props) {
var self = this; var self = this;
var closeMenu = function() { var closeMenu = function() {
@ -78,15 +78,15 @@ module.exports = {
.mx_ContextualMenu_chevron_right:after { .mx_ContextualMenu_chevron_right:after {
border-left-color: ${props.menuColour}; border-left-color: ${props.menuColour};
} }
` `;
} }
var chevron = null; var chevron = null;
if (props.left) { if (props.left) {
chevron = <div style={chevronOffset} className="mx_ContextualMenu_chevron_left"></div> chevron = <div style={chevronOffset} className="mx_ContextualMenu_chevron_left"></div>;
position.left = props.left; position.left = props.left;
} else { } else {
chevron = <div style={chevronOffset} className="mx_ContextualMenu_chevron_right"></div> chevron = <div style={chevronOffset} className="mx_ContextualMenu_chevron_right"></div>;
position.right = props.right; position.right = props.right;
} }

View file

@ -118,7 +118,7 @@ module.exports = React.createClass({
var self = this; var self = this;
deferred.then(function (resp) { deferred.then(function(resp) {
self.setState({ self.setState({
phase: self.phases.CREATED, phase: self.phases.CREATED,
}); });
@ -210,7 +210,7 @@ module.exports = React.createClass({
onAliasChanged: function(alias) { onAliasChanged: function(alias) {
this.setState({ this.setState({
alias: alias alias: alias
}) });
}, },
onEncryptChanged: function(ev) { onEncryptChanged: function(ev) {

View file

@ -35,7 +35,7 @@ var FilePanel = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
timelineSet: null, timelineSet: null,
} };
}, },
componentWillMount: function() { componentWillMount: function() {

View file

@ -160,8 +160,8 @@ export default React.createClass({
collapsedRhs={this.props.collapse_rhs} collapsedRhs={this.props.collapse_rhs}
ConferenceHandler={this.props.ConferenceHandler} ConferenceHandler={this.props.ConferenceHandler}
scrollStateMap={this._scrollStateMap} scrollStateMap={this._scrollStateMap}
/> />;
if (!this.props.collapse_rhs) right_panel = <RightPanel roomId={this.props.currentRoomId} opacity={this.props.sideOpacity} /> if (!this.props.collapse_rhs) right_panel = <RightPanel roomId={this.props.currentRoomId} opacity={this.props.sideOpacity} />;
break; break;
case PageTypes.UserSettings: case PageTypes.UserSettings:
@ -170,28 +170,28 @@ export default React.createClass({
brand={this.props.config.brand} brand={this.props.config.brand}
collapsedRhs={this.props.collapse_rhs} collapsedRhs={this.props.collapse_rhs}
enableLabs={this.props.config.enableLabs} enableLabs={this.props.config.enableLabs}
/> />;
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/> if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>;
break; break;
case PageTypes.CreateRoom: case PageTypes.CreateRoom:
page_element = <CreateRoom page_element = <CreateRoom
onRoomCreated={this.props.onRoomCreated} onRoomCreated={this.props.onRoomCreated}
collapsedRhs={this.props.collapse_rhs} collapsedRhs={this.props.collapse_rhs}
/> />;
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/> if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>;
break; break;
case PageTypes.RoomDirectory: case PageTypes.RoomDirectory:
page_element = <RoomDirectory page_element = <RoomDirectory
collapsedRhs={this.props.collapse_rhs} collapsedRhs={this.props.collapse_rhs}
config={this.props.config.roomDirectory} config={this.props.config.roomDirectory}
/> />;
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/> if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>;
break; break;
case PageTypes.UserView: case PageTypes.UserView:
page_element = null; // deliberately null for now page_element = null; // deliberately null for now
right_panel = <RightPanel userId={this.props.viewUserId} opacity={this.props.sideOpacity} /> right_panel = <RightPanel userId={this.props.viewUserId} opacity={this.props.sideOpacity} />;
break; break;
} }

View file

@ -77,7 +77,7 @@ module.exports = React.createClass({
getChildContext: function() { getChildContext: function() {
return { return {
appConfig: this.props.config, appConfig: this.props.config,
} };
}, },
getInitialState: function() { getInitialState: function() {
@ -1038,7 +1038,7 @@ module.exports = React.createClass({
{...this.props} {...this.props}
{...this.state} {...this.state}
/> />
) );
} else if (this.state.logged_in) { } else if (this.state.logged_in) {
// we think we are logged in, but are still waiting for the /sync to complete // we think we are logged in, but are still waiting for the /sync to complete
var Spinner = sdk.getComponent('elements.Spinner'); var Spinner = sdk.getComponent('elements.Spinner');

View file

@ -19,7 +19,7 @@ var ReactDOM = require("react-dom");
var dis = require("../../dispatcher"); var dis = require("../../dispatcher");
var sdk = require('../../index'); var sdk = require('../../index');
var MatrixClientPeg = require('../../MatrixClientPeg') var MatrixClientPeg = require('../../MatrixClientPeg');
const MILLIS_IN_DAY = 86400000; const MILLIS_IN_DAY = 86400000;
@ -282,7 +282,7 @@ module.exports = React.createClass({
var isMembershipChange = (e) => var isMembershipChange = (e) =>
e.getType() === 'm.room.member' e.getType() === 'm.room.member'
&& ['join', 'leave'].indexOf(e.getContent().membership) !== -1 && ['join', 'leave'].indexOf(e.getContent().membership) !== -1
&& (!e.getPrevContent() || e.getContent().membership !== e.getPrevContent().membership); && (!e.getPrevContent() || e.getContent().membership !== e.getPrevContent().membership);
for (i = 0; i < this.props.events.length; i++) { for (i = 0; i < this.props.events.length; i++) {
var mxEv = this.props.events[i]; var mxEv = this.props.events[i];
@ -340,7 +340,7 @@ module.exports = React.createClass({
prevEvent = e; prevEvent = e;
return ret; return ret;
} }
).reduce((a,b) => a.concat(b)); ).reduce((a, b) => a.concat(b));
if (eventTiles.length === 0) { if (eventTiles.length === 0) {
eventTiles = null; eventTiles = null;

View file

@ -48,7 +48,7 @@ if (DEBUG) {
// using bind means that we get to keep useful line numbers in the console // using bind means that we get to keep useful line numbers in the console
var debuglog = console.log.bind(console); var debuglog = console.log.bind(console);
} else { } else {
var debuglog = function () {}; var debuglog = function() {};
} }
module.exports = React.createClass({ module.exports = React.createClass({
@ -146,7 +146,7 @@ module.exports = React.createClass({
showTopUnreadMessagesBar: false, showTopUnreadMessagesBar: false,
auxPanelMaxHeight: undefined, auxPanelMaxHeight: undefined,
} };
}, },
componentWillMount: function() { componentWillMount: function() {
@ -674,8 +674,9 @@ module.exports = React.createClass({
}, },
onSearchResultsFillRequest: function(backwards) { onSearchResultsFillRequest: function(backwards) {
if (!backwards) if (!backwards) {
return q(false); return q(false);
}
if (this.state.searchResults.next_batch) { if (this.state.searchResults.next_batch) {
debuglog("requesting more search results"); debuglog("requesting more search results");
@ -758,7 +759,7 @@ module.exports = React.createClass({
}).then(() => { }).then(() => {
var sign_url = this.props.thirdPartyInvite ? this.props.thirdPartyInvite.inviteSignUrl : undefined; var sign_url = this.props.thirdPartyInvite ? this.props.thirdPartyInvite.inviteSignUrl : undefined;
return MatrixClientPeg.get().joinRoom(this.props.roomAddress, return MatrixClientPeg.get().joinRoom(this.props.roomAddress,
{ inviteSignUrl: sign_url } ) { inviteSignUrl: sign_url } );
}).then(function(resp) { }).then(function(resp) {
var roomId = resp.roomId; var roomId = resp.roomId;
@ -962,7 +963,7 @@ module.exports = React.createClass({
// For overlapping highlights, // For overlapping highlights,
// favour longer (more specific) terms first // favour longer (more specific) terms first
highlights = highlights.sort(function(a, b) { highlights = highlights.sort(function(a, b) {
return b.length - a.length }); return b.length - a.length; });
self.setState({ self.setState({
searchHighlights: highlights, searchHighlights: highlights,
@ -1025,7 +1026,7 @@ module.exports = React.createClass({
if (scrollPanel) { if (scrollPanel) {
scrollPanel.checkScroll(); scrollPanel.checkScroll();
} }
} };
var lastRoomId; var lastRoomId;
@ -1090,7 +1091,7 @@ module.exports = React.createClass({
} }
this.refs.room_settings.save().then((results) => { this.refs.room_settings.save().then((results) => {
var fails = results.filter(function(result) { return result.state !== "fulfilled" }); var fails = results.filter(function(result) { return result.state !== "fulfilled"; });
console.log("Settings saved with %s errors", fails.length); console.log("Settings saved with %s errors", fails.length);
if (fails.length) { if (fails.length) {
fails.forEach(function(result) { fails.forEach(function(result) {
@ -1099,7 +1100,7 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to save settings", title: "Failed to save settings",
description: fails.map(function(result) { return result.reason }).join("\n"), description: fails.map(function(result) { return result.reason; }).join("\n"),
}); });
// still editing room settings // still editing room settings
} }
@ -1183,7 +1184,7 @@ module.exports = React.createClass({
this.setState({ searching: true }); this.setState({ searching: true });
}, },
onCancelSearchClick: function () { onCancelSearchClick: function() {
this.setState({ this.setState({
searching: false, searching: false,
searchResults: null, searchResults: null,
@ -1208,8 +1209,9 @@ module.exports = React.createClass({
// decide whether or not the top 'unread messages' bar should be shown // decide whether or not the top 'unread messages' bar should be shown
_updateTopUnreadMessagesBar: function() { _updateTopUnreadMessagesBar: function() {
if (!this.refs.messagePanel) if (!this.refs.messagePanel) {
return; return;
}
var pos = this.refs.messagePanel.getReadMarkerPosition(); var pos = this.refs.messagePanel.getReadMarkerPosition();
@ -1498,7 +1500,7 @@ module.exports = React.createClass({
if (ContentMessages.getCurrentUploads().length > 0) { if (ContentMessages.getCurrentUploads().length > 0) {
var UploadBar = sdk.getComponent('structures.UploadBar'); var UploadBar = sdk.getComponent('structures.UploadBar');
statusBar = <UploadBar room={this.state.room} /> statusBar = <UploadBar room={this.state.room} />;
} else if (!this.state.searchResults) { } else if (!this.state.searchResults) {
var RoomStatusBar = sdk.getComponent('structures.RoomStatusBar'); var RoomStatusBar = sdk.getComponent('structures.RoomStatusBar');
@ -1513,7 +1515,7 @@ module.exports = React.createClass({
onCancelAllClick={this.onCancelAllClick} onCancelAllClick={this.onCancelAllClick}
onScrollToBottomClick={this.jumpToLiveTimeline} onScrollToBottomClick={this.jumpToLiveTimeline}
onResize={this.onChildResize} onResize={this.onChildResize}
/> />;
} }
var aux = null; var aux = null;
@ -1569,7 +1571,7 @@ module.exports = React.createClass({
messageComposer = messageComposer =
<MessageComposer <MessageComposer
room={this.state.room} onResize={this.onChildResize} uploadFile={this.uploadFile} room={this.state.room} onResize={this.onChildResize} uploadFile={this.uploadFile}
callState={this.state.callState} tabComplete={this.tabComplete} opacity={ this.props.opacity }/> callState={this.state.callState} tabComplete={this.tabComplete} opacity={ this.props.opacity }/>;
} }
// TODO: Why aren't we storing the term/scope/count in this format // TODO: Why aren't we storing the term/scope/count in this format
@ -1597,14 +1599,14 @@ module.exports = React.createClass({
<img src={call.isLocalVideoMuted() ? "img/video-unmute.svg" : "img/video-mute.svg"} <img src={call.isLocalVideoMuted() ? "img/video-unmute.svg" : "img/video-mute.svg"}
alt={call.isLocalVideoMuted() ? "Click to unmute video" : "Click to mute video"} alt={call.isLocalVideoMuted() ? "Click to unmute video" : "Click to mute video"}
width="31" height="27"/> width="31" height="27"/>
</div> </div>;
} }
voiceMuteButton = voiceMuteButton =
<div className="mx_RoomView_voipButton" onClick={this.onMuteAudioClick}> <div className="mx_RoomView_voipButton" onClick={this.onMuteAudioClick}>
<img src={call.isMicrophoneMuted() ? "img/voice-unmute.svg" : "img/voice-mute.svg"} <img src={call.isMicrophoneMuted() ? "img/voice-unmute.svg" : "img/voice-mute.svg"}
alt={call.isMicrophoneMuted() ? "Click to unmute audio" : "Click to mute audio"} alt={call.isMicrophoneMuted() ? "Click to unmute audio" : "Click to mute audio"}
width="21" height="26"/> width="21" height="26"/>
</div> </div>;
// wrap the existing status bar into a 'callStatusBar' which adds more knobs. // wrap the existing status bar into a 'callStatusBar' which adds more knobs.
statusBar = statusBar =
@ -1614,7 +1616,7 @@ module.exports = React.createClass({
{ zoomButton } { zoomButton }
{ statusBar } { statusBar }
<TintableSvg className="mx_RoomView_voipChevron" src="img/voip-chevron.svg" width="22" height="17"/> <TintableSvg className="mx_RoomView_voipChevron" src="img/voip-chevron.svg" width="22" height="17"/>
</div> </div>;
} }
// if we have search results, we keep the messagepanel (so that it preserves its // if we have search results, we keep the messagepanel (so that it preserves its

View file

@ -34,7 +34,7 @@ if (DEBUG_SCROLL) {
// using bind means that we get to keep useful line numbers in the console // using bind means that we get to keep useful line numbers in the console
var debuglog = console.log.bind(console); var debuglog = console.log.bind(console);
} else { } else {
var debuglog = function () {}; var debuglog = function() {};
} }
/* This component implements an intelligent scrolling list. /* This component implements an intelligent scrolling list.
@ -600,7 +600,7 @@ module.exports = React.createClass({
stuckAtBottom: false, stuckAtBottom: false,
trackedScrollToken: node.dataset.scrollToken, trackedScrollToken: node.dataset.scrollToken,
pixelOffset: wrapperRect.bottom - boundingRect.bottom, pixelOffset: wrapperRect.bottom - boundingRect.bottom,
} };
debuglog("Saved scroll state", this.scrollState); debuglog("Saved scroll state", this.scrollState);
return; return;
} }

View file

@ -38,7 +38,7 @@ if (DEBUG) {
// using bind means that we get to keep useful line numbers in the console // using bind means that we get to keep useful line numbers in the console
var debuglog = console.log.bind(console); var debuglog = console.log.bind(console);
} else { } else {
var debuglog = function () {}; var debuglog = function() {};
} }
/* /*
@ -322,7 +322,7 @@ var TimelinePanel = React.createClass({
}); });
}, },
onMessageListScroll: function () { onMessageListScroll: function() {
if (this.props.onScroll) { if (this.props.onScroll) {
this.props.onScroll(); this.props.onScroll();
} }
@ -387,7 +387,7 @@ var TimelinePanel = React.createClass({
// if we're at the end of the live timeline, append the pending events // if we're at the end of the live timeline, append the pending events
if (this.props.timelineSet.room && !this._timelineWindow.canPaginate(EventTimeline.FORWARDS)) { if (this.props.timelineSet.room && !this._timelineWindow.canPaginate(EventTimeline.FORWARDS)) {
events.push(... this.props.timelineSet.room.getPendingEvents()); events.push(...this.props.timelineSet.room.getPendingEvents());
} }
var updatedState = {events: events}; var updatedState = {events: events};
@ -564,8 +564,9 @@ var TimelinePanel = React.createClass({
// first find where the current RM is // first find where the current RM is
for (var i = 0; i < events.length; i++) { for (var i = 0; i < events.length; i++) {
if (events[i].getId() == this.state.readMarkerEventId) if (events[i].getId() == this.state.readMarkerEventId) {
break; break;
}
} }
if (i >= events.length) { if (i >= events.length) {
return; return;
@ -644,7 +645,7 @@ var TimelinePanel = React.createClass({
var tl = this.props.timelineSet.getTimelineForEvent(rmId); var tl = this.props.timelineSet.getTimelineForEvent(rmId);
var rmTs; var rmTs;
if (tl) { if (tl) {
var event = tl.getEvents().find((e) => { return e.getId() == rmId }); var event = tl.getEvents().find((e) => { return e.getId() == rmId; });
if (event) { if (event) {
rmTs = event.getTs(); rmTs = event.getTs();
} }
@ -821,7 +822,7 @@ var TimelinePanel = React.createClass({
description: message, description: message,
onFinished: onFinished, onFinished: onFinished,
}); });
} };
var prom = this._timelineWindow.load(eventId, INITIAL_SIZE); var prom = this._timelineWindow.load(eventId, INITIAL_SIZE);
@ -843,7 +844,7 @@ var TimelinePanel = React.createClass({
timelineLoading: true, timelineLoading: true,
}); });
prom = prom.then(onLoaded, onError) prom = prom.then(onLoaded, onError);
} }
prom.done(); prom.done();
@ -868,7 +869,7 @@ var TimelinePanel = React.createClass({
// if we're at the end of the live timeline, append the pending events // if we're at the end of the live timeline, append the pending events
if (!this._timelineWindow.canPaginate(EventTimeline.FORWARDS)) { if (!this._timelineWindow.canPaginate(EventTimeline.FORWARDS)) {
events.push(... this.props.timelineSet.getPendingEvents()); events.push(...this.props.timelineSet.getPendingEvents());
} }
return events; return events;
@ -930,8 +931,9 @@ var TimelinePanel = React.createClass({
_getCurrentReadReceipt: function(ignoreSynthesized) { _getCurrentReadReceipt: function(ignoreSynthesized) {
var client = MatrixClientPeg.get(); var client = MatrixClientPeg.get();
// the client can be null on logout // the client can be null on logout
if (client == null) if (client == null) {
return null; return null;
}
var myUserId = client.credentials.userId; var myUserId = client.credentials.userId;
return this.props.timelineSet.room.getEventReadUpTo(myUserId, ignoreSynthesized); return this.props.timelineSet.room.getEventReadUpTo(myUserId, ignoreSynthesized);

View file

@ -57,7 +57,7 @@ module.exports = React.createClass({displayName: 'UploadBar',
// }]; // }];
if (uploads.length == 0) { if (uploads.length == 0) {
return <div /> return <div />;
} }
var upload; var upload;
@ -68,7 +68,7 @@ module.exports = React.createClass({displayName: 'UploadBar',
} }
} }
if (!upload) { if (!upload) {
return <div /> return <div />;
} }
var innerProgressStyle = { var innerProgressStyle = {
@ -76,7 +76,7 @@ module.exports = React.createClass({displayName: 'UploadBar',
}; };
var uploadedSize = filesize(upload.loaded); var uploadedSize = filesize(upload.loaded);
var totalSize = filesize(upload.total); var totalSize = filesize(upload.total);
if (uploadedSize.replace(/^.* /,'') === totalSize.replace(/^.* /,'')) { if (uploadedSize.replace(/^.* /, '') === totalSize.replace(/^.* /, '')) {
uploadedSize = uploadedSize.replace(/ .*/, ''); uploadedSize = uploadedSize.replace(/ .*/, '');
} }

View file

@ -346,8 +346,8 @@ module.exports = React.createClass({
this.setState({email_add_pending: false}); this.setState({email_add_pending: false});
if (err.errcode == 'M_THREEPID_AUTH_FAILED') { if (err.errcode == 'M_THREEPID_AUTH_FAILED') {
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
var message = "Unable to verify email address. " var message = "Unable to verify email address. ";
message += "Please check your email and click on the link it contains. Once this is done, click continue." message += "Please check your email and click on the link it contains. Once this is done, click continue.";
Modal.createDialog(QuestionDialog, { Modal.createDialog(QuestionDialog, {
title: "Verification Pending", title: "Verification Pending",
description: message, description: message,
@ -417,7 +417,7 @@ module.exports = React.createClass({
<label htmlFor="urlPreviewsDisabled"> <label htmlFor="urlPreviewsDisabled">
Disable inline URL previews by default Disable inline URL previews by default
</label> </label>
</div> </div>;
}, },
_renderSyncedSetting: function(setting) { _renderSyncedSetting: function(setting) {
@ -430,7 +430,7 @@ module.exports = React.createClass({
<label htmlFor={ setting.id }> <label htmlFor={ setting.id }>
{ setting.label } { setting.label }
</label> </label>
</div> </div>;
}, },
_renderThemeSelector: function(setting) { _renderThemeSelector: function(setting) {
@ -442,7 +442,7 @@ module.exports = React.createClass({
defaultChecked={ this._syncedSettings[setting.id] === setting.value } defaultChecked={ this._syncedSettings[setting.id] === setting.value }
onChange={ e => { onChange={ e => {
if (e.target.checked) { if (e.target.checked) {
UserSettingsStore.setSyncedSetting(setting.id, setting.value) UserSettingsStore.setSyncedSetting(setting.id, setting.value);
} }
dis.dispatch({ dis.dispatch({
action: 'set_theme', action: 'set_theme',
@ -454,7 +454,7 @@ module.exports = React.createClass({
<label htmlFor={ setting.id + "_" + setting.value }> <label htmlFor={ setting.id + "_" + setting.value }>
{ setting.label } { setting.label }
</label> </label>
</div> </div>;
}, },
_renderCryptoInfo: function() { _renderCryptoInfo: function() {
@ -467,8 +467,8 @@ module.exports = React.createClass({
<h3>Cryptography</h3> <h3>Cryptography</h3>
<div className="mx_UserSettings_section mx_UserSettings_cryptoSection"> <div className="mx_UserSettings_section mx_UserSettings_cryptoSection">
<ul> <ul>
<li><label>Device ID:</label> <span><code>{deviceId}</code></span></li> <li><label>Device ID:</label> <span><code>{deviceId}</code></span></li>
<li><label>Device key:</label> <span><code><b>{identityKey}</b></code></span></li> <li><label>Device key:</label> <span><code><b>{identityKey}</b></code></span></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -485,7 +485,7 @@ module.exports = React.createClass({
); );
}, },
_renderLabs: function () { _renderLabs: function() {
// default to enabled if undefined // default to enabled if undefined
if (this.props.enableLabs === false) return null; if (this.props.enableLabs === false) return null;
@ -521,7 +521,7 @@ module.exports = React.createClass({
{features} {features}
</div> </div>
</div> </div>
) );
}, },
_renderDeactivateAccount: function() { _renderDeactivateAccount: function() {

View file

@ -58,7 +58,7 @@ module.exports = React.createClass({
this.setState({ this.setState({
progress: null progress: null
}); });
}) });
}, },
onVerify: function(ev) { onVerify: function(ev) {
@ -71,7 +71,7 @@ module.exports = React.createClass({
this.setState({ progress: "complete" }); this.setState({ progress: "complete" });
}, (err) => { }, (err) => {
this.showErrorDialog(err.message); this.showErrorDialog(err.message);
}) });
}, },
onSubmitForm: function(ev) { onSubmitForm: function(ev) {
@ -129,7 +129,7 @@ module.exports = React.createClass({
var resetPasswordJsx; var resetPasswordJsx;
if (this.state.progress === "sending_email") { if (this.state.progress === "sending_email") {
resetPasswordJsx = <Spinner /> resetPasswordJsx = <Spinner />;
} }
else if (this.state.progress === "sent_email") { else if (this.state.progress === "sent_email") {
resetPasswordJsx = ( resetPasswordJsx = (

View file

@ -173,7 +173,7 @@ module.exports = React.createClass({
}, },
_getCurrentFlowStep: function() { _getCurrentFlowStep: function() {
return this._loginLogic ? this._loginLogic.getCurrentFlowStep() : null return this._loginLogic ? this._loginLogic.getCurrentFlowStep() : null;
}, },
_setStateFromError: function(err, isLoginAttempt) { _setStateFromError: function(err, isLoginAttempt) {
@ -195,7 +195,7 @@ module.exports = React.createClass({
} }
let errorText = "Error: Problem communicating with the given homeserver " + let errorText = "Error: Problem communicating with the given homeserver " +
(errCode ? "(" + errCode + ")" : "") (errCode ? "(" + errCode + ")" : "");
if (err.cors === 'rejected') { if (err.cors === 'rejected') {
if (window.location.protocol === 'https:' && if (window.location.protocol === 'https:' &&
@ -258,7 +258,7 @@ module.exports = React.createClass({
loginAsGuestJsx = loginAsGuestJsx =
<a className="mx_Login_create" onClick={this._onLoginAsGuestClick} href="#"> <a className="mx_Login_create" onClick={this._onLoginAsGuestClick} href="#">
Login as guest Login as guest
</a> </a>;
} }
var returnToAppJsx; var returnToAppJsx;
@ -266,7 +266,7 @@ module.exports = React.createClass({
returnToAppJsx = returnToAppJsx =
<a className="mx_Login_create" onClick={this.props.onCancelClick} href="#"> <a className="mx_Login_create" onClick={this.props.onCancelClick} href="#">
Return to app Return to app
</a> </a>;
} }
return ( return (

View file

@ -333,7 +333,7 @@ module.exports = React.createClass({
returnToAppJsx = returnToAppJsx =
<a className="mx_Login_create" onClick={this.props.onCancelClick} href="#"> <a className="mx_Login_create" onClick={this.props.onCancelClick} href="#">
Return to app Return to app
</a> </a>;
} }
return ( return (

View file

@ -41,7 +41,7 @@ module.exports = React.createClass({
height: 40, height: 40,
resizeMethod: 'crop', resizeMethod: 'crop',
defaultToInitialLetter: true defaultToInitialLetter: true
} };
}, },
getInitialState: function() { getInitialState: function() {

View file

@ -42,7 +42,7 @@ module.exports = React.createClass({
height: 40, height: 40,
resizeMethod: 'crop', resizeMethod: 'crop',
viewUserOnClick: false, viewUserOnClick: false,
} };
}, },
getInitialState: function() { getInitialState: function() {
@ -64,7 +64,7 @@ module.exports = React.createClass({
props.width, props.width,
props.height, props.height,
props.resizeMethod) props.resizeMethod)
} };
}, },
render: function() { render: function() {
@ -78,7 +78,7 @@ module.exports = React.createClass({
action: 'view_user', action: 'view_user',
member: this.props.member, member: this.props.member,
}); });
} };
} }
return ( return (

View file

@ -39,7 +39,7 @@ module.exports = React.createClass({
height: 36, height: 36,
resizeMethod: 'crop', resizeMethod: 'crop',
oobData: {}, oobData: {},
} };
}, },
getInitialState: function() { getInitialState: function() {
@ -51,7 +51,7 @@ module.exports = React.createClass({
componentWillReceiveProps: function(newProps) { componentWillReceiveProps: function(newProps) {
this.setState({ this.setState({
urls: this.getImageUrls(newProps) urls: this.getImageUrls(newProps)
}) });
}, },
getImageUrls: function(props) { getImageUrls: function(props) {

View file

@ -40,7 +40,7 @@ module.exports = React.createClass({
}, },
onValueChanged: function(ev) { onValueChanged: function(ev) {
this.props.onChange(ev.target.value) this.props.onChange(ev.target.value);
}, },
render: function() { render: function() {

View file

@ -171,7 +171,7 @@ module.exports = React.createClass({
inviteList: inviteList, inviteList: inviteList,
queryList: [], queryList: [],
}); });
} };
}, },
onClick: function(index) { onClick: function(index) {
@ -402,10 +402,10 @@ module.exports = React.createClass({
var error; var error;
var addressSelector; var addressSelector;
if (this.state.error) { if (this.state.error) {
error = <div className="mx_ChatInviteDialog_error">You have entered an invalid contact. Try using their Matrix ID or email address.</div> error = <div className="mx_ChatInviteDialog_error">You have entered an invalid contact. Try using their Matrix ID or email address.</div>;
} else { } else {
addressSelector = ( addressSelector = (
<AddressSelector ref={(ref) => {this.addressSelector = ref}} <AddressSelector ref={(ref) => {this.addressSelector = ref;}}
addressList={ this.state.queryList } addressList={ this.state.queryList }
onSelected={ this.onSelected } onSelected={ this.onSelected }
truncateAt={ TRUNCATE_QUERY_LIST } /> truncateAt={ TRUNCATE_QUERY_LIST } />

View file

@ -81,7 +81,7 @@ export default class DeactivateAccountDialog extends React.Component {
if (this.state.errStr) { if (this.state.errStr) {
error = <div className="error"> error = <div className="error">
{this.state.errStr} {this.state.errStr}
</div> </div>;
passwordBoxClass = 'error'; passwordBoxClass = 'error';
} }
@ -92,7 +92,7 @@ export default class DeactivateAccountDialog extends React.Component {
if (!this.state.busy) { if (!this.state.busy) {
cancelButton = <button onClick={this._onCancel} autoFocus={true}> cancelButton = <button onClick={this._onCancel} autoFocus={true}>
Cancel Cancel
</button> </button>;
} }
return ( return (

View file

@ -129,7 +129,7 @@ module.exports = React.createClass({
_maxSelected: function(list) { _maxSelected: function(list) {
var listSize = list.length === 0 ? 0 : list.length - 1; var listSize = list.length === 0 ? 0 : list.length - 1;
var maxSelected = listSize > (this.props.truncateAt - 1) ? (this.props.truncateAt - 1) : listSize var maxSelected = listSize > (this.props.truncateAt - 1) ? (this.props.truncateAt - 1) : listSize;
return maxSelected; return maxSelected;
}, },
@ -140,7 +140,7 @@ module.exports = React.createClass({
}); });
return ( return (
<div className={classes} ref={(ref) => {this.scrollElement = ref}}> <div className={classes} ref={(ref) => {this.scrollElement = ref;}}>
{ this.createAddressListTiles() } { this.createAddressListTiles() }
</div> </div>
); );

View file

@ -108,7 +108,7 @@ module.exports = React.createClass({
info = ( info = (
<div className={unknownMxClasses}>{ this.props.address }</div> <div className={unknownMxClasses}>{ this.props.address }</div>
); );
} else if (email) { } else if (email) {
var emailClasses = classNames({ var emailClasses = classNames({
"mx_AddressTile_email": true, "mx_AddressTile_email": true,
"mx_AddressTile_justified": this.props.justified, "mx_AddressTile_justified": this.props.justified,

View file

@ -42,8 +42,8 @@ export default React.createClass({
<div className="mx_UserSettings_cryptoSection"> <div className="mx_UserSettings_cryptoSection">
<ul> <ul>
<li><label>Device name:</label> <span>{ this.props.device.getDisplayName() }</span></li> <li><label>Device name:</label> <span>{ this.props.device.getDisplayName() }</span></li>
<li><label>Device ID:</label> <span><code>{ this.props.device.deviceId}</code></span></li> <li><label>Device ID:</label> <span><code>{ this.props.device.deviceId}</code></span></li>
<li><label>Device key:</label> <span><code><b>{ this.props.device.getFingerprint() }</b></code></span></li> <li><label>Device key:</label> <span><code><b>{ this.props.device.getFingerprint() }</b></code></span></li>
</ul> </ul>
</div> </div>
<p> <p>

View file

@ -57,7 +57,7 @@ module.exports = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
phase: this.Phases.Display, phase: this.Phases.Display,
} };
}, },
componentWillReceiveProps: function(nextProps) { componentWillReceiveProps: function(nextProps) {
@ -164,7 +164,7 @@ module.exports = React.createClass({
this.setState({ this.setState({
phase: this.Phases.Edit, phase: this.Phases.Edit,
}) });
}, },
onFocus: function(ev) { onFocus: function(ev) {
@ -197,9 +197,9 @@ module.exports = React.createClass({
sel.removeAllRanges(); sel.removeAllRanges();
if (this.props.blurToCancel) if (this.props.blurToCancel)
this.cancelEdit(); {this.cancelEdit();}
else else
this.onFinish(ev); {this.onFinish(ev);}
this.showPlaceholder(!this.value); this.showPlaceholder(!this.value);
}, },

View file

@ -73,7 +73,7 @@ module.exports = React.createClass({
getValue: function() { getValue: function() {
var value; var value;
if (this.refs.select) { if (this.refs.select) {
value = reverseRoles[ this.refs.select.value ]; value = reverseRoles[this.refs.select.value];
if (this.refs.custom) { if (this.refs.custom) {
if (value === undefined) value = parseInt( this.refs.custom.value ); if (value === undefined) value = parseInt( this.refs.custom.value );
} }
@ -86,10 +86,10 @@ module.exports = React.createClass({
if (this.state.custom) { if (this.state.custom) {
var input; var input;
if (this.props.disabled) { if (this.props.disabled) {
input = <span>{ this.props.value }</span> input = <span>{ this.props.value }</span>;
} }
else { else {
input = <input ref="custom" type="text" size="3" defaultValue={ this.props.value } onBlur={ this.onCustomBlur } onKeyDown={ this.onCustomKeyDown }/> input = <input ref="custom" type="text" size="3" defaultValue={ this.props.value } onBlur={ this.onCustomBlur } onKeyDown={ this.onCustomKeyDown }/>;
} }
customPicker = <span> of { input }</span>; customPicker = <span> of { input }</span>;
} }
@ -115,7 +115,7 @@ module.exports = React.createClass({
<option value="Moderator">Moderator (50)</option> <option value="Moderator">Moderator (50)</option>
<option value="Admin">Admin (100)</option> <option value="Admin">Admin (100)</option>
<option value="Custom">Custom level</option> <option value="Custom">Custom level</option>
</select> </select>;
} }
return ( return (

View file

@ -35,4 +35,4 @@ module.exports = React.createClass({
<div className="mx_ProgressBar"><div className="mx_ProgressBar_fill" style={progressStyle}></div></div> <div className="mx_ProgressBar"><div className="mx_ProgressBar_fill" style={progressStyle}></div></div>
); );
} }
}); });

View file

@ -55,7 +55,7 @@ module.exports = React.createClass({
overflowJsx = this.props.createOverflowElement( overflowJsx = this.props.createOverflowElement(
overflowCount, childCount overflowCount, childCount
); );
// cut out the overflow elements // cut out the overflow elements
childArray.splice(childCount - overflowCount, overflowCount); childArray.splice(childCount - overflowCount, overflowCount);
childsJsx = childArray; // use what is left childsJsx = childArray; // use what is left

View file

@ -56,7 +56,7 @@ module.exports = React.createClass({
<div> <div>
<ul className="mx_UserSelector_UserIdList" ref="list"> <ul className="mx_UserSelector_UserIdList" ref="list">
{this.props.selected_users.map(function(user_id, i) { {this.props.selected_users.map(function(user_id, i) {
return <li key={user_id}>{user_id} - <span onClick={function() {self.removeUser(user_id);}}>X</span></li> return <li key={user_id}>{user_id} - <span onClick={function() {self.removeUser(user_id);}}>X</span></li>;
})} })}
</ul> </ul>
<input type="text" ref="user_id_input" defaultValue="" className="mx_UserSelector_userIdInput" placeholder="ex. @bob:example.com"/> <input type="text" ref="user_id_input" defaultValue="" className="mx_UserSelector_userIdInput" placeholder="ex. @bob:example.com"/>

View file

@ -52,7 +52,7 @@ module.exports = React.createClass({
this._onCaptchaLoaded(); this._onCaptchaLoaded();
} else { } else {
console.log("Loading recaptcha script..."); console.log("Loading recaptcha script...");
window.mx_on_recaptcha_loaded = () => {this._onCaptchaLoaded()}; window.mx_on_recaptcha_loaded = () => {this._onCaptchaLoaded();};
var protocol = global.location.protocol; var protocol = global.location.protocol;
if (protocol === "file:") { if (protocol === "file:") {
var warning = document.createElement('div'); var warning = document.createElement('div');
@ -101,7 +101,7 @@ module.exports = React.createClass({
} catch (e) { } catch (e) {
this.setState({ this.setState({
errorText: e.toString(), errorText: e.toString(),
}) });
} }
}, },

View file

@ -70,7 +70,7 @@ export const PasswordAuthEntry = React.createClass({
}); });
}, },
_onPasswordFieldChange: function (ev) { _onPasswordFieldChange: function(ev) {
// enable the submit button iff the password is non-empty // enable the submit button iff the password is non-empty
this.props.setSubmitButtonEnabled(Boolean(ev.target.value)); this.props.setSubmitButtonEnabled(Boolean(ev.target.value));
}, },
@ -209,4 +209,4 @@ export function getEntryComponentForLoginType(loginType) {
} }
} }
return FallbackAuthEntry; return FallbackAuthEntry;
}; }

View file

@ -169,7 +169,7 @@ module.exports = React.createClass({
validateField: function(field_id) { validateField: function(field_id) {
var pwd1 = this.refs.password.value.trim(); var pwd1 = this.refs.password.value.trim();
var pwd2 = this.refs.passwordConfirm.value.trim() var pwd2 = this.refs.passwordConfirm.value.trim();
switch (field_id) { switch (field_id) {
case FIELD_EMAIL: case FIELD_EMAIL:
@ -283,7 +283,7 @@ module.exports = React.createClass({
autoFocus={true} placeholder="Email address (optional)" autoFocus={true} placeholder="Email address (optional)"
defaultValue={this.props.defaultEmail} defaultValue={this.props.defaultEmail}
className={this._classForField(FIELD_EMAIL, 'mx_Login_field')} className={this._classForField(FIELD_EMAIL, 'mx_Login_field')}
onBlur={function() {self.validateField(FIELD_EMAIL)}} onBlur={function() {self.validateField(FIELD_EMAIL);}}
value={self.state.email}/> value={self.state.email}/>
{emailSuffix ? <input className="mx_Login_field" value={emailSuffix} disabled/> : null } {emailSuffix ? <input className="mx_Login_field" value={emailSuffix} disabled/> : null }
</div> </div>
@ -293,8 +293,8 @@ module.exports = React.createClass({
<select <select
defaultValue="-1" defaultValue="-1"
className="mx_Login_field" className="mx_Login_field"
onBlur={function() {self.validateField(FIELD_EMAIL)}} onBlur={function() {self.validateField(FIELD_EMAIL);}}
onChange={function(ev) {self.onSelectTeam(ev.target.value)}} onChange={function(ev) {self.onSelectTeam(ev.target.value);}}
> >
<option key="-1" value="-1">No team</option> <option key="-1" value="-1">No team</option>
{this.props.teamsConfig.teams.map((t, index) => { {this.props.teamsConfig.teams.map((t, index) => {
@ -327,7 +327,7 @@ module.exports = React.createClass({
var placeholderUserName = "User name"; var placeholderUserName = "User name";
if (this.props.guestUsername) { if (this.props.guestUsername) {
placeholderUserName += " (default: " + this.props.guestUsername + ")" placeholderUserName += " (default: " + this.props.guestUsername + ")";
} }
return ( return (
@ -341,20 +341,20 @@ module.exports = React.createClass({
<input type="text" ref="username" <input type="text" ref="username"
placeholder={ placeholderUserName } defaultValue={this.props.defaultUsername} placeholder={ placeholderUserName } defaultValue={this.props.defaultUsername}
className={this._classForField(FIELD_USERNAME, 'mx_Login_field')} className={this._classForField(FIELD_USERNAME, 'mx_Login_field')}
onBlur={function() {self.validateField(FIELD_USERNAME)}} /> onBlur={function() {self.validateField(FIELD_USERNAME);}} />
<br /> <br />
{ this.props.guestUsername ? { this.props.guestUsername ?
<div className="mx_Login_fieldLabel">Setting a user name will create a fresh account</div> : null <div className="mx_Login_fieldLabel">Setting a user name will create a fresh account</div> : null
} }
<input type="password" ref="password" <input type="password" ref="password"
className={this._classForField(FIELD_PASSWORD, 'mx_Login_field')} className={this._classForField(FIELD_PASSWORD, 'mx_Login_field')}
onBlur={function() {self.validateField(FIELD_PASSWORD)}} onBlur={function() {self.validateField(FIELD_PASSWORD);}}
placeholder="Password" defaultValue={this.props.defaultPassword} /> placeholder="Password" defaultValue={this.props.defaultPassword} />
<br /> <br />
<input type="password" ref="passwordConfirm" <input type="password" ref="passwordConfirm"
placeholder="Confirm password" placeholder="Confirm password"
className={this._classForField(FIELD_PASSWORD_CONFIRM, 'mx_Login_field')} className={this._classForField(FIELD_PASSWORD_CONFIRM, 'mx_Login_field')}
onBlur={function() {self.validateField(FIELD_PASSWORD_CONFIRM)}} onBlur={function() {self.validateField(FIELD_PASSWORD_CONFIRM);}}
defaultValue={this.props.defaultPassword} /> defaultValue={this.props.defaultPassword} />
<br /> <br />
{registerButton} {registerButton}

View file

@ -64,10 +64,10 @@ module.exports = React.createClass({
hs_url: this.props.customHsUrl, hs_url: this.props.customHsUrl,
is_url: this.props.customIsUrl, is_url: this.props.customIsUrl,
// if withToggleButton is false, then show the config all the time given we have no way otherwise of making it visible // if withToggleButton is false, then show the config all the time given we have no way otherwise of making it visible
configVisible: !this.props.withToggleButton || configVisible: !this.props.withToggleButton ||
(this.props.customHsUrl !== this.props.defaultHsUrl) || (this.props.customHsUrl !== this.props.defaultHsUrl) ||
(this.props.customIsUrl !== this.props.defaultIsUrl) (this.props.customIsUrl !== this.props.defaultIsUrl)
} };
}, },
onHomeserverChanged: function(ev) { onHomeserverChanged: function(ev) {

View file

@ -31,7 +31,7 @@ export default class MAudioBody extends React.Component {
decryptedUrl: null, decryptedUrl: null,
decryptedBlob: null, decryptedBlob: null,
error: null, error: null,
} };
} }
onPlayToggle() { onPlayToggle() {
this.setState({ this.setState({

View file

@ -281,7 +281,7 @@ module.exports = React.createClass({
decryptedBlob: blob, decryptedBlob: blob,
}); });
}).catch((err) => { }).catch((err) => {
console.warn("Unable to decrypt attachment: ", err) console.warn("Unable to decrypt attachment: ", err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
description: "Error decrypting attachment" description: "Error decrypting attachment"
}); });
@ -372,7 +372,7 @@ module.exports = React.createClass({
var extra = text ? (': ' + text) : ''; var extra = text ? (': ' + text) : '';
return <span className="mx_MFileBody"> return <span className="mx_MFileBody">
Invalid file{extra} Invalid file{extra}
</span> </span>;
} }
}, },
}); });

View file

@ -119,7 +119,7 @@ module.exports = React.createClass({
if (content.info.thumbnail_file) { if (content.info.thumbnail_file) {
thumbnailPromise = decryptFile( thumbnailPromise = decryptFile(
content.info.thumbnail_file content.info.thumbnail_file
).then(function (blob) { ).then(function(blob) {
return readBlobAsDataUri(blob); return readBlobAsDataUri(blob);
}); });
} }

View file

@ -111,7 +111,7 @@ module.exports = React.createClass({
this.props.onWidgetLoad(); this.props.onWidgetLoad();
}); });
}).catch((err) => { }).catch((err) => {
console.warn("Unable to decrypt attachment: ", err) console.warn("Unable to decrypt attachment: ", err);
// Set a placeholder image when we can't decrypt the image. // Set a placeholder image when we can't decrypt the image.
this.setState({ this.setState({
error: err, error: err,

View file

@ -200,7 +200,7 @@ module.exports = React.createClass({
global.localStorage.removeItem("hide_preview_" + self.props.mxEvent.getId()); global.localStorage.removeItem("hide_preview_" + self.props.mxEvent.getId());
} }
}, },
} };
}, },
onStarterLinkClick: function(starterLink, ev) { onStarterLinkClick: function(starterLink, ev) {
@ -230,8 +230,8 @@ module.exports = React.createClass({
if (!confirmed) { if (!confirmed) {
return; return;
} }
let width = window.screen.width > 1024 ? 1024 : window.screen.width; let width = window.screen.width > 1024 ? 1024 : window.screen.width;
let height = window.screen.height > 800 ? 800 : window.screen.height; let height = window.screen.height > 800 ? 800 : window.screen.height;
let left = (window.screen.width - width) / 2; let left = (window.screen.width - width) / 2;
let top = (window.screen.height - height) / 2; let top = (window.screen.height - height) / 2;
window.open(completeUrl, '_blank', `height=${height}, width=${width}, top=${top}, left=${left},`); window.open(completeUrl, '_blank', `height=${height}, width=${width}, top=${top}, left=${left},`);

View file

@ -103,13 +103,13 @@ module.exports = React.createClass({
} }
if (oldCanonicalAlias !== this.state.canonicalAlias) { if (oldCanonicalAlias !== this.state.canonicalAlias) {
console.log("AliasSettings: Updating canonical alias"); console.log("AliasSettings: Updating canonical alias");
promises = [ q.all(promises).then( promises = [q.all(promises).then(
MatrixClientPeg.get().sendStateEvent( MatrixClientPeg.get().sendStateEvent(
this.props.roomId, "m.room.canonical_alias", { this.props.roomId, "m.room.canonical_alias", {
alias: this.state.canonicalAlias alias: this.state.canonicalAlias
}, "" }, ""
) )
) ]; )];
} }
return promises; return promises;
@ -144,7 +144,7 @@ module.exports = React.createClass({
// XXX: do we need to deep copy aliases before editing it? // XXX: do we need to deep copy aliases before editing it?
this.state.domainToAliases[domain] = this.state.domainToAliases[domain] || []; this.state.domainToAliases[domain] = this.state.domainToAliases[domain] || [];
this.state.domainToAliases[domain].push(alias); this.state.domainToAliases[domain].push(alias);
this.setState({ this.setState({
domainToAliases: this.state.domainToAliases domainToAliases: this.state.domainToAliases
}); });
@ -152,9 +152,9 @@ module.exports = React.createClass({
this.refs.add_alias.setValue(''); // FIXME this.refs.add_alias.setValue(''); // FIXME
} }
else { else {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Invalid alias format", title: "Invalid alias format",
description: "'" + alias + "' is not a valid format for an alias", description: "'" + alias + "' is not a valid format for an alias",
}); });
} }
@ -168,9 +168,9 @@ module.exports = React.createClass({
this.state.domainToAliases[domain][index] = alias; this.state.domainToAliases[domain][index] = alias;
} }
else { else {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Invalid address format", title: "Invalid address format",
description: "'" + alias + "' is not a valid format for an address", description: "'" + alias + "' is not a valid format for an address",
}); });
} }
@ -183,7 +183,7 @@ module.exports = React.createClass({
// would be to arbitrarily deepcopy to a temp variable and then setState // would be to arbitrarily deepcopy to a temp variable and then setState
// that, but why bother when we can cut this corner. // that, but why bother when we can cut this corner.
var alias = this.state.domainToAliases[domain].splice(index, 1); var alias = this.state.domainToAliases[domain].splice(index, 1);
this.setState({ this.setState({
domainToAliases: this.state.domainToAliases domainToAliases: this.state.domainToAliases
}); });
}, },
@ -310,4 +310,4 @@ module.exports = React.createClass({
</div> </div>
); );
} }
}); });

View file

@ -135,7 +135,7 @@ module.exports = React.createClass({
</div> </div>
); );
} }
var boundClick = this._onColorSchemeChanged.bind(this, i) var boundClick = this._onColorSchemeChanged.bind(this, i);
return ( return (
<div className="mx_RoomSettings_roomColor" <div className="mx_RoomSettings_roomColor"
key={ "room_color_" + i } key={ "room_color_" + i }

View file

@ -121,13 +121,13 @@ module.exports = React.createClass({
onChange={ this.onGlobalDisableUrlPreviewChange } onChange={ this.onGlobalDisableUrlPreviewChange }
checked={ this.state.globalDisableUrlPreview } /> checked={ this.state.globalDisableUrlPreview } />
Disable URL previews by default for participants in this room Disable URL previews by default for participants in this room
</label> </label>;
} }
else { else {
disableRoomPreviewUrls = disableRoomPreviewUrls =
<label> <label>
URL previews are { this.state.globalDisableUrlPreview ? "disabled" : "enabled" } by default for participants in this room. URL previews are { this.state.globalDisableUrlPreview ? "disabled" : "enabled" } by default for participants in this room.
</label> </label>;
} }
return ( return (
@ -154,4 +154,4 @@ module.exports = React.createClass({
); );
} }
}); });

View file

@ -93,8 +93,8 @@ module.exports = React.createClass({
} }
else { else {
joinText = (<span> joinText = (<span>
Join as <a onClick={(event)=>{ this.onConferenceNotificationClick(event, 'voice')}} Join as <a onClick={(event)=>{ this.onConferenceNotificationClick(event, 'voice');}}
href="#">voice</a> or <a onClick={(event)=>{ this.onConferenceNotificationClick(event, 'video') }} href="#">voice</a> or <a onClick={(event)=>{ this.onConferenceNotificationClick(event, 'video'); }}
href="#">video</a>. href="#">video</a>.
</span>); </span>);

View file

@ -149,13 +149,13 @@ module.exports = WithMatrixClient(React.createClass({
this.props.mxEvent.on("Event.decrypted", this._onDecrypted); this.props.mxEvent.on("Event.decrypted", this._onDecrypted);
}, },
componentWillReceiveProps: function (nextProps) { componentWillReceiveProps: function(nextProps) {
if (nextProps.mxEvent !== this.props.mxEvent) { if (nextProps.mxEvent !== this.props.mxEvent) {
this._verifyEvent(nextProps.mxEvent); this._verifyEvent(nextProps.mxEvent);
} }
}, },
shouldComponentUpdate: function (nextProps, nextState) { shouldComponentUpdate: function(nextProps, nextState) {
if (!ObjectUtils.shallowEqual(this.state, nextState)) { if (!ObjectUtils.shallowEqual(this.state, nextState)) {
return true; return true;
} }
@ -259,7 +259,7 @@ module.exports = WithMatrixClient(React.createClass({
onEditClicked: function(e) { onEditClicked: function(e) {
var MessageContextMenu = sdk.getComponent('context_menus.MessageContextMenu'); var MessageContextMenu = sdk.getComponent('context_menus.MessageContextMenu');
var buttonRect = e.target.getBoundingClientRect() var buttonRect = e.target.getBoundingClientRect();
// The window X and Y offsets are to adjust position when zoomed in to page // The window X and Y offsets are to adjust position when zoomed in to page
var x = buttonRect.right + window.pageXOffset; var x = buttonRect.right + window.pageXOffset;
@ -293,7 +293,7 @@ module.exports = WithMatrixClient(React.createClass({
// If it is, we want to display the complete date along with the HH:MM:SS, // If it is, we want to display the complete date along with the HH:MM:SS,
// rather than just HH:MM:SS. // rather than just HH:MM:SS.
let dayAfterEvent = new Date(this.props.mxEvent.getTs()); let dayAfterEvent = new Date(this.props.mxEvent.getTs());
dayAfterEvent.setDate(dayAfterEvent.getDate() + 1) dayAfterEvent.setDate(dayAfterEvent.getDate() + 1);
dayAfterEvent.setHours(0); dayAfterEvent.setHours(0);
dayAfterEvent.setMinutes(0); dayAfterEvent.setMinutes(0);
dayAfterEvent.setSeconds(0); dayAfterEvent.setSeconds(0);
@ -369,7 +369,7 @@ module.exports = WithMatrixClient(React.createClass({
var event = this.props.mxEvent; var event = this.props.mxEvent;
Modal.createDialogAsync((cb) => { Modal.createDialogAsync((cb) => {
require(['../../../async-components/views/dialogs/EncryptedEventDialog'], cb) require(['../../../async-components/views/dialogs/EncryptedEventDialog'], cb);
}, { }, {
event: event, event: event,
}); });

View file

@ -60,13 +60,15 @@ module.exports = React.createClass({
}, },
componentDidMount: function() { componentDidMount: function() {
if (this.refs.description) if (this.refs.description) {
linkifyElement(this.refs.description, linkifyMatrix.options); linkifyElement(this.refs.description, linkifyMatrix.options);
}
}, },
componentDidUpdate: function() { componentDidUpdate: function() {
if (this.refs.description) if (this.refs.description) {
linkifyElement(this.refs.description, linkifyMatrix.options); linkifyElement(this.refs.description, linkifyMatrix.options);
}
}, },
componentWillUnmount: function() { componentWillUnmount: function() {
@ -116,7 +118,7 @@ module.exports = React.createClass({
if (image) { if (image) {
img = <div className="mx_LinkPreviewWidget_image" style={{ height: thumbHeight }}> img = <div className="mx_LinkPreviewWidget_image" style={{ height: thumbHeight }}>
<img style={{ maxWidth: imageMaxWidth, maxHeight: imageMaxHeight }} src={ image } onClick={ this.onImageClick }/> <img style={{ maxWidth: imageMaxWidth, maxHeight: imageMaxHeight }} src={ image } onClick={ this.onImageClick }/>
</div> </div>;
} }
return ( return (

View file

@ -60,7 +60,7 @@ export default class MemberDeviceInfo extends React.Component {
</div> </div>
); );
} }
}; }
MemberDeviceInfo.displayName = 'MemberDeviceInfo'; MemberDeviceInfo.displayName = 'MemberDeviceInfo';
MemberDeviceInfo.propTypes = { MemberDeviceInfo.propTypes = {

View file

@ -64,7 +64,7 @@ module.exports = WithMatrixClient(React.createClass({
updating: 0, updating: 0,
devicesLoading: true, devicesLoading: true,
devices: null, devices: null,
} };
}, },
componentWillMount: function() { componentWillMount: function() {
@ -202,7 +202,7 @@ module.exports = WithMatrixClient(React.createClass({
} }
var cancelled = false; var cancelled = false;
this._cancelDeviceList = function() { cancelled = true; } this._cancelDeviceList = function() { cancelled = true; };
var client = this.props.matrixClient; var client = this.props.matrixClient;
var self = this; var self = this;
@ -529,7 +529,7 @@ module.exports = WithMatrixClient(React.createClass({
}); });
}, },
onMemberAvatarClick: function () { onMemberAvatarClick: function() {
var avatarUrl = this.props.member.user ? this.props.member.user.avatarUrl : this.props.member.events.member.getContent().avatar_url; var avatarUrl = this.props.member.user ? this.props.member.user.avatarUrl : this.props.member.events.member.getContent().avatar_url;
if(!avatarUrl) return; if(!avatarUrl) return;
@ -620,7 +620,7 @@ module.exports = WithMatrixClient(React.createClass({
<img src="img/create-big.svg" width="26" height="26" /> <img src="img/create-big.svg" width="26" height="26" />
</div> </div>
<div className={labelClasses}><i>Start new chat</i></div> <div className={labelClasses}><i>Start new chat</i></div>
</div> </div>;
startChat = <div> startChat = <div>
<h3>Direct chats</h3> <h3>Direct chats</h3>
@ -654,7 +654,7 @@ module.exports = WithMatrixClient(React.createClass({
var giveOpLabel = this.state.isTargetMod ? "Revoke Moderator" : "Make Moderator"; var giveOpLabel = this.state.isTargetMod ? "Revoke Moderator" : "Make Moderator";
giveModButton = <div className="mx_MemberInfo_field" onClick={this.onModToggle}> giveModButton = <div className="mx_MemberInfo_field" onClick={this.onModToggle}>
{giveOpLabel} {giveOpLabel}
</div> </div>;
} }
// TODO: we should have an invite button if this MemberInfo is showing a user who isn't actually in the current room yet // TODO: we should have an invite button if this MemberInfo is showing a user who isn't actually in the current room yet
@ -672,7 +672,7 @@ module.exports = WithMatrixClient(React.createClass({
{banButton} {banButton}
{giveModButton} {giveModButton}
</div> </div>
</div> </div>;
} }
const memberName = this.props.member.name; const memberName = this.props.member.name;

View file

@ -32,7 +32,7 @@ var SHARE_HISTORY_WARNING =
Newly invited users will see the history of this room. <br/> Newly invited users will see the history of this room. <br/>
If you'd prefer invited users not to see messages that were sent before they joined, <br/> If you'd prefer invited users not to see messages that were sent before they joined, <br/>
turn off, 'Share message history with new users' in the settings for this room. turn off, 'Share message history with new users' in the settings for this room.
</span> </span>;
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'MemberList', displayName: 'MemberList',
@ -207,7 +207,7 @@ module.exports = React.createClass({
// For now we'll pretend this is any entity. It should probably be a separate tile. // For now we'll pretend this is any entity. It should probably be a separate tile.
var EntityTile = sdk.getComponent("rooms.EntityTile"); var EntityTile = sdk.getComponent("rooms.EntityTile");
var BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); var BaseAvatar = sdk.getComponent("avatars.BaseAvatar");
var text = "and " + overflowCount + " other" + (overflowCount > 1 ? "s" : "") + "..."; var text = "and " + overflowCount + " other" + (overflowCount > 1 ? "s" : "") + "...";
return ( return (
<EntityTile className="mx_EntityTile_ellipsis" avatarJsx={ <EntityTile className="mx_EntityTile_ellipsis" avatarJsx={
<BaseAvatar url="img/ellipsis.svg" name="..." width={36} height={36} /> <BaseAvatar url="img/ellipsis.svg" name="..." width={36} height={36} />
@ -338,8 +338,8 @@ module.exports = React.createClass({
} }
memberList.push( memberList.push(
<EntityTile key={e.getStateKey()} name={e.getContent().display_name} /> <EntityTile key={e.getStateKey()} name={e.getContent().display_name} />
) );
}) });
} }
} }

View file

@ -46,7 +46,7 @@ module.exports = React.createClass({
(this.user_last_modified_time === undefined || (this.user_last_modified_time === undefined ||
this.user_last_modified_time < nextProps.member.user.getLastModifiedTime()) this.user_last_modified_time < nextProps.member.user.getLastModifiedTime())
) { ) {
return true return true;
} }
return false; return false;
}, },

View file

@ -367,7 +367,7 @@ export default class MessageComposer extends React.Component {
</div> </div>
); );
} }
}; }
MessageComposer.propTypes = { MessageComposer.propTypes = {
tabComplete: React.PropTypes.any, tabComplete: React.PropTypes.any,

View file

@ -443,12 +443,12 @@ export default class MessageComposerInput extends React.Component {
selection = this.state.editorState.getSelection(); selection = this.state.editorState.getSelection();
let modifyFn = { let modifyFn = {
bold: text => `**${text}**`, 'bold': text => `**${text}**`,
italic: text => `*${text}*`, 'italic': text => `*${text}*`,
underline: text => `_${text}_`, // there's actually no valid underline in Markdown, but *shrug* 'underline': text => `_${text}_`, // there's actually no valid underline in Markdown, but *shrug*
strike: text => `~~${text}~~`, 'strike': text => `~~${text}~~`,
code: text => `\`${text}\``, 'code': text => `\`${text}\``,
blockquote: text => text.split('\n').map(line => `> ${line}\n`).join(''), 'blockquote': text => text.split('\n').map(line => `> ${line}\n`).join(''),
'unordered-list-item': text => text.split('\n').map(line => `- ${line}\n`).join(''), 'unordered-list-item': text => text.split('\n').map(line => `- ${line}\n`).join(''),
'ordered-list-item': text => text.split('\n').map((line, i) => `${i+1}. ${line}\n`).join(''), 'ordered-list-item': text => text.split('\n').map((line, i) => `${i+1}. ${line}\n`).join(''),
}[command]; }[command];
@ -462,8 +462,9 @@ export default class MessageComposerInput extends React.Component {
} }
} }
if (newState == null) if (newState == null) {
newState = RichUtils.handleKeyCommand(this.state.editorState, command); newState = RichUtils.handleKeyCommand(this.state.editorState, command);
}
if (newState != null) { if (newState != null) {
this.setEditorState(newState); this.setEditorState(newState);
@ -665,7 +666,7 @@ export default class MessageComposerInput extends React.Component {
const blockName = { const blockName = {
'code-block': 'code', 'code-block': 'code',
blockquote: 'quote', 'blockquote': 'quote',
'unordered-list-item': 'bullet', 'unordered-list-item': 'bullet',
'ordered-list-item': 'numbullet', 'ordered-list-item': 'numbullet',
}; };
@ -740,7 +741,7 @@ export default class MessageComposerInput extends React.Component {
</div> </div>
); );
} }
}; }
MessageComposerInput.propTypes = { MessageComposerInput.propTypes = {
tabComplete: React.PropTypes.any, tabComplete: React.PropTypes.any,

View file

@ -192,7 +192,7 @@ module.exports = React.createClass({
} }
}, },
onKeyDown: function (ev) { onKeyDown: function(ev) {
if (ev.keyCode === KeyCode.ENTER && !ev.shiftKey) { if (ev.keyCode === KeyCode.ENTER && !ev.shiftKey) {
var input = this.refs.textarea.value; var input = this.refs.textarea.value;
if (input.length === 0) { if (input.length === 0) {

View file

@ -71,7 +71,7 @@ module.exports = React.createClass({
getDefaultProps: function() { getDefaultProps: function() {
return { return {
leftOffset: 0, leftOffset: 0,
} };
}, },
getInitialState: function() { getInitialState: function() {
@ -81,7 +81,7 @@ module.exports = React.createClass({
// position. // position.
return { return {
suppressDisplay: !this.props.suppressAnimation, suppressDisplay: !this.props.suppressAnimation,
} };
}, },
componentWillUnmount: function() { componentWillUnmount: function() {

View file

@ -182,8 +182,8 @@ module.exports = React.createClass({
'm.room.name', user_id 'm.room.name', user_id
); );
save_button = <div className="mx_RoomHeader_textButton" onClick={this.props.onSaveClick}>Save</div> save_button = <div className="mx_RoomHeader_textButton" onClick={this.props.onSaveClick}>Save</div>;
cancel_button = <div className="mx_RoomHeader_cancelButton" onClick={this.props.onCancelClick}><img src="img/cancel.svg" width="18" height="18" alt="Cancel"/> </div> cancel_button = <div className="mx_RoomHeader_cancelButton" onClick={this.props.onCancelClick}><img src="img/cancel.svg" width="18" height="18" alt="Cancel"/> </div>;
} }
if (this.props.saving) { if (this.props.saving) {
@ -193,7 +193,7 @@ module.exports = React.createClass({
if (can_set_room_name) { if (can_set_room_name) {
var RoomNameEditor = sdk.getComponent("rooms.RoomNameEditor"); var RoomNameEditor = sdk.getComponent("rooms.RoomNameEditor");
name = <RoomNameEditor ref="nameEditor" room={this.props.room} /> name = <RoomNameEditor ref="nameEditor" room={this.props.room} />;
} }
else { else {
var searchStatus; var searchStatus;
@ -232,7 +232,7 @@ module.exports = React.createClass({
if (can_set_room_topic) { if (can_set_room_topic) {
var RoomTopicEditor = sdk.getComponent("rooms.RoomTopicEditor"); var RoomTopicEditor = sdk.getComponent("rooms.RoomTopicEditor");
topic_el = <RoomTopicEditor ref="topicEditor" room={this.props.room} /> topic_el = <RoomTopicEditor ref="topicEditor" room={this.props.room} />;
} else { } else {
var topic; var topic;
if (this.props.room) { if (this.props.room) {
@ -301,7 +301,7 @@ module.exports = React.createClass({
rightPanel_buttons = rightPanel_buttons =
<div className="mx_RoomHeader_button" onClick={this.onShowRhsClick} title="<"> <div className="mx_RoomHeader_button" onClick={this.onShowRhsClick} title="<">
<TintableSvg src="img/minimise.svg" width="10" height="16"/> <TintableSvg src="img/minimise.svg" width="10" height="16"/>
</div> </div>;
} }
var right_row; var right_row;

View file

@ -46,7 +46,7 @@ module.exports = React.createClass({
isLoadingLeftRooms: false, isLoadingLeftRooms: false,
lists: {}, lists: {},
incomingCall: null, incomingCall: null,
} };
}, },
componentWillMount: function() { componentWillMount: function() {
@ -338,7 +338,7 @@ module.exports = React.createClass({
// as this is used to calculate the CSS fixed top position for the stickies // as this is used to calculate the CSS fixed top position for the stickies
var scrollAreaHeight = ReactDOM.findDOMNode(this).getBoundingClientRect().height; var scrollAreaHeight = ReactDOM.findDOMNode(this).getBoundingClientRect().height;
var top = (incomingCallBox.parentElement.getBoundingClientRect().top + window.pageYOffset) var top = (incomingCallBox.parentElement.getBoundingClientRect().top + window.pageYOffset);
// Make sure we don't go too far up, if the headers aren't sticky // Make sure we don't go too far up, if the headers aren't sticky
top = (top < scrollAreaOffset) ? scrollAreaOffset : top; top = (top < scrollAreaOffset) ? scrollAreaOffset : top;
// make sure we don't go too far down, if the headers aren't sticky // make sure we don't go too far down, if the headers aren't sticky
@ -401,7 +401,7 @@ module.exports = React.createClass({
var stickyHeight = sticky.dataset.originalHeight; var stickyHeight = sticky.dataset.originalHeight;
var stickyHeader = sticky.childNodes[0]; var stickyHeader = sticky.childNodes[0];
var topStuckHeight = stickyHeight * i; var topStuckHeight = stickyHeight * i;
var bottomStuckHeight = stickyHeight * (stickyWrappers.length - i) var bottomStuckHeight = stickyHeight * (stickyWrappers.length - i);
if (self.scrollAreaSufficient && stickyPosition < (scrollArea.scrollTop + topStuckHeight)) { if (self.scrollAreaSufficient && stickyPosition < (scrollArea.scrollTop + topStuckHeight)) {
// Top stickies // Top stickies
@ -520,7 +520,7 @@ module.exports = React.createClass({
collapsed={ self.props.collapsed } collapsed={ self.props.collapsed }
searchFilter={ self.props.searchFilter } searchFilter={ self.props.searchFilter }
onHeaderClick={ self.onSubListHeaderClick } onHeaderClick={ self.onSubListHeaderClick }
onShowMoreRooms={ self.onShowMoreRooms } /> onShowMoreRooms={ self.onShowMoreRooms } />;
} }
}) } }) }

View file

@ -58,7 +58,7 @@ module.exports = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
busy: false busy: false
} };
}, },
componentWillMount: function() { componentWillMount: function() {
@ -96,7 +96,7 @@ module.exports = React.createClass({
emailMatchBlock = <div className="error"> emailMatchBlock = <div className="error">
Unable to ascertain that the address this invite was Unable to ascertain that the address this invite was
sent to matches one associated with your account. sent to matches one associated with your account.
</div> </div>;
} else if (this.state.invitedEmailMxid != MatrixClientPeg.get().credentials.userId) { } else if (this.state.invitedEmailMxid != MatrixClientPeg.get().credentials.userId) {
emailMatchBlock = emailMatchBlock =
<div className="mx_RoomPreviewBar_warning"> <div className="mx_RoomPreviewBar_warning">
@ -107,7 +107,7 @@ module.exports = React.createClass({
This invitation was sent to <b><span className="email">{this.props.invitedEmail}</span></b>, which is not associated with this account.<br/> This invitation was sent to <b><span className="email">{this.props.invitedEmail}</span></b>, which is not associated with this account.<br/>
You may wish to login with a different account, or add this email to this account. You may wish to login with a different account, or add this email to this account.
</div> </div>
</div> </div>;
} }
} }
joinBlock = ( joinBlock = (

View file

@ -252,7 +252,7 @@ module.exports = React.createClass({
return this.refs.url_preview_settings.saveSettings(); return this.refs.url_preview_settings.saveSettings();
}, },
saveEncryption: function () { saveEncryption: function() {
if (!this.refs.encrypt) { return q(); } if (!this.refs.encrypt) { return q(); }
var encrypt = this.refs.encrypt.checked; var encrypt = this.refs.encrypt.checked;
@ -404,7 +404,7 @@ module.exports = React.createClass({
var cli = MatrixClientPeg.get(); var cli = MatrixClientPeg.get();
var roomState = this.props.room.currentState; var roomState = this.props.room.currentState;
return (roomState.mayClientSendStateEvent("m.room.join_rules", cli) && return (roomState.mayClientSendStateEvent("m.room.join_rules", cli) &&
roomState.mayClientSendStateEvent("m.room.guest_access", cli)) roomState.mayClientSendStateEvent("m.room.guest_access", cli));
}, },
onManageIntegrations(ev) { onManageIntegrations(ev) {
@ -510,7 +510,7 @@ module.exports = React.createClass({
var UrlPreviewSettings = sdk.getComponent("room_settings.UrlPreviewSettings"); var UrlPreviewSettings = sdk.getComponent("room_settings.UrlPreviewSettings");
var EditableText = sdk.getComponent('elements.EditableText'); var EditableText = sdk.getComponent('elements.EditableText');
var PowerSelector = sdk.getComponent('elements.PowerSelector'); var PowerSelector = sdk.getComponent('elements.PowerSelector');
var Loader = sdk.getComponent("elements.Spinner") var Loader = sdk.getComponent("elements.Spinner");
var cli = MatrixClientPeg.get(); var cli = MatrixClientPeg.get();
var roomState = this.props.room.currentState; var roomState = this.props.room.currentState;
@ -557,7 +557,7 @@ module.exports = React.createClass({
</div>; </div>;
} }
else { else {
userLevelsSection = <div>No users have specific privileges in this room.</div> userLevelsSection = <div>No users have specific privileges in this room.</div>;
} }
var banned = this.props.room.getMembersWithMembership("ban"); var banned = this.props.room.getMembersWithMembership("ban");
@ -635,7 +635,7 @@ module.exports = React.createClass({
</label>); </label>);
})) : (self.state.tags && self.state.tags.join) ? self.state.tags.join(", ") : "" })) : (self.state.tags && self.state.tags.join) ? self.state.tags.join(", ") : ""
} }
</div> </div>;
} }
// If there is no history_visibility, it is assumed to be 'shared'. // If there is no history_visibility, it is assumed to be 'shared'.
@ -653,7 +653,7 @@ module.exports = React.createClass({
addressWarning = addressWarning =
<div className="mx_RoomSettings_warning"> <div className="mx_RoomSettings_warning">
To link to a room it must have <a href="#addresses">an address</a>. To link to a room it must have <a href="#addresses">an address</a>.
</div> </div>;
} }
var inviteGuestWarning; var inviteGuestWarning;
@ -664,7 +664,7 @@ module.exports = React.createClass({
this.setState({ join_rule: "invite", guest_access: "can_join" }); this.setState({ join_rule: "invite", guest_access: "can_join" });
e.preventDefault(); e.preventDefault();
}}>Click here to fix</a>. }}>Click here to fix</a>.
</div> </div>;
} }
var integrationsButton; var integrationsButton;

View file

@ -221,7 +221,7 @@ module.exports = React.createClass({
var avatarContainerClasses = classNames({ var avatarContainerClasses = classNames({
'mx_RoomTile_avatar_container': true, 'mx_RoomTile_avatar_container': true,
'mx_RoomTile_avatar_roomTagMenu': this.state.roomTagMenu, 'mx_RoomTile_avatar_roomTagMenu': this.state.roomTagMenu,
}) });
var badgeClasses = classNames({ var badgeClasses = classNames({
'mx_RoomTile_badge': true, 'mx_RoomTile_badge': true,

View file

@ -118,7 +118,7 @@ var SearchableEntityList = React.createClass({
_createOverflowEntity: function(overflowCount, totalCount) { _createOverflowEntity: function(overflowCount, totalCount) {
var EntityTile = sdk.getComponent("rooms.EntityTile"); var EntityTile = sdk.getComponent("rooms.EntityTile");
var BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); var BaseAvatar = sdk.getComponent("avatars.BaseAvatar");
var text = "and " + overflowCount + " other" + (overflowCount > 1 ? "s" : "") + "..."; var text = "and " + overflowCount + " other" + (overflowCount > 1 ? "s" : "") + "...";
return ( return (
<EntityTile className="mx_EntityTile_ellipsis" avatarJsx={ <EntityTile className="mx_EntityTile_ellipsis" avatarJsx={
<BaseAvatar url="img/ellipsis.svg" name="..." width={36} height={36} /> <BaseAvatar url="img/ellipsis.svg" name="..." width={36} height={36} />
@ -135,8 +135,8 @@ var SearchableEntityList = React.createClass({
<form onSubmit={this.onQuerySubmit} autoComplete="off"> <form onSubmit={this.onQuerySubmit} autoComplete="off">
<input className="mx_SearchableEntityList_query" id="mx_SearchableEntityList_query" type="text" <input className="mx_SearchableEntityList_query" id="mx_SearchableEntityList_query" type="text"
onChange={this.onQueryChanged} value={this.state.query} onChange={this.onQueryChanged} value={this.state.query}
onFocus= {() => { this.setState({ focused: true }) }} onFocus= {() => { this.setState({ focused: true }); }}
onBlur= {() => { this.setState({ focused: false }) }} onBlur= {() => { this.setState({ focused: false }); }}
placeholder={this.props.searchPlaceholderText} /> placeholder={this.props.searchPlaceholderText} />
</form> </form>
); );

View file

@ -44,7 +44,7 @@ module.exports = React.createClass({
var cancelButton; var cancelButton;
if (this.props.onCancelClick) { if (this.props.onCancelClick) {
cancelButton = <div className="mx_RoomHeader_cancelButton" onClick={this.props.onCancelClick}><img src="img/cancel.svg" width="18" height="18" alt="Cancel"/> </div> cancelButton = <div className="mx_RoomHeader_cancelButton" onClick={this.props.onCancelClick}><img src="img/cancel.svg" width="18" height="18" alt="Cancel"/> </div>;
} }
var showRhsButton; var showRhsButton;

View file

@ -38,7 +38,7 @@ module.exports = React.createClass({
var active = -1; var active = -1;
// FIXME: make presence data update whenever User.presence changes... // FIXME: make presence data update whenever User.presence changes...
active = user.lastActiveAgo ? active = user.lastActiveAgo ?
(Date.now() - (user.lastPresenceTs - user.lastActiveAgo)) : -1; (Date.now() - (user.lastPresenceTs - user.lastActiveAgo)) : -1;
var BaseAvatar = sdk.getComponent('avatars.BaseAvatar'); var BaseAvatar = sdk.getComponent('avatars.BaseAvatar');

View file

@ -49,7 +49,7 @@ module.exports = React.createClass({
return { return {
avatarUrl: this.props.initialAvatarUrl, avatarUrl: this.props.initialAvatarUrl,
phase: this.Phases.Display, phase: this.Phases.Display,
} };
}, },
componentWillReceiveProps: function(newProps) { componentWillReceiveProps: function(newProps) {
@ -120,7 +120,7 @@ module.exports = React.createClass({
var BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); var BaseAvatar = sdk.getComponent("avatars.BaseAvatar");
// XXX: FIXME: once we track in the JS what our own displayname is(!) then use it here rather than ? // XXX: FIXME: once we track in the JS what our own displayname is(!) then use it here rather than ?
avatarImg = <BaseAvatar width={this.props.width} height={this.props.height} resizeMethod='crop' avatarImg = <BaseAvatar width={this.props.width} height={this.props.height} resizeMethod='crop'
name='?' idName={ MatrixClientPeg.get().getUserIdLocalpart() } url={this.state.avatarUrl} /> name='?' idName={ MatrixClientPeg.get().getUserIdLocalpart() } url={this.state.avatarUrl} />;
} }
var uploadSection; var uploadSection;
@ -130,7 +130,7 @@ module.exports = React.createClass({
Upload new: Upload new:
<input type="file" onChange={this.onFileSelected}/> <input type="file" onChange={this.onFileSelected}/>
{this.state.errorText} {this.state.errorText}
</div> </div>
); );
} }

View file

@ -59,7 +59,7 @@ module.exports = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
phase: this.Phases.Edit phase: this.Phases.Edit
} };
}, },
changePassword: function(old_password, new_password) { changePassword: function(old_password, new_password) {
@ -105,7 +105,7 @@ module.exports = React.createClass({
render: function() { render: function() {
var rowClassName = this.props.rowClassName; var rowClassName = this.props.rowClassName;
var rowLabelClassName = this.props.rowLabelClassName; var rowLabelClassName = this.props.rowLabelClassName;
var rowInputClassName = this.props.rowInputClassName var rowInputClassName = this.props.rowInputClassName;
var buttonClassName = this.props.buttonClassName; var buttonClassName = this.props.buttonClassName;
switch (this.state.phase) { switch (this.state.phase) {

View file

@ -88,7 +88,7 @@ export default class DevicesPanel extends React.Component {
const removed_id = device.device_id; const removed_id = device.device_id;
this.setState((state, props) => { this.setState((state, props) => {
const newDevices = state.devices.filter( const newDevices = state.devices.filter(
d => { return d.device_id != removed_id } d => { return d.device_id != removed_id; }
); );
return { devices: newDevices }; return { devices: newDevices };
}); });
@ -98,7 +98,7 @@ export default class DevicesPanel extends React.Component {
var DevicesPanelEntry = sdk.getComponent('settings.DevicesPanelEntry'); var DevicesPanelEntry = sdk.getComponent('settings.DevicesPanelEntry');
return ( return (
<DevicesPanelEntry key={device.device_id} device={device} <DevicesPanelEntry key={device.device_id} device={device}
onDeleted={()=>{this._onDeviceDeleted(device)}} /> onDeleted={()=>{this._onDeviceDeleted(device);}} />
); );
} }

View file

@ -15,12 +15,9 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import classNames from 'classnames';
import q from 'q';
import sdk from '../../../index'; import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg'; import MatrixClientPeg from '../../../MatrixClientPeg';
import DateUtils from '../../../DateUtils';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
export default class DevicesPanelEntry extends React.Component { export default class DevicesPanelEntry extends React.Component {
@ -61,7 +58,7 @@ export default class DevicesPanelEntry extends React.Component {
if (this._unmounted) { return; } if (this._unmounted) { return; }
if (error.httpStatus !== 401 || !error.data || !error.data.flows) { if (error.httpStatus !== 401 || !error.data || !error.data.flows) {
// doesn't look like an interactive-auth failure // doesn't look like an interactive-auth failure
throw e; throw error;
} }
// pop up an interactive auth dialog // pop up an interactive auth dialog
@ -121,7 +118,7 @@ export default class DevicesPanelEntry extends React.Component {
let deleteButton; let deleteButton;
if (this.state.deleteError) { if (this.state.deleteError) {
deleteButton = <div className="error">{this.state.deleteError}</div> deleteButton = <div className="error">{this.state.deleteError}</div>;
} else { } else {
deleteButton = ( deleteButton = (
<div className="mx_textButton" <div className="mx_textButton"

Some files were not shown because too many files have changed in this diff Show more