diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 6f23d27c3e2b..be68d0ce1a12 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,6 +1,6 @@ FROM rocketchat/base:8 -ENV RC_VERSION 0.65.0 +ENV RC_VERSION 0.65.1 MAINTAINER buildmaster@rocket.chat diff --git a/.docker/Dockerfile.rhel b/.docker/Dockerfile.rhel index 44bd00d0034a..be945c34c810 100644 --- a/.docker/Dockerfile.rhel +++ b/.docker/Dockerfile.rhel @@ -1,6 +1,6 @@ FROM registry.access.redhat.com/rhscl/nodejs-8-rhel7 -ENV RC_VERSION 0.65.0 +ENV RC_VERSION 0.65.1 MAINTAINER buildmaster@rocket.chat diff --git a/.github/history.json b/.github/history.json index 5bd5c9d2e762..c1a279dfff1c 100644 --- a/.github/history.json +++ b/.github/history.json @@ -14697,5 +14697,53 @@ "geekgonecrazy" ] } + ], + "0.65.1": [ + { + "pr": "10940", + "title": "[FIX] Livechat not loading", + "userLogin": "sampaiodiego", + "milestone": "0.65.1", + "contributors": [ + "sampaiodiego", + "rodrigok" + ] + }, + { + "pr": "10934", + "title": "[FIX] Application crashing on startup when trying to log errors to `exceptions` channel", + "userLogin": "sampaiodiego", + "milestone": "0.65.1", + "contributors": [ + "sampaiodiego" + ] + }, + { + "pr": "10928", + "title": "[FIX] Incomplete email notification link", + "userLogin": "sampaiodiego", + "milestone": "0.65.1", + "contributors": [ + "sampaiodiego" + ] + }, + { + "pr": "10904", + "title": "[FIX] Image lazy load was breaking attachments", + "userLogin": "ggazzo", + "milestone": "0.65.1", + "contributors": [ + "ggazzo" + ] + }, + { + "pr": "10851", + "title": "[FIX] Leave room wasn't working as expected", + "userLogin": "ggazzo", + "milestone": "0.65.1", + "contributors": [ + "ggazzo" + ] + } ] } \ No newline at end of file diff --git a/.meteor/versions b/.meteor/versions index c71a541b67d8..9aa44928b2c2 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -9,7 +9,7 @@ accounts-twitter@1.4.1 aldeed:simple-schema@1.5.4 allow-deny@1.1.0 autoupdate@1.4.0 -babel-compiler@7.0.8 +babel-compiler@7.0.9 babel-runtime@1.2.2 base64@1.0.11 binary-heap@1.0.10 @@ -35,7 +35,7 @@ deps@1.0.12 diff-sequence@1.1.0 dispatch:run-as-user@1.1.1 dynamic-import@0.3.0 -ecmascript@0.10.8 +ecmascript@0.10.9 ecmascript-runtime@0.5.0 ecmascript-runtime-client@0.6.2 ecmascript-runtime-server@0.5.0 @@ -91,7 +91,7 @@ mizzao:autocomplete@0.5.1 mizzao:timesync@0.3.4 mobile-experience@1.0.5 mobile-status-bar@1.0.14 -modules@0.11.6 +modules@0.11.8 modules-runtime@0.9.2 mongo@1.4.7 mongo-dev-server@1.1.0 diff --git a/.sandstorm/sandstorm-pkgdef.capnp b/.sandstorm/sandstorm-pkgdef.capnp index 6fcf7cb38375..df614183ca37 100644 --- a/.sandstorm/sandstorm-pkgdef.capnp +++ b/.sandstorm/sandstorm-pkgdef.capnp @@ -19,9 +19,9 @@ const pkgdef :Spk.PackageDefinition = ( appTitle = (defaultText = "Rocket.Chat"), - appVersion = 70, # Increment this for every release. + appVersion = 71, # Increment this for every release. - appMarketingVersion = (defaultText = "0.65.0"), + appMarketingVersion = (defaultText = "0.65.1"), # Human-readable representation of appVersion. Should match the way you # identify versions of your app in documentation and marketing. diff --git a/.travis/snap.sh b/.travis/snap.sh index 4e5f9ab88c65..cc0e50afd18d 100755 --- a/.travis/snap.sh +++ b/.travis/snap.sh @@ -17,7 +17,7 @@ elif [[ $TRAVIS_TAG ]]; then RC_VERSION=$TRAVIS_TAG else CHANNEL=edge - RC_VERSION=0.65.0 + RC_VERSION=0.65.1 fi echo "Preparing to trigger a snap release for $CHANNEL channel" diff --git a/HISTORY.md b/HISTORY.md index 2f3d4c5772cd..da40e7921937 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,17 @@ +# 0.65.1 +`2018-05-30 · 5 🐛` + +### 🐛 Bug fixes + +- Livechat not loading ([#10940](https://github.com/RocketChat/Rocket.Chat/pull/10940)) +- Application crashing on startup when trying to log errors to `exceptions` channel ([#10934](https://github.com/RocketChat/Rocket.Chat/pull/10934)) +- Incomplete email notification link ([#10928](https://github.com/RocketChat/Rocket.Chat/pull/10928)) +- Image lazy load was breaking attachments ([#10904](https://github.com/RocketChat/Rocket.Chat/pull/10904)) +- Leave room wasn't working as expected ([#10851](https://github.com/RocketChat/Rocket.Chat/pull/10851)) + # 0.65.0 -`2018-05-27 · 17 🎉 · 24 🐛 · 41 🔍 · 17 👩‍💻👨‍💻` +`2018-05-28 · 17 🎉 · 24 🐛 · 41 🔍 · 17 👩‍💻👨‍💻` ### 🎉 New features diff --git a/client/methods/leaveRoom.js b/client/methods/leaveRoom.js deleted file mode 100644 index 8a5d1817f3a9..000000000000 --- a/client/methods/leaveRoom.js +++ /dev/null @@ -1,18 +0,0 @@ -Meteor.methods({ - leaveRoom(rid) { - if (!Meteor.userId()) { - return false; - } - - ChatSubscription.remove({ - rid, - 'u._id': Meteor.userId() - }); - - ChatRoom.update(rid, { - $pull: { - usernames: Meteor.user().username - } - }); - } -}); diff --git a/package.json b/package.json index cf1c432927bf..1b2dc6e5ae35 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Rocket.Chat", "description": "The Ultimate Open Source WebChat Platform", - "version": "0.65.0", + "version": "0.65.1", "author": { "name": "Rocket.Chat", "url": "https://rocket.chat/" @@ -110,7 +110,7 @@ "supertest": "^3.0.0" }, "dependencies": { - "@babel/runtime": "^7.0.0-beta.46", + "@babel/runtime": "^7.0.0-beta.48", "@google-cloud/language": "^1.2.0", "@google-cloud/storage": "^1.6.0", "@google-cloud/vision": "^0.19.0", diff --git a/packages/rocketchat-error-handler/server/lib/RocketChat.ErrorHandler.js b/packages/rocketchat-error-handler/server/lib/RocketChat.ErrorHandler.js index 276e3c6ddd44..08e557b4d8f5 100644 --- a/packages/rocketchat-error-handler/server/lib/RocketChat.ErrorHandler.js +++ b/packages/rocketchat-error-handler/server/lib/RocketChat.ErrorHandler.js @@ -4,16 +4,22 @@ class ErrorHandler { this.rid = null; this.lastError = null; - this.registerHandlers(); - - RocketChat.settings.get('Log_Exceptions_to_Channel', (key, value) => { - if (value.trim()) { - this.reporting = true; - this.rid = this.getRoomId(value); - } else { - this.reporting = false; - this.rid = ''; - } + Meteor.startup(() => { + this.registerHandlers(); + + RocketChat.settings.get('Log_Exceptions_to_Channel', (key, value) => { + this.rid = null; + const roomName = value.trim(); + if (roomName) { + this.rid = this.getRoomId(roomName); + } + + if (this.rid) { + this.reporting = true; + } else { + this.reporting = false; + } + }); }); } @@ -39,24 +45,24 @@ class ErrorHandler { getRoomId(roomName) { roomName = roomName.replace('#'); const room = RocketChat.models.Rooms.findOneByName(roomName, { fields: { _id: 1, t: 1 } }); - if (room && (room.t === 'c' || room.t === 'p')) { - return room._id; - } else { - this.reporting = false; + if (!room || (room.t !== 'c' && room.t !== 'p')) { + return; } + return room._id; } trackError(message, stack) { - if (this.reporting && this.rid && this.lastError !== message) { - this.lastError = message; - const user = RocketChat.models.Users.findOneById('rocket.cat'); - - if (stack) { - message = `${ message }\n\`\`\`\n${ stack }\n\`\`\``; - } + if (!this.reporting || !this.rid || this.lastError === message) { + return; + } + this.lastError = message; + const user = RocketChat.models.Users.findOneById('rocket.cat'); - RocketChat.sendMessage(user, { msg: message }, { _id: this.rid }); + if (stack) { + message = `${ message }\n\`\`\`\n${ stack }\n\`\`\``; } + + RocketChat.sendMessage(user, { msg: message }, { _id: this.rid }); } } diff --git a/packages/rocketchat-lazy-load/client/index.js b/packages/rocketchat-lazy-load/client/index.js index ea62f695bca9..6b923f72333c 100644 --- a/packages/rocketchat-lazy-load/client/index.js +++ b/packages/rocketchat-lazy-load/client/index.js @@ -24,23 +24,29 @@ export const fixCordova = function(url) { } }; -const loadImage = instance => { +const getEl = (el, instance) => (instance && instance.firstNode) || el; +const loadImage = (el, instance) => { + const element = getEl(el, instance); const img = new Image(); - const src = instance.firstNode.getAttribute('data-src'); - instance.firstNode.className = instance.firstNode.className.replace('lazy-img', ''); + const src = element.getAttribute('data-src'); img.onload = function() { - instance.loaded.set(true); - instance.firstNode.removeAttribute('data-src'); + if (instance) { + instance.loaded.set(true); + } else { + element.className = element.className.replace('lazy-img', ''); + element.src = src; + } + element.removeAttribute('data-src'); }; img.src = fixCordova(src); }; -const isVisible = (instance) => { +const isVisible = (el, instance) => { requestAnimationFrame(() => { - const rect = instance.firstNode.getBoundingClientRect(); + const rect = getEl(el, instance).getBoundingClientRect(); if (rect.top >= -100 && rect.left >= 0 && rect.top <= (window.innerHeight || document.documentElement.clientHeight)) { - return loadImage(instance); + return loadImage(el, instance); } }); @@ -50,10 +56,10 @@ window.addEventListener('resize', window.lazyloadtick); export const lazyloadtick = _.debounce(() => { [...document.querySelectorAll('.lazy-img[data-src]')].forEach(el => - isVisible(Blaze.getView(el)._templateInstance) + isVisible(el, Blaze.getView(el)._templateInstance) ); -}, 500); +}, 300); window.lazyloadtick = lazyloadtick; -export const addImage = instance => isVisible(instance); +export const addImage = instance => isVisible(instance.firstNode, instance); diff --git a/packages/rocketchat-lazy-load/client/lazyloadImage.js b/packages/rocketchat-lazy-load/client/lazyloadImage.js index f2d1b4e0fc2b..ecbe9f412bbc 100644 --- a/packages/rocketchat-lazy-load/client/lazyloadImage.js +++ b/packages/rocketchat-lazy-load/client/lazyloadImage.js @@ -2,6 +2,10 @@ import './lazyloadImage.html'; import { addImage, fixCordova } from './'; Template.lazyloadImage.helpers({ + class() { + const loaded = Template.instance().loaded.get(); + return `${ this.class } ${ loaded ? '' : 'lazy-img' }`; + }, lazy() { const { preview, placeholder, src } = this; if (Template.instance().loaded.get() ||(!preview && !placeholder)) { diff --git a/packages/rocketchat-lib/client/lib/ChannelActions.js b/packages/rocketchat-lib/client/lib/ChannelActions.js index 6f9a6d2e7f66..6d9ae02a79d1 100644 --- a/packages/rocketchat-lib/client/lib/ChannelActions.js +++ b/packages/rocketchat-lib/client/lib/ChannelActions.js @@ -13,23 +13,33 @@ export function hide(type, rid, name) { cancelButtonText: t('Cancel'), closeOnConfirm: true, html: false - }, function() { + }, async function() { if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName()) && (Session.get('openedRoom') === rid)) { FlowRouter.go('home'); } - Meteor.call('hideRoom', rid, function(err) { - if (err) { - handleError(err); - } else if (rid === Session.get('openedRoom')) { - Session.delete('openedRoom'); - } - }); + await call('hideRoom', rid); + if (rid === Session.get('openedRoom')) { + Session.delete('openedRoom'); + } }); - return false; } +const leaveRoom = async rid => { + if (!Meteor.userId()) { + return false; + } + const tmp = ChatSubscription.findOne({ rid, 'u._id': Meteor.userId() }); + ChatSubscription.remove({ rid, 'u._id': Meteor.userId() }); + try { + await call('leaveRoom', rid); + } catch (error) { + ChatSubscription.insert(tmp); + throw error; + } +}; + export function leave(type, rid, name) { const warnText = RocketChat.roomTypes.roomTypes[type].getUiText(UiTextContext.LEAVE_WARNING); @@ -43,29 +53,26 @@ export function leave(type, rid, name) { cancelButtonText: t('Cancel'), closeOnConfirm: false, html: false - }, function(isConfirm) { - if (isConfirm) { - Meteor.call('leaveRoom', rid, function(err) { - if (err) { - modal.open({ - title: t('Warning'), - text: handleError(err, false), - type: 'warning', - html: false - }); - } else { - modal.close(); - if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName()) && (Session.get('openedRoom') === rid)) { - FlowRouter.go('home'); - } - - RoomManager.close(rid); - } + }, async function(isConfirm) { + if (!isConfirm) { + return; + } + try { + await leaveRoom(rid); + modal.close(); + if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName()) && (Session.get('openedRoom') === rid)) { + FlowRouter.go('home'); + } + RoomManager.close(rid); + } catch (error) { + return modal.open({ + type: 'error', + title: t('Warning'), + text: handleError(error, false), + html: false }); } }); - - return false; } export function erase(rid) { @@ -79,15 +86,14 @@ export function erase(rid) { cancelButtonText: t('Cancel'), closeOnConfirm: false, html: false - }, () => { - call('eraseRoom', rid).then(() => { - modal.open({ - title: t('Deleted'), - text: t('Room_has_been_deleted'), - type: 'success', - timer: 2000, - showConfirmButton: false - }); + }, async() => { + await call('eraseRoom', rid); + modal.open({ + title: t('Deleted'), + text: t('Room_has_been_deleted'), + type: 'success', + timer: 2000, + showConfirmButton: false }); }); } diff --git a/packages/rocketchat-lib/rocketchat.info b/packages/rocketchat-lib/rocketchat.info index 02778dccc3b8..fcf1d26d9641 100644 --- a/packages/rocketchat-lib/rocketchat.info +++ b/packages/rocketchat-lib/rocketchat.info @@ -1,3 +1,3 @@ { - "version": "0.65.0" + "version": "0.65.1" } diff --git a/packages/rocketchat-livechat/.app/.meteor/versions b/packages/rocketchat-livechat/.app/.meteor/versions index 25dc26f932d8..2324a404233f 100644 --- a/packages/rocketchat-livechat/.app/.meteor/versions +++ b/packages/rocketchat-livechat/.app/.meteor/versions @@ -2,7 +2,7 @@ accounts-base@1.4.2 accounts-password@1.5.1 aldeed:simple-schema@1.5.4 allow-deny@1.1.0 -babel-compiler@7.0.8 +babel-compiler@7.0.9 babel-runtime@1.2.2 base64@1.0.11 binary-heap@1.0.10 @@ -23,7 +23,7 @@ ddp-server@2.1.2 deps@1.0.12 diff-sequence@1.1.0 dynamic-import@0.3.0 -ecmascript@0.10.8 +ecmascript@0.10.9 ecmascript-runtime@0.5.0 ecmascript-runtime-client@0.6.2 ecmascript-runtime-server@0.5.0 @@ -51,7 +51,7 @@ minifier-css@1.3.1 minifier-js@2.3.4 minimongo@1.4.4 mizzao:timesync@0.5.0 -modules@0.11.6 +modules@0.11.8 modules-runtime@0.9.2 momentjs:moment@2.22.1 mongo@1.4.7 diff --git a/packages/rocketchat-livechat/.app/package.json b/packages/rocketchat-livechat/.app/package.json index eecf2fc2578c..fe484bd950b7 100644 --- a/packages/rocketchat-livechat/.app/package.json +++ b/packages/rocketchat-livechat/.app/package.json @@ -20,7 +20,7 @@ "email": "support@rocket.chat" }, "dependencies": { - "@babel/runtime": "^7.0.0-beta.46", + "@babel/runtime": "^7.0.0-beta.48", "autolinker": "^1.6.2", "bcrypt": "^2.0.1", "core-js": "^2.5.5", diff --git a/packages/rocketchat-message-attachments/client/messageAttachment.html b/packages/rocketchat-message-attachments/client/messageAttachment.html index 6bc61ddd0643..46b033f4a0f0 100644 --- a/packages/rocketchat-message-attachments/client/messageAttachment.html +++ b/packages/rocketchat-message-attachments/client/messageAttachment.html @@ -66,7 +66,7 @@
{{#if loadImage}}
- {{> lazyloadImage src=image_url preview=image_preview height=(getImageHeight image_dimensions.height) class="lazy-img gallery-item" title=title description=description}} + {{> lazyloadImage src=image_url preview=image_preview height=(getImageHeight image_dimensions.height) class="gallery-item" title=title description=description}} {{#if labels}}
{{#each labels}} diff --git a/packages/rocketchat-push-notifications/server/models/Subscriptions.js b/packages/rocketchat-push-notifications/server/models/Subscriptions.js index c8857988e114..7e051dc88165 100644 --- a/packages/rocketchat-push-notifications/server/models/Subscriptions.js +++ b/packages/rocketchat-push-notifications/server/models/Subscriptions.js @@ -225,7 +225,16 @@ RocketChat.models.Subscriptions.findNotificationPreferencesByRoom = function(que return this._db.find(query, { fields: { - 'u._id': 1, + + // fields needed for notifications + rid: 1, + t: 1, + u: 1, + name: 1, + fname: 1, + code: 1, + + // fields to define if should send a notification audioNotifications: 1, audioNotificationValue: 1, desktopNotificationDuration: 1, diff --git a/packages/rocketchat-ui-account/client/avatar/avatar.html b/packages/rocketchat-ui-account/client/avatar/avatar.html index de8f529657fe..65d3b4ff4a59 100644 --- a/packages/rocketchat-ui-account/client/avatar/avatar.html +++ b/packages/rocketchat-ui-account/client/avatar/avatar.html @@ -1,7 +1,7 @@