de-lint Entities

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-07-01 14:34:20 +01:00
parent fdd8df87b0
commit a270c85295
No known key found for this signature in database
GPG key ID: 0435A1D4BBD34D64
2 changed files with 10 additions and 11 deletions

View file

@ -119,7 +119,6 @@ src/ContentMessages.js
src/createRoom.js src/createRoom.js
src/DateUtils.js src/DateUtils.js
src/email.js src/email.js
src/Entities.js
src/extend.js src/extend.js
src/HtmlUtils.js src/HtmlUtils.js
src/ImageUtils.js src/ImageUtils.js

View file

@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var React = require('react'); import sdk from './index';
var sdk = require('./index');
function isMatch(query, name, uid) { function isMatch(query, name, uid) {
query = query.toLowerCase(); query = query.toLowerCase();
@ -33,8 +32,8 @@ function isMatch(query, name, uid) {
} }
// split spaces in name and try matching constituent parts // split spaces in name and try matching constituent parts
var parts = name.split(" "); const parts = name.split(" ");
for (var i = 0; i < parts.length; i++) { for (let i = 0; i < parts.length; i++) {
if (parts[i].indexOf(query) === 0) { if (parts[i].indexOf(query) === 0) {
return true; return true;
} }
@ -67,7 +66,7 @@ class Entity {
class MemberEntity extends Entity { class MemberEntity extends Entity {
getJsx() { getJsx() {
var MemberTile = sdk.getComponent("rooms.MemberTile"); const MemberTile = sdk.getComponent("rooms.MemberTile");
return ( return (
<MemberTile key={this.model.userId} member={this.model} /> <MemberTile key={this.model.userId} member={this.model} />
); );
@ -84,6 +83,7 @@ class UserEntity extends Entity {
super(model); super(model);
this.showInviteButton = Boolean(showInviteButton); this.showInviteButton = Boolean(showInviteButton);
this.inviteFn = inviteFn; this.inviteFn = inviteFn;
this.onClick = this.onClick.bind(this);
} }
onClick() { onClick() {
@ -93,15 +93,15 @@ class UserEntity extends Entity {
} }
getJsx() { getJsx() {
var UserTile = sdk.getComponent("rooms.UserTile"); const UserTile = sdk.getComponent("rooms.UserTile");
return ( return (
<UserTile key={this.model.userId} user={this.model} <UserTile key={this.model.userId} user={this.model}
showInviteButton={this.showInviteButton} onClick={this.onClick.bind(this)} /> showInviteButton={this.showInviteButton} onClick={this.onClick} />
); );
} }
matches(queryString) { matches(queryString) {
var name = this.model.displayName || this.model.userId; const name = this.model.displayName || this.model.userId;
return isMatch(queryString, name, this.model.userId); return isMatch(queryString, name, this.model.userId);
} }
} }
@ -109,7 +109,7 @@ class UserEntity extends Entity {
module.exports = { module.exports = {
newEntity: function(jsx, matchFn) { newEntity: function(jsx, matchFn) {
var entity = new Entity(); const entity = new Entity();
entity.getJsx = function() { entity.getJsx = function() {
return jsx; return jsx;
}; };
@ -137,5 +137,5 @@ module.exports = {
return users.map(function(u) { return users.map(function(u) {
return new UserEntity(u, showInviteButton, inviteFn); return new UserEntity(u, showInviteButton, inviteFn);
}); });
} },
}; };