diff --git a/src/components/views/rooms/PinnedEventTile.js b/src/components/views/rooms/PinnedEventTile.js index 514a84cc86..65b41d946a 100644 --- a/src/components/views/rooms/PinnedEventTile.js +++ b/src/components/views/rooms/PinnedEventTile.js @@ -47,7 +47,8 @@ module.exports = React.createClass({ const index = pinned.indexOf(this.props.mxEvent.getId()); if (index !== -1) { pinned.splice(index, 1); - MatrixClientPeg.get().sendStateEvent(this.props.mxRoom.roomId, 'm.room.pinned_events', {pinned}, '').then(() => { + MatrixClientPeg.get().sendStateEvent(this.props.mxRoom.roomId, 'm.room.pinned_events', {pinned}, '') + .then(() => { if (this.props.onUnpinned) this.props.onUnpinned(); }); } else if (this.props.onUnpinned) this.props.onUnpinned(); diff --git a/src/components/views/rooms/PinnedEventsPanel.js b/src/components/views/rooms/PinnedEventsPanel.js index 2e3f6e8390..deea03f030 100644 --- a/src/components/views/rooms/PinnedEventsPanel.js +++ b/src/components/views/rooms/PinnedEventsPanel.js @@ -47,20 +47,21 @@ module.exports = React.createClass({ const promises = []; const cli = MatrixClientPeg.get(); - pinnedEvents.getContent().pinned.map(eventId => { - promises.push(cli.getEventTimeline(this.props.room.getUnfilteredTimelineSet(), eventId, 0).then(timeline => { - const event = timeline.getEvents().find(e => e.getId() === eventId); + pinnedEvents.getContent().pinned.map((eventId) => { + promises.push(cli.getEventTimeline(this.props.room.getUnfilteredTimelineSet(), eventId, 0).then( + (timeline) => { + const event = timeline.getEvents().find((e) => e.getId() === eventId); return {eventId, timeline, event}; - }).catch(err => { + }).catch((err) => { console.error("Error looking up pinned event " + eventId + " in room " + this.props.room.roomId); console.error(err); return null; // return lack of context to avoid unhandled errors })); }); - Promise.all(promises).then(contexts => { + Promise.all(promises).then((contexts) => { // Filter out the messages before we try to render them - const pinned = contexts.filter(context => { + const pinned = contexts.filter((context) => { if (!context) return false; // no context == not applicable for the room if (context.event.getType() !== "m.room.message") return false; if (context.event.isRedacted()) return false; @@ -77,8 +78,11 @@ module.exports = React.createClass({ return (
{ _t("No pinned messages.") }
); } - return this.state.pinned.map(context => { - return (); + return this.state.pinned.map((context) => { + return (); }); },