From 47b94a1d89aab412e8da01a4255508457113f6d5 Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Tue, 10 Apr 2018 15:25:50 -0300 Subject: [PATCH 1/3] Fix REST spotlight endpoint, add same logic of front to the backend, to search users and channels with # and @ --- packages/rocketchat-api/package.js | 1 - packages/rocketchat-api/server/v1/misc.js | 19 +++++++++ .../rocketchat-api/server/v1/spotlight.js | 27 ------------- .../rocketchat-ui-sidenav/client/toolbar.js | 7 ++-- server/publications/spotlight.js | 10 +++++ tests/end-to-end/api/00-miscellaneous.js | 30 ++++++++++++++ tests/end-to-end/api/11-spotlight.js | 40 ------------------- 7 files changed, 63 insertions(+), 71 deletions(-) delete mode 100644 packages/rocketchat-api/server/v1/spotlight.js delete mode 100644 tests/end-to-end/api/11-spotlight.js diff --git a/packages/rocketchat-api/package.js b/packages/rocketchat-api/package.js index d1a8958f6e611..347eff9d96c79 100644 --- a/packages/rocketchat-api/package.js +++ b/packages/rocketchat-api/package.js @@ -44,5 +44,4 @@ Package.onUse(function(api) { api.addFiles('server/v1/settings.js', 'server'); api.addFiles('server/v1/stats.js', 'server'); api.addFiles('server/v1/users.js', 'server'); - api.addFiles('server/v1/spotlight.js', 'server'); }); diff --git a/packages/rocketchat-api/server/v1/misc.js b/packages/rocketchat-api/server/v1/misc.js index 05fee75aec6bc..1ccddd305ba7e 100644 --- a/packages/rocketchat-api/server/v1/misc.js +++ b/packages/rocketchat-api/server/v1/misc.js @@ -168,3 +168,22 @@ RocketChat.API.v1.addRoute('shield.svg', { authRequired: false }, { }; } }); + +RocketChat.API.v1.addRoute('spotlight', { authRequired: true }, { + get() { + check(this.queryParams, { + query: String + }); + + const { query } = this.queryParams; + + const result = Meteor.runAsUser(this.userId, () => + Meteor.call('spotlight', query, null, { + rooms: true, + users: true + }) + ); + + return RocketChat.API.v1.success(result); + } +}); diff --git a/packages/rocketchat-api/server/v1/spotlight.js b/packages/rocketchat-api/server/v1/spotlight.js deleted file mode 100644 index 9dbea532fa11d..0000000000000 --- a/packages/rocketchat-api/server/v1/spotlight.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - This API returns the result of a query of rooms - and users, using Meteor's Spotlight method. - - Method: GET - Route: api/v1/spotlight - Query params: - - query: The term to be searched. - */ -RocketChat.API.v1.addRoute('spotlight', { authRequired: true }, { - get() { - check(this.queryParams, { - query: String - }); - - const { query } = this.queryParams; - - const result = Meteor.runAsUser(this.userId, () => - Meteor.call('spotlight', query, null, { - rooms: true, - users: true - }) - ); - - return RocketChat.API.v1.success(result); - } -}); diff --git a/packages/rocketchat-ui-sidenav/client/toolbar.js b/packages/rocketchat-ui-sidenav/client/toolbar.js index 69b85a75bc26a..536bbd4deb301 100644 --- a/packages/rocketchat-ui-sidenav/client/toolbar.js +++ b/packages/rocketchat-ui-sidenav/client/toolbar.js @@ -149,14 +149,15 @@ Template.toolbar.helpers({ query._id = query.rid; delete query.rid; } - - if (filterText[0] === '#') { + const searchForChannels = filterText[0] === '#'; + const searchForDMs = filterText[0] === '@'; + if (searchForChannels) { filterText = filterText.slice(1); type.users = false; query.t = 'c'; } - if (filterText[0] === '@') { + if (searchForDMs) { filterText = filterText.slice(1); type.rooms = false; query.t = 'd'; diff --git a/server/publications/spotlight.js b/server/publications/spotlight.js index 2514bb2a7107f..85708e9f73695 100644 --- a/server/publications/spotlight.js +++ b/server/publications/spotlight.js @@ -13,6 +13,16 @@ function fetchRooms(userId, rooms) { Meteor.methods({ spotlight(text, usernames, type = {users: true, rooms: true}, rid) { + const searchForChannels = text[0] === '#'; + const searchForDMs = text[0] === '@'; + if (searchForChannels) { + type.users = false; + text = text.slice(1); + } + if (searchForDMs) { + type.rooms = false; + text = text.slice(1); + } const regex = new RegExp(s.trim(s.escapeRegExp(text)), 'i'); const result = { users: [], diff --git a/tests/end-to-end/api/00-miscellaneous.js b/tests/end-to-end/api/00-miscellaneous.js index d655110d4c743..749413dc9c4a1 100644 --- a/tests/end-to-end/api/00-miscellaneous.js +++ b/tests/end-to-end/api/00-miscellaneous.js @@ -98,4 +98,34 @@ describe('miscellaneous', function() { }); }); + describe('[/spotlight]', () => { + it('should fail when does not have query param', (done) => { + request.get(api('spotlight')) + .set(credentials) + .expect('Content-Type', 'application/json') + .expect(400) + .expect((res) => { + expect(res.body).to.have.property('success', false); + expect(res.body).to.have.property('error'); + }) + .end(done); + }); + + it('should return objects for a valid query param', (done) => { + request.get(api('spotlight')) + .query({ + query: 'foobar' + }) + .set(credentials) + .expect('Content-Type', 'application/json') + .expect(200) + .expect((res) => { + expect(res.body).to.have.property('success', true); + expect(res.body).to.have.property('users').that.have.lengthOf(0); + expect(res.body).to.have.property('rooms').that.have.lengthOf(0); + }) + .end(done); + }); + }); + }); diff --git a/tests/end-to-end/api/11-spotlight.js b/tests/end-to-end/api/11-spotlight.js deleted file mode 100644 index fcd9ca1a488f2..0000000000000 --- a/tests/end-to-end/api/11-spotlight.js +++ /dev/null @@ -1,40 +0,0 @@ -/* eslint-env mocha */ -/* globals expect */ - -import {getCredentials, api, request, credentials } from '../../data/api-data.js'; - -describe('[Spotlight]', function() { - this.retries(0); - - before(done => getCredentials(done)); - - describe('[/spotlight]', () => { - it('should fail when does not have query param', (done) => { - request.get(api('spotlight')) - .set(credentials) - .expect('Content-Type', 'application/json') - .expect(400) - .expect((res) => { - expect(res.body).to.have.property('success', false); - expect(res.body).to.have.property('error'); - }) - .end(done); - }); - - it('should return objects for a valid query param', (done) => { - request.get(api('spotlight')) - .query({ - query: 'foobar' - }) - .set(credentials) - .expect('Content-Type', 'application/json') - .expect(200) - .expect((res) => { - expect(res.body).to.have.property('success', true); - expect(res.body).to.have.property('users').that.have.lengthOf(0); - expect(res.body).to.have.property('rooms').that.have.lengthOf(0); - }) - .end(done); - }); - }); -}); From 6d362333da9abd2e2af8509d8e38c8bcf15d75a7 Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Wed, 11 Apr 2018 12:06:19 -0300 Subject: [PATCH 2/3] Add more tests cases, with valid channel and valid user, also removing unused parameter --- packages/rocketchat-api/server/v1/misc.js | 5 +- tests/end-to-end/api/00-miscellaneous.js | 80 +++++++++++++++++++++-- 2 files changed, 76 insertions(+), 9 deletions(-) diff --git a/packages/rocketchat-api/server/v1/misc.js b/packages/rocketchat-api/server/v1/misc.js index 1ccddd305ba7e..7afd4c16e981d 100644 --- a/packages/rocketchat-api/server/v1/misc.js +++ b/packages/rocketchat-api/server/v1/misc.js @@ -178,10 +178,7 @@ RocketChat.API.v1.addRoute('spotlight', { authRequired: true }, { const { query } = this.queryParams; const result = Meteor.runAsUser(this.userId, () => - Meteor.call('spotlight', query, null, { - rooms: true, - users: true - }) + Meteor.call('spotlight', query) ); return RocketChat.API.v1.success(result); diff --git a/tests/end-to-end/api/00-miscellaneous.js b/tests/end-to-end/api/00-miscellaneous.js index 749413dc9c4a1..eedbe76826617 100644 --- a/tests/end-to-end/api/00-miscellaneous.js +++ b/tests/end-to-end/api/00-miscellaneous.js @@ -3,7 +3,7 @@ /* eslint no-unused-vars: 0 */ import {getCredentials, api, login, request, credentials} from '../../data/api-data.js'; -import {adminEmail, adminUsername, adminPassword} from '../../data/user.js'; +import {adminEmail, adminUsername, adminPassword, password} from '../../data/user.js'; import supertest from 'supertest'; describe('miscellaneous', function() { @@ -99,6 +99,53 @@ describe('miscellaneous', function() { }); describe('[/spotlight]', () => { + let user; + before((done) => { + const username = `user.test.${ Date.now() }`; + const email = `${ username }@rocket.chat`; + request.post(api('users.create')) + .set(credentials) + .send({ email, name: username, username, password}) + .end((err, res) => { + user = res.body.user; + done(); + }); + }); + + let userCredentials; + let testChannel; + before((done) => { + request.post(api('login')) + .send({ + user: user.username, + password + }) + .expect('Content-Type', 'application/json') + .expect(200) + .expect((res) => { + userCredentials = {}; + userCredentials['X-Auth-Token'] = res.body.data.authToken; + userCredentials['X-User-Id'] = res.body.data.userId; + }) + .end(done); + }); + after(done => { + request.post(api('users.delete')).set(credentials).send({ + userId: user._id + }).end(done); + user = undefined; + }); + it('create an channel', (done) => { + request.post(api('channels.create')) + .set(userCredentials) + .send({ + name: `channel.test.${ Date.now() }` + }) + .end((err, res) => { + testChannel = res.body.channel; + done(); + }); + }); it('should fail when does not have query param', (done) => { request.get(api('spotlight')) .set(credentials) @@ -111,18 +158,41 @@ describe('miscellaneous', function() { .end(done); }); - it('should return objects for a valid query param', (done) => { + it('should return object inside users array when search by a valid user', (done) => { + request.get(api('spotlight')) + .query({ + query: `@${ adminUsername }` + }) + .set(credentials) + .expect('Content-Type', 'application/json') + .expect(200) + .expect((res) => { + expect(res.body).to.have.property('success', true); + expect(res.body).to.have.property('users').and.to.be.an('array'); + expect(res.body.users[0]).to.have.property('_id'); + expect(res.body.users[0]).to.have.property('name'); + expect(res.body.users[0]).to.have.property('username'); + expect(res.body.users[0]).to.have.property('status'); + expect(res.body).to.have.property('rooms').and.to.be.an('array'); + }) + .end(done); + }); + + it('must return the object inside the room array when searching for a valid room and that user is not a member of it', (done) => { request.get(api('spotlight')) .query({ - query: 'foobar' + query: `#${ testChannel.name }` }) .set(credentials) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); - expect(res.body).to.have.property('users').that.have.lengthOf(0); - expect(res.body).to.have.property('rooms').that.have.lengthOf(0); + expect(res.body).to.have.property('users').and.to.be.an('array'); + expect(res.body).to.have.property('rooms').and.to.be.an('array'); + expect(res.body.rooms[0]).to.have.property('_id'); + expect(res.body.rooms[0]).to.have.property('name'); + expect(res.body.rooms[0]).to.have.property('t'); }) .end(done); }); From 2395baa8a38f046f53a3a2b16d4ef031fda9727e Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Fri, 20 Apr 2018 12:18:23 -0300 Subject: [PATCH 3/3] Merge branch 'develop' into fix-rest-spotlight --- .circleci/config.yml | 1 + .circleci/redhat-registry.sh | 12 + .docker/Dockerfile.rhel | 44 + .docker/licenses/LICENSE | 22 + .github/history.json | 59 +- .gitignore | 1 + .meteor/.id | 7 - .scripts/set-version.js | 1 + HISTORY.md | 34 +- client/routes/pageNotFound.html | 5 + client/routes/router.js | 7 + client/startup/startup.js | 6 +- docker-compose.yml | 2 +- package-lock.json | 118 +-- package.json | 1 + packages/meteor-accounts-saml/saml_utils.js | 4 +- packages/rocketchat-api/server/api.js | 18 +- packages/rocketchat-api/server/v1/channels.js | 2 +- packages/rocketchat-api/server/v1/chat.js | 17 + packages/rocketchat-api/server/v1/misc.js | 47 +- packages/rocketchat-api/server/v1/rooms.js | 40 + packages/rocketchat-api/server/v1/settings.js | 29 +- packages/rocketchat-api/server/v1/users.js | 16 + packages/rocketchat-apps/README.md | 2 +- .../client/admin/appInstall.js | 24 +- .../rocketchat-apps/client/admin/appLogs.js | 10 +- .../client/admin/appManage.html | 344 +++++--- .../rocketchat-apps/client/admin/appManage.js | 50 +- .../rocketchat-apps/client/admin/apps.html | 10 +- packages/rocketchat-apps/client/admin/apps.js | 3 + packages/rocketchat-apps/package.js | 4 +- .../server/bridges/activation.js | 16 +- .../server/bridges/environmental.js | 6 +- .../rocketchat-apps/server/bridges/http.js | 10 +- .../server/bridges/listeners.js | 32 +- .../server/bridges/messages.js | 19 +- .../server/bridges/persistence.js | 16 +- .../rocketchat-apps/server/bridges/rooms.js | 8 +- .../server/bridges/settings.js | 12 +- .../rocketchat-apps/server/bridges/users.js | 4 +- .../server/communication/rest.js | 52 +- .../server/communication/websockets.js | 52 +- .../server/converters/messages.js | 31 +- .../rocketchat-apps/server/orchestrator.js | 2 +- .../server/startup.js | 4 +- .../client/views/mailMessagesInstructions.js | 8 - .../client/views/channelSettings.html | 6 +- .../client/views/channelSettings.js | 7 +- .../server/functions/saveRoomAnnouncement.js | 11 +- .../client/lib/EmojiPicker.js | 32 +- packages/rocketchat-gitlab/common.js | 2 +- .../client/client.js | 2 +- packages/rocketchat-i18n/README.md | 6 + packages/rocketchat-i18n/i18n/af.i18n.json | 1 - packages/rocketchat-i18n/i18n/ar.i18n.json | 1 - packages/rocketchat-i18n/i18n/az.i18n.json | 1 - packages/rocketchat-i18n/i18n/bg.i18n.json | 1 - packages/rocketchat-i18n/i18n/ca.i18n.json | 1 - packages/rocketchat-i18n/i18n/cs.i18n.json | 1 - packages/rocketchat-i18n/i18n/da.i18n.json | 1 - packages/rocketchat-i18n/i18n/de-AT.i18n.json | 1 - packages/rocketchat-i18n/i18n/de.i18n.json | 2 +- packages/rocketchat-i18n/i18n/el.i18n.json | 1 - packages/rocketchat-i18n/i18n/en.i18n.json | 24 +- packages/rocketchat-i18n/i18n/eo.i18n.json | 1 - packages/rocketchat-i18n/i18n/es.i18n.json | 1 - packages/rocketchat-i18n/i18n/fa.i18n.json | 1 - packages/rocketchat-i18n/i18n/fi.i18n.json | 1 - packages/rocketchat-i18n/i18n/fr.i18n.json | 1 - packages/rocketchat-i18n/i18n/he.i18n.json | 1 - packages/rocketchat-i18n/i18n/hr.i18n.json | 1 - packages/rocketchat-i18n/i18n/hu.i18n.json | 1 - packages/rocketchat-i18n/i18n/id.i18n.json | 1 - packages/rocketchat-i18n/i18n/it.i18n.json | 1 - packages/rocketchat-i18n/i18n/ja.i18n.json | 1 - packages/rocketchat-i18n/i18n/km.i18n.json | 1 - packages/rocketchat-i18n/i18n/ko.i18n.json | 1 - packages/rocketchat-i18n/i18n/ku.i18n.json | 1 - packages/rocketchat-i18n/i18n/lo.i18n.json | 1 - packages/rocketchat-i18n/i18n/lt.i18n.json | 1 - packages/rocketchat-i18n/i18n/mn.i18n.json | 1 - packages/rocketchat-i18n/i18n/ms-MY.i18n.json | 1 - packages/rocketchat-i18n/i18n/nl.i18n.json | 1 - packages/rocketchat-i18n/i18n/no.i18n.json | 1 - packages/rocketchat-i18n/i18n/pl.i18n.json | 1 - packages/rocketchat-i18n/i18n/pt-BR.i18n.json | 3 +- packages/rocketchat-i18n/i18n/pt.i18n.json | 3 +- packages/rocketchat-i18n/i18n/ro.i18n.json | 1 - packages/rocketchat-i18n/i18n/ru.i18n.json | 5 +- packages/rocketchat-i18n/i18n/sk-SK.i18n.json | 1 - packages/rocketchat-i18n/i18n/sl-SI.i18n.json | 1 - packages/rocketchat-i18n/i18n/sq.i18n.json | 1 - packages/rocketchat-i18n/i18n/sr.i18n.json | 1 - packages/rocketchat-i18n/i18n/sv.i18n.json | 4 +- packages/rocketchat-i18n/i18n/ta-IN.i18n.json | 1 - packages/rocketchat-i18n/i18n/th-TH.i18n.json | 1 - packages/rocketchat-i18n/i18n/tr.i18n.json | 1 - packages/rocketchat-i18n/i18n/ug.i18n.json | 1 - packages/rocketchat-i18n/i18n/uk.i18n.json | 1 - packages/rocketchat-i18n/i18n/vi-VN.i18n.json | 756 +++++++++--------- packages/rocketchat-i18n/i18n/zh-HK.i18n.json | 1 - packages/rocketchat-i18n/i18n/zh-TW.i18n.json | 1 - packages/rocketchat-i18n/i18n/zh.i18n.json | 1 - packages/rocketchat-i18n/package.js | 14 +- .../rocketchat-integrations/server/api/api.js | 1 + .../rocketchat-lib/client/MessageAction.js | 13 +- .../client/lib/RocketChatAnnouncement.js | 21 + packages/rocketchat-lib/client/lib/index.js | 4 +- packages/rocketchat-lib/package.js | 1 + .../server/functions/createRoom.js | 61 +- .../server/functions/sendMessage.js | 64 +- .../server/functions/setUsername.js | 1 + .../server/functions/settings.js | 3 + .../server/lib/defaultBlockedDomainsList.js | 1 + .../server/lib/sendNotificationsOnMessage.js | 3 +- .../rocketchat-lib/server/models/Rooms.js | 7 + .../rocketchat-lib/server/startup/settings.js | 27 +- .../.app/client/lib/_livechat.js | 7 + .../.app/client/lib/commands.js | 10 +- .../.app/client/views/livechatWindow.html | 2 +- .../.app/client/views/livechatWindow.js | 1 + .../.app/client/views/loading.html | 2 +- .../.app/client/views/message.js | 2 +- .../.app/client/views/offlineForm.js | 3 + .../.app/i18n/en.i18n.json | 3 +- .../.app/i18n/pt-BR.i18n.json | 1 + .../rocketchat-livechat/.app/project-tap.i18n | 2 + .../client/views/app/livechatAppearance.html | 7 + .../client/views/app/livechatAppearance.js | 15 + .../client/views/app/livechatOfficeHours.js | 2 +- packages/rocketchat-livechat/config.js | 12 +- .../imports/server/rest/sms.js | 21 + .../server/lib/Livechat.js | 3 +- .../server/methods/getInitialData.js | 4 +- .../server/methods/saveAppearance.js | 3 +- .../server/models/LivechatDepartmentAgents.js | 12 + .../server/publications/livechatAppearance.js | 3 +- .../client/views/pushNotificationsFlexTab.js | 12 +- packages/rocketchat-sms/services/twilio.js | 32 +- .../imports/components/contextual-bar.css | 13 +- .../imports/components/modal/directory.css | 35 +- .../components/sidebar/sidebar-header.css | 9 +- .../components/sidebar/sidebar-item.css | 11 +- .../client/imports/components/table.css | 26 +- .../client/imports/forms/button.css | 9 +- .../client/imports/forms/input.css | 4 + .../client/imports/forms/popup-list.css | 8 +- .../client/imports/forms/select.css | 10 + .../client/imports/forms/tags.css | 1 + .../client/imports/general/apps.css | 4 +- .../client/imports/general/forms.css | 1 + packages/rocketchat-theme/server/colors.less | 6 + .../client/accountPreferences.html | 84 +- .../client/accountPreferences.js | 5 +- .../rocketchat-ui-admin/client/admin.html | 44 +- packages/rocketchat-ui-admin/client/admin.js | 7 + .../client/flexTabBar.js | 15 +- .../client/tabs/membersList.html | 2 +- .../client/tabs/membersList.js | 12 +- .../client/tabs/userInfo.html | 148 ++-- .../client/tabs/userInfo.js | 17 +- .../rocketchat-ui-master/public/icons.svg | 2 + .../rocketchat-ui-message/client/message.js | 16 +- .../client/messageBox.js | 14 +- .../client/sidebarHeader.js | 47 +- .../client/sidebarItem.html | 10 +- .../client/sidebarItem.js | 8 +- .../client/components/popupList.html | 6 +- .../client/components/popupList.js | 6 + .../rocketchat-ui/client/lib/RoomManager.js | 2 +- packages/rocketchat-ui/client/lib/accounts.js | 2 + .../client/views/app/createChannel.js | 4 - .../client/views/app/directory.html | 31 +- .../client/views/app/directory.js | 42 +- .../rocketchat-ui/client/views/app/home.html | 2 +- .../client/views/app/popover.html | 2 +- .../rocketchat-ui/client/views/app/popover.js | 58 +- .../rocketchat-ui/client/views/app/room.html | 4 +- .../rocketchat-ui/client/views/app/room.js | 48 +- server/methods/saveUserPreferences.js | 1 + server/methods/toogleFavorite.js | 8 + server/startup/migrations/v110.js | 57 ++ server/startup/migrations/v111.js | 10 + server/startup/migrations/v112.js | 25 + tests/data/user.js | 1 + tests/end-to-end/api/00-miscellaneous.js | 90 ++- tests/end-to-end/api/01-users.js | 28 + tests/end-to-end/api/05-chat.js | 36 + tests/end-to-end/api/08-settings.js | 25 + tests/end-to-end/api/09-rooms.js | 84 ++ tests/end-to-end/ui/11-admin.js | 12 +- tests/pageobjects/administration.page.js | 3 + 192 files changed, 2418 insertions(+), 1235 deletions(-) create mode 100755 .circleci/redhat-registry.sh create mode 100644 .docker/Dockerfile.rhel create mode 100644 .docker/licenses/LICENSE delete mode 100644 .meteor/.id create mode 100644 client/routes/pageNotFound.html create mode 100644 packages/rocketchat-i18n/README.md create mode 100644 packages/rocketchat-lib/client/lib/RocketChatAnnouncement.js create mode 100644 packages/rocketchat-livechat/.app/project-tap.i18n create mode 100644 server/startup/migrations/v110.js create mode 100644 server/startup/migrations/v111.js create mode 100644 server/startup/migrations/v112.js diff --git a/.circleci/config.yml b/.circleci/config.yml index ec83eb4bf1d50..258256aabb0d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -247,6 +247,7 @@ jobs: bash .circleci/update-releases.sh bash .circleci/docker.sh bash .circleci/snap.sh + bash .circleci/redhat-registry.sh workflows: version: 2 diff --git a/.circleci/redhat-registry.sh b/.circleci/redhat-registry.sh new file mode 100755 index 0000000000000..a206af991c19b --- /dev/null +++ b/.circleci/redhat-registry.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -euvo pipefail +IFS=$'\n\t' + +if [[ $CIRCLE_TAG ]]; then + curl -X POST \ + https://connect.redhat.com/api/v2/projects/$REDHAT_REGISTRY_PID/build \ + -H "Authorization: Bearer $REDHAT_REGISTRY_KEY" \ + -H 'Cache-Control: no-cache' \ + -H 'Content-Type: application/json' \ + -d '{"tag":"'$CIRCLE_TAG'"}' +fi diff --git a/.docker/Dockerfile.rhel b/.docker/Dockerfile.rhel new file mode 100644 index 0000000000000..935c47ff829f8 --- /dev/null +++ b/.docker/Dockerfile.rhel @@ -0,0 +1,44 @@ +FROM registry.access.redhat.com/rhscl/nodejs-8-rhel7 + +ENV RC_VERSION 0.64.0-develop + +MAINTAINER buildmaster@rocket.chat + +LABEL name="Rocket.Chat" \ + vendor="Rocket.Chat" \ + version="${RC_VERSION}" \ + release="1" \ + url="https://rocket.chat" \ + summary="The Ultimate Open Source Web Chat Platform" \ + description="The Ultimate Open Source Web Chat Platform" \ + run="docker run -d --name ${NAME} ${IMAGE}" + + +# This is ugly... But for some reason npm and node aren't available at this stage. +ENV PATH /opt/rh/rh-nodejs8/root/usr/bin:/opt/app-root/src/node_modules/.bin/:/opt/app-root/src/.npm-global/bin/:/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +RUN set -x \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0E163286C20D07B9787EBE9FD7F9D0414FD08104 \ + && curl -SLf "https://releases.rocket.chat/${RC_VERSION}/download" -o rocket.chat.tgz \ + && curl -SLf "https://releases.rocket.chat/${RC_VERSION}/asc" -o rocket.chat.tgz.asc \ + && gpg --verify rocket.chat.tgz.asc \ + && tar -zxf rocket.chat.tgz -C /opt/app-root/src/ \ + && cd /opt/app-root/src/bundle/programs/server \ + && npm install + +COPY licenses /licenses + +VOLUME /opt/app-root/src/uploads + +WORKDIR /opt/app-root/src/bundle + +ENV DEPLOY_METHOD=docker-redhat \ + NODE_ENV=production \ + MONGO_URL=mongodb://mongo:27017/rocketchat \ + HOME=/tmp \ + PORT=3000 \ + ROOT_URL=http://localhost:3000 + +EXPOSE 3000 + +CMD ["node", "main.js"] diff --git a/.docker/licenses/LICENSE b/.docker/licenses/LICENSE new file mode 100644 index 0000000000000..b3435a1048855 --- /dev/null +++ b/.docker/licenses/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017 Rocket.Chat Technologies Corp. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/.github/history.json b/.github/history.json index 1c523399eede8..f5c429911bafd 100644 --- a/.github/history.json +++ b/.github/history.json @@ -12207,5 +12207,62 @@ "web-flow" ] } + ], + "0.63.2": [ + { + "pr": "10475", + "title": "[FIX] Even TypeErrors with SAML", + "userLogin": "graywolf336", + "contributors": [ + "graywolf336" + ] + }, + { + "pr": "10408", + "title": "add redhat dockerfile to master", + "userLogin": "geekgonecrazy", + "contributors": [ + "geekgonecrazy" + ] + } + ], + "0.63.3": [ + { + "pr": "10485", + "title": "[FIX] The 'channel.messages' REST API Endpoint error", + "userLogin": "rafaelks", + "milestone": "0.64.0", + "contributors": [ + "rafaelks", + "web-flow" + ] + }, + { + "pr": "10218", + "title": "Added one2mail.info to default blocked domains list", + "userLogin": "nsuchy", + "milestone": "0.64.0", + "contributors": [ + "nsuchy", + "web-flow" + ] + }, + { + "pr": "10476", + "title": "Release 0.63.2", + "userLogin": "graywolf336", + "contributors": [ + "graywolf336", + "web-flow" + ] + }, + { + "pr": "10475", + "title": "[FIX] Even TypeErrors with SAML", + "userLogin": "graywolf336", + "contributors": [ + "graywolf336" + ] + } ] -} \ No newline at end of file +} diff --git a/.gitignore b/.gitignore index 3f7fd5b8134e6..ace3589e6afc8 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,4 @@ pm2.json settings.json build.sh /public/livechat +packages/rocketchat-i18n/i18n/livechat.* diff --git a/.meteor/.id b/.meteor/.id deleted file mode 100644 index bf888b12702fe..0000000000000 --- a/.meteor/.id +++ /dev/null @@ -1,7 +0,0 @@ -# This file contains a token that is unique to your project. -# Check it into your repository along with the rest of this directory. -# It can be used for purposes such as: -# - ensuring you don't accidentally deploy one app on top of another -# - providing package authors with aggregated statistics - -1d10m9yd7fq1hsv663c diff --git a/.scripts/set-version.js b/.scripts/set-version.js index e21035ee3a99d..cad1c3b602da8 100644 --- a/.scripts/set-version.js +++ b/.scripts/set-version.js @@ -25,6 +25,7 @@ const files = [ './.circleci/snap.sh', './.circleci/update-releases.sh', './.docker/Dockerfile', + './.docker/Dockerfile.rhel', './packages/rocketchat-lib/rocketchat.info' ]; const readFile = (file) => { diff --git a/HISTORY.md b/HISTORY.md index 6b32486661bb3..e4d09df6415b9 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,7 +2,39 @@ # 0.64.0-develop (2018-04-07) +# 0.63.3 +`2018-04-18 · 2 🐛 · 2 🔍 · 1 👩‍💻👨‍💻` +### 🐛 Bug fixes + +- The 'channel.messages' REST API Endpoint error ([#10485](https://github.com/RocketChat/Rocket.Chat/pull/10485)) +- Even TypeErrors with SAML ([#10475](https://github.com/RocketChat/Rocket.Chat/pull/10475)) + +
+🔍 Minor changes + +- Added one2mail.info to default blocked domains list ([#10218](https://github.com/RocketChat/Rocket.Chat/pull/10218) by [@nsuchy](https://github.com/nsuchy)) +- Release 0.63.2 ([#10476](https://github.com/RocketChat/Rocket.Chat/pull/10476)) + +
+ +### 👩‍💻👨‍💻 Contributors 😍 + +- [@nsuchy](https://github.com/nsuchy) + +# 0.63.2 +`2018-04-17 · 1 🐛 · 1 🔍` + +### 🐛 Bug fixes + +- Even TypeErrors with SAML ([#10475](https://github.com/RocketChat/Rocket.Chat/pull/10475)) + +
+🔍 Minor changes + +- add redhat dockerfile to master ([#10408](https://github.com/RocketChat/Rocket.Chat/pull/10408)) + +
# 0.63.1 `2018-04-07 · 5 🐛 · 3 👩‍💻👨‍💻` @@ -1925,4 +1957,4 @@ - [@qge](https://github.com/qge) - [@sezinkarli](https://github.com/sezinkarli) - [@szluohua](https://github.com/szluohua) -- [@tgxn](https://github.com/tgxn) \ No newline at end of file +- [@tgxn](https://github.com/tgxn) diff --git a/client/routes/pageNotFound.html b/client/routes/pageNotFound.html new file mode 100644 index 0000000000000..b0ab91242c6db --- /dev/null +++ b/client/routes/pageNotFound.html @@ -0,0 +1,5 @@ + diff --git a/client/routes/router.js b/client/routes/router.js index 67d0f4870e5ef..c3cb3e5457355 100644 --- a/client/routes/router.js +++ b/client/routes/router.js @@ -148,3 +148,10 @@ FlowRouter.route('/register/:hash', { // BlazeLayout.render 'logoLayout', { render: 'invalidSecretURL' } } }); + +FlowRouter.notFound = { + action() { + BlazeLayout.render('pageNotFound'); + } +}; + diff --git a/client/startup/startup.js b/client/startup/startup.js index 8279db3373a5e..4a92434be37c8 100644 --- a/client/startup/startup.js +++ b/client/startup/startup.js @@ -91,17 +91,17 @@ Meteor.startup(function() { } }; - const defaultIdleTimeLimit = 300000; + const defaultIdleTimeLimit = 300; Meteor.subscribe('userData', function() { const user = Meteor.user(); const userLanguage = user && user.language ? user.language : window.defaultUserLanguage(); if (!userHasPreferences(user)) { - UserPresence.awayTime = defaultIdleTimeLimit; + UserPresence.awayTime = defaultIdleTimeLimit * 1000; UserPresence.start(); } else { - UserPresence.awayTime = user.settings.preferences.idleTimeLimit || defaultIdleTimeLimit; + UserPresence.awayTime = (user.settings.preferences.idleTimeLimit || defaultIdleTimeLimit) * 1000; if (user.settings.preferences.hasOwnProperty('enableAutoAway')) { user.settings.preferences.enableAutoAway && UserPresence.start(); diff --git a/docker-compose.yml b/docker-compose.yml index d1cfa596080c4..430214bc32633 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: volumes: - ./data/db:/data/db #- ./data/dump:/dump - command: mongod --smallfiles --oplogSize 128 --replSet rs0 + command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1 labels: - "traefik.enable=false" diff --git a/package-lock.json b/package-lock.json index 140c99548c68a..997dc6e523a9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "Rocket.Chat", - "version": "0.63.0-rc.1", + "version": "0.64.0-develop", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -16,7 +16,7 @@ "@google-cloud/common": { "version": "0.16.1", "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.16.1.tgz", - "integrity": "sha512-1sufDsSfgJ7fuBLq+ux8t3TlydMlyWl9kPZx2WdLINkGtf5RjvXX6EWYZiCMKe8flJ3oC0l95j5atN2uX5n3rg==", + "integrity": "sha1-4fn8SVUzYpl+H7/3N0RPG0YN7Xg=", "requires": { "array-uniq": "1.0.3", "arrify": "1.0.1", @@ -41,7 +41,7 @@ "@google-cloud/language": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@google-cloud/language/-/language-1.1.0.tgz", - "integrity": "sha512-CcCc2zgX3M1X+rn+zy38QjCY/1R9CBCRd3cCqzIefZL16QgBod3ATPtVEHQG4KCyjnvCkMNMTQdYRCcsXs4wLw==", + "integrity": "sha1-ykV5nwpiN9HqQs0Y7v59MdG1Bys=", "requires": { "google-gax": "0.14.5", "lodash.merge": "4.6.1" @@ -50,7 +50,7 @@ "@google-cloud/storage": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-1.6.0.tgz", - "integrity": "sha512-yQ63bJYoiwY220gn/KdTLPoHppAPwFHfG7VFLPwJ+1R5U1eqUN5XV2a7uPj1szGF8/gxlKm2UbE8DgoJJ76DFw==", + "integrity": "sha1-Pep0DiS/CX2R8WWW4pFQUpB2eaI=", "requires": { "@google-cloud/common": "0.16.1", "arrify": "1.0.1", @@ -78,14 +78,14 @@ "mime": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/mime/-/mime-2.2.0.tgz", - "integrity": "sha512-0Qz9uF1ATtl8RKJG4VRfOymh7PyEor6NbrI/61lRfuRe4vx9SNATrvAeTj2EWVRKjEQGskrzWkJBBY5NbaVHIA==" + "integrity": "sha1-Fh5UGWVVHTtUn6ERQ5Hjo9Vbkjs=" } } }, "@google-cloud/vision": { "version": "0.15.2", "resolved": "https://registry.npmjs.org/@google-cloud/vision/-/vision-0.15.2.tgz", - "integrity": "sha512-SqirvZHIX95q24RIGGucVI4oS3FMZSnEXqw4SK8C6MlEfV3C0zn59eT1W8zcYvvFnR90+mHgw2PC2Z4ZMav/LQ==", + "integrity": "sha1-ZSeKujCKUWfpGOfZ+ZYzyIqh6j0=", "requires": { "@google-cloud/common": "0.16.1", "async": "2.6.0", @@ -217,7 +217,7 @@ "@types/node": { "version": "8.9.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.9.4.tgz", - "integrity": "sha512-dSvD36qnQs78G1BPsrZFdPpvLgMW/dnvr5+nTW2csMs5TiP9MOXrjUbnMZOEwnIuBklXtn7b6TPA2Cuq07bDHA==" + "integrity": "sha1-39MnWCoGwRTrbgRB+j1vqzXtrUg=" }, "JSONStream": { "version": "1.3.2", @@ -552,7 +552,7 @@ "autolinker": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-1.6.2.tgz", - "integrity": "sha512-IKLGtYFb3jzGTtgCpb4bm//1sXmmmgmr0msKshhYoc7EsWmLCFvuyxLcEIfcZ5gbCgZGXrnXkOkcBblOFEnlog==" + "integrity": "sha1-Z66donLoCODY644Cy8jN4wOUdFc=" }, "autoprefixer": { "version": "8.0.0", @@ -618,7 +618,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", "dev": true }, "supports-color": { @@ -651,7 +651,7 @@ "uuid": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + "integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=" }, "xml2js": { "version": "0.4.17", @@ -1726,7 +1726,7 @@ "bcrypt": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-1.0.3.tgz", - "integrity": "sha512-pRyDdo73C8Nim3jwFJ7DWe3TZCgwDfWZ6nHS5LSdU77kWbj1frruvdndP02AOavtD4y8v6Fp2dolbHgp4SDrfg==", + "integrity": "sha1-sC3cbAtS6ha40883XVoy54DatUg=", "requires": { "nan": "2.6.2", "node-pre-gyp": "0.6.36" @@ -2268,7 +2268,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", "dev": true, "requires": { "ms": "2.0.0" @@ -2301,7 +2301,7 @@ "mocha": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", - "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", + "integrity": "sha1-fYbPvPNcuCnidUwy4XNV7AUzh5Q=", "dev": true, "requires": { "browser-stdout": "1.3.0", @@ -2319,13 +2319,13 @@ "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "integrity": "sha1-FXFS/R56bI2YpbcVzzdt+SgARWM=", "dev": true }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -2353,7 +2353,7 @@ "supports-color": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -2469,7 +2469,7 @@ "codemirror": { "version": "5.35.0", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.35.0.tgz", - "integrity": "sha512-8HQICjZlDfe1ai7bvU6m2uHxuZuFgsUCdDRU9OHVB+2RTRd+FftN1ezVCqbquG0Fyq+wETqyadKhUX46DswSUQ==" + "integrity": "sha1-KAZT1JVFW8ZqqH5ihCkrAndbqHg=" }, "coffeescript": { "version": "1.12.7", @@ -3870,7 +3870,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", "dev": true, "requires": { "ms": "2.0.0" @@ -3879,7 +3879,7 @@ "globals": { "version": "11.3.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.3.0.tgz", - "integrity": "sha512-kkpcKNlmQan9Z5ZmgqKH/SMbSmjxQ7QjyNqfXVc8VJcoBV2UEg+sxQD15GQofGRh2hfpwUb70VC31DR7Rq5Hdw==", + "integrity": "sha1-4E/be5eW2K2snI9kwUg3sjEzeLA=", "dev": true }, "has-flag": { @@ -4234,7 +4234,7 @@ "file-type": { "version": "7.6.0", "resolved": "https://registry.npmjs.org/file-type/-/file-type-7.6.0.tgz", - "integrity": "sha512-EAogdjMKf0PEU26Wk+N/Qkg8JXpMRo9t70dg7+t9QvcYUZb/XfA66Hdt15g4xRdam4wgiQsg/qycKUIuZQDJog==" + "integrity": "sha1-s9v8gCkUjobzB2GyElNWKUPSHwY=" }, "filename-regex": { "version": "2.0.1", @@ -4245,7 +4245,7 @@ "filesize": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.0.tgz", - "integrity": "sha512-g5OWtoZWcPI56js1DFhIEqyG9tnu/7sG3foHwgS9KGYFMfsYguI3E+PRVCmtmE96VajQIEMRU2OhN+ME589Gdw==" + "integrity": "sha1-ItB5YVYku2/TwEAmEgYopBs/Tvo=" }, "fill-keys": { "version": "1.0.2", @@ -4411,7 +4411,7 @@ "fs-minipass": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", - "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", + "integrity": "sha1-BsJ3IYRU7CiN93raVKA7hwKqy50=", "requires": { "minipass": "2.2.1" } @@ -5394,7 +5394,7 @@ "gcs-resumable-upload": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/gcs-resumable-upload/-/gcs-resumable-upload-0.9.0.tgz", - "integrity": "sha512-+Zrmr0JKO2y/2mg953TW6JLu+NAMHqQsKzqCm7CIT24gMQakolPJCMzDleVpVjXAqB7ZCD276tcUq2ebOfqTug==", + "integrity": "sha1-ZEICFJaWrRFDWLweDPQ6YLXsBFQ=", "requires": { "buffer-equal": "1.0.0", "configstore": "3.1.1", @@ -5493,7 +5493,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "requires": { "fs.realpath": "1.0.0", "inflight": "1.0.6", @@ -5609,7 +5609,7 @@ "google-gax": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-0.14.5.tgz", - "integrity": "sha512-3A6KbrtLDavrqZnnzurnSydRIJnyH+2Sm56fAvXciQ/62aEnSDaR43MCgWhtReCLVjeFjBiCEIdX5zV0LVLVBg==", + "integrity": "sha1-ssc8Yd9s6tlPkEIdF/RP8WH2I8c=", "requires": { "extend": "3.0.1", "globby": "7.1.1", @@ -5634,7 +5634,7 @@ "google-proto-files": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/google-proto-files/-/google-proto-files-0.14.2.tgz", - "integrity": "sha512-wwm2TIlfTgAjDbjrxAb3akznO7vBM0PRLS6Xf2QfR3L7b0p+szD3iwOW0wMSFl3B0UbLv27hUVk+clePqCVmXA==", + "integrity": "sha1-lYz/6n6IiOALmmxV7RNiwGtCb0w=", "requires": { "globby": "7.1.1", "power-assert": "1.4.4", @@ -5664,7 +5664,7 @@ "grpc": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.7.3.tgz", - "integrity": "sha512-7zXQJlDXMr/ZaDqdaIchgclViyoWo8GQxZSmFUAxR8GwSr28b6/BTgF221WG+2W693jpp74XJ/+I9DcPXsgt9Q==", + "integrity": "sha1-ydA0Mk4uyKBs+qV3oEShFvlsjJA=", "requires": { "arguejs": "0.2.3", "lodash": "4.17.5", @@ -6903,7 +6903,7 @@ "domutils": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "integrity": "sha1-Vuo0HoNOBuZ0ivehyyXaZ+qfjCo=", "requires": { "dom-serializer": "0.1.0", "domelementtype": "1.3.0" @@ -7505,7 +7505,7 @@ "is-resolvable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", - "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "integrity": "sha1-+xj4fOH+uSUWnJpAfBkxijIG7Yg=", "dev": true }, "is-stream": { @@ -8028,7 +8028,7 @@ "lodash.merge": { "version": "4.6.1", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", - "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==" + "integrity": "sha1-rcJdnLmbk5HFliTzefu6YNcRHVQ=" }, "lodash.template": { "version": "4.4.0", @@ -8161,7 +8161,7 @@ "mailparser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/mailparser/-/mailparser-2.2.0.tgz", - "integrity": "sha512-HVaPa+5xQtG3CQ5SUxbDuJMRnDANC8WllUKXHm46v0tKu3I4YaUlBxg4Lpkvf+qF+kOn0lGcnQgvM6xY5mYALw==", + "integrity": "sha1-48TZUE1KX6W92C6N4tQm105F42c=", "requires": { "addressparser": "1.0.1", "he": "1.1.1", @@ -8176,7 +8176,7 @@ "mailsplit": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/mailsplit/-/mailsplit-4.1.2.tgz", - "integrity": "sha512-5UWjUfhKlC4OR5PqZKcl4h7vnz2EP4M3Zg2SBbrztvAYX5lM/rA7tvaXkZ6zRcvK32Uul0GkRA037icDbiJIOw==", + "integrity": "sha1-xhi8MRpM/IOyJqHtwbUD9akk0IM=", "requires": { "libbase64": "1.0.2", "libmime": "3.1.0", @@ -8186,7 +8186,7 @@ "libbase64": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/libbase64/-/libbase64-1.0.2.tgz", - "integrity": "sha512-CyPjvTFbsGps2Sdvy9GVjSRPvUGpji8Hxb+iunp466guzxcd3QaK0k8Hur1sPkgD9FonW8V1z2F1y066YiliEg==" + "integrity": "sha1-L/E//mmx5AFZ9JNo4w0N2LsWNbU=" } } }, @@ -8337,7 +8337,7 @@ "mime-db": { "version": "1.33.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + "integrity": "sha1-o0kgUKXLm2NFBUHjnZeI0icng9s=" }, "mime-type": { "version": "3.0.5", @@ -8379,7 +8379,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "requires": { "brace-expansion": "1.1.11" } @@ -8402,7 +8402,7 @@ "minipass": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.1.tgz", - "integrity": "sha512-u1aUllxPJUI07cOqzR7reGmQxmCqlH88uIIsf6XZFEWgw7gXKpJdR+5R9Y3KEDmWYkdIz9wXZs3C0jOPxejk/Q==", + "integrity": "sha1-WtqXU4sQJ7TPchNDJChXjLVkAR8=", "requires": { "yallist": "3.0.2" }, @@ -8417,7 +8417,7 @@ "minizlib": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz", - "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", + "integrity": "sha1-EeE2WM5GvDpwomeqxYNZ0eDCnOs=", "requires": { "minipass": "2.2.1" } @@ -8451,13 +8451,13 @@ "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "integrity": "sha1-FXFS/R56bI2YpbcVzzdt+SgARWM=", "dev": true }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", "dev": true, "requires": { "ms": "2.0.0" @@ -8472,7 +8472,7 @@ "supports-color": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -8758,7 +8758,7 @@ "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "integrity": "sha1-CKfyqL9zRgR3mp76StXMcXq7lUs=", "requires": { "are-we-there-yet": "1.1.4", "console-control-strings": "1.1.0", @@ -9032,7 +9032,7 @@ "path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "integrity": "sha1-zvMdyOCho7sNEFwM2Xzzv0f0428=", "requires": { "pify": "3.0.0" } @@ -9400,7 +9400,7 @@ "postcss-import": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-11.1.0.tgz", - "integrity": "sha512-5l327iI75POonjxkXgdRCUS+AlzAdBx4pOvMEhTKTCjb1p8IEeVR9yx3cPbmN7LIWJLbfnIXxAhoB4jpD0c/Cw==", + "integrity": "sha1-Vck2LJGSmU7GiGXSJEGd8dspgfA=", "dev": true, "requires": { "postcss": "6.0.17", @@ -9449,7 +9449,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", "dev": true }, "supports-color": { @@ -10228,7 +10228,7 @@ "pump": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "integrity": "sha1-Ejma3W5M91Jtlzy8i1zi4pCLOQk=", "requires": { "end-of-stream": "1.4.1", "once": "1.4.0" @@ -10237,7 +10237,7 @@ "pumpify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.4.0.tgz", - "integrity": "sha512-2kmNR9ry+Pf45opRVirpNuIFotsxUGLaYqxIwuR77AYrYRMuFCz9eryHBS52L360O+NcR383CL4QYlMKPq4zYA==", + "integrity": "sha1-gLfF334kFT0D8OesigWl0Gi9B/s=", "requires": { "duplexify": "3.5.3", "inherits": "2.0.3", @@ -10458,7 +10458,7 @@ "redis": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/redis/-/redis-2.8.0.tgz", - "integrity": "sha512-M1OkonEQwtRmZv4tEWF2VgpG0JWJ8Fv1PhlgT5+B+uNq2cA3Rt1Yt/ryoR+vQNOQcIEgdCdfH0jr3bDpihAw1A==", + "integrity": "sha1-ICKI4/WMSfYHnZevehDhMDrhSwI=", "requires": { "double-ended-queue": "2.1.0-0", "redis-commands": "1.3.1", @@ -10748,7 +10748,7 @@ "retry-request": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.3.1.tgz", - "integrity": "sha512-PjAmtWIxjNj4Co/6FRtBl8afRP3CxrrIAnUzb1dzydfROd+6xt7xAebFeskgQgkfFf8NmzrXIoaB3HxmswXyxw==", + "integrity": "sha1-+3EnYjWmF+l1Uem+c3q1uRWR+54=", "requires": { "request": "2.83.0", "through2": "2.0.3" @@ -11242,7 +11242,7 @@ "simple-get": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.7.0.tgz", - "integrity": "sha512-RkE9rGPHcxYZ/baYmgJtOSM63vH0Vyq+ma5TijBcLla41SWlh8t6XYIGMR/oeZcmr+/G8k+zrClkkVrtnQ0esg==", + "integrity": "sha1-rTf5JtCBKSN/8IxPLt/W8Q4DgLU=", "requires": { "decompress-response": "3.3.0", "once": "1.4.0", @@ -11261,7 +11261,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", "dev": true, "requires": { "ms": "2.0.0" @@ -11751,7 +11751,7 @@ "autoprefixer": { "version": "7.2.6", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-7.2.6.tgz", - "integrity": "sha512-Iq8TRIB+/9eQ8rbGhcP7ct5cYb/3qjNYAR2SnzLCEcwF6rvVOax8+9+fccgXk4bEhQGjOZd5TLhsksmAdsbGqQ==", + "integrity": "sha1-JWZy+G98c12oScTwfQCKuwVgZ9w=", "dev": true, "requires": { "browserslist": "2.11.3", @@ -11765,7 +11765,7 @@ "browserslist": { "version": "2.11.3", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.11.3.tgz", - "integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==", + "integrity": "sha1-/jYWeu0bvN5IJ+v+cTR6LMcLmbI=", "dev": true, "requires": { "caniuse-lite": "1.0.30000808", @@ -11998,7 +11998,7 @@ "stylelint-order": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/stylelint-order/-/stylelint-order-0.8.1.tgz", - "integrity": "sha512-8mp1P2wnI9XShYXVXDsxVigE2eXnc0C2O4ktbwUvTBwjCP4xZskIbUVxp1evSG3OK4R7hXVNl/2BnJCZkrcc/w==", + "integrity": "sha1-Nfca86FZVBVODpnlZGuj1vvjT40=", "dev": true, "requires": { "lodash": "4.17.5", @@ -12035,7 +12035,7 @@ "postcss": { "version": "6.0.19", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.19.tgz", - "integrity": "sha512-f13HRz0HtVwVaEuW6J6cOUCBLFtymhgyLPV7t4QEk2UD3twRI9IluDcQNdzQdBpiixkXj2OmzejhhTbSbDxNTg==", + "integrity": "sha1-dqeDhvZwudlJSmVb8jrAEu/9FVU=", "dev": true, "requires": { "chalk": "2.3.1", @@ -12046,7 +12046,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", "dev": true }, "supports-color": { @@ -12361,7 +12361,7 @@ "tlds": { "version": "1.199.0", "resolved": "https://registry.npmjs.org/tlds/-/tlds-1.199.0.tgz", - "integrity": "sha512-NM0jUhibJjEX4g0+1ETxOhuODIDpyvCC0A2BjxrTfMUMZ+uRZc6ZnJl9SmFtAW1s5iQgQIxezFpUij6/6OiRbg==" + "integrity": "sha1-pPyMMFghZIioCqrrtCeSUAflUhc=" }, "tmp": { "version": "0.0.33", @@ -12701,7 +12701,7 @@ "uc.micro": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.5.tgz", - "integrity": "sha512-JoLI4g5zv5qNyT09f4YAvEZIIV1oOjqnewYg5D38dkQljIzpPT296dbIGvKro3digYI1bkb7W6EP1y4uDlmzLg==" + "integrity": "sha1-DGXxX4FaoItWCmHOi023/8P0U3Y=" }, "uglify-js": { "version": "2.8.29", @@ -13201,7 +13201,7 @@ "wide-align": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "integrity": "sha1-Vx4PGwYEY268DfwhsDObvjE0FxA=", "requires": { "string-width": "1.0.2" } @@ -13319,7 +13319,7 @@ "xml2js": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "integrity": "sha1-aGwg8hMgnpSr8NG88e+qKRx4J6c=", "requires": { "sax": "1.2.1", "xmlbuilder": "9.0.7" diff --git a/package.json b/package.json index e88d1abbd7eff..e41ea8cc7b6c6 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ ], "scripts": { "start": "meteor npm i && meteor", + "debug": "meteor run --inspect", "lint": "eslint .", "lint-fix": "eslint . --fix", "stylelint": "stylelint packages/**/*.css", diff --git a/packages/meteor-accounts-saml/saml_utils.js b/packages/meteor-accounts-saml/saml_utils.js index 30eec18b57ba1..75bf93fb8d2eb 100644 --- a/packages/meteor-accounts-saml/saml_utils.js +++ b/packages/meteor-accounts-saml/saml_utils.js @@ -396,9 +396,9 @@ SAML.prototype.validateResponse = function(samlResponse, relayState, callback) { attributes.forEach(function(attribute) { const value = self.getElement(attribute, 'AttributeValue'); if (typeof value[0] === 'string') { - profile[attribute.$.Name] = value[0]; + profile[attribute.$.Name.value] = value[0]; } else { - profile[attribute.$.Name] = value[0]._; + profile[attribute.$.Name.value] = value[0]._; } }); } diff --git a/packages/rocketchat-api/server/api.js b/packages/rocketchat-api/server/api.js index c332c67f45757..4fde2efa0e2b7 100644 --- a/packages/rocketchat-api/server/api.js +++ b/packages/rocketchat-api/server/api.js @@ -28,7 +28,8 @@ class API extends Restivus { roles: 0, statusDefault: 0, _updatedAt: 0, - customFields: 0 + customFields: 0, + settings: 0 }; this._config.defaultOptionsEndpoint = function _defaultOptionsEndpoint() { @@ -145,20 +146,7 @@ class API extends Restivus { return RocketChat.API.v1.failure(e.message, e.error); } - result = result ? result : RocketChat.API.v1.success(); - - if ( - /(channels|groups)\./.test(route) - && result - && result.body - && result.body.success === true - && (result.body.channel || result.body.channels || result.body.group || result.body.groups) - ) { - // TODO: Remove this after three versions have been released. That means at 0.64 this should be gone. ;) - result.body.developerWarning = '[WARNING]: The "usernames" field has been removed for performance reasons. Please use the "*.members" endpoint to get a list of members/users in a room.'; - } - - return result; + return result ? result : RocketChat.API.v1.success(); }; for (const [name, helperMethod] of this.getHelperMethods()) { diff --git a/packages/rocketchat-api/server/v1/channels.js b/packages/rocketchat-api/server/v1/channels.js index 5cf1321164ad6..7581a3e63fed9 100644 --- a/packages/rocketchat-api/server/v1/channels.js +++ b/packages/rocketchat-api/server/v1/channels.js @@ -519,7 +519,7 @@ RocketChat.API.v1.addRoute('channels.members', { authRequired: true }, { RocketChat.API.v1.addRoute('channels.messages', { authRequired: true }, { get() { - const findResult = findChannelByIdOrName({ params: this.requestParams(), checkedArchived: false }); + const findResult = findChannelByIdOrName({ params: this.requestParams(), checkedArchived: false, returnUsernames: true }); const { offset, count } = this.getPaginationItems(); const { sort, fields, query } = this.parseJsonQuery(); diff --git a/packages/rocketchat-api/server/v1/chat.js b/packages/rocketchat-api/server/v1/chat.js index aa8404b75f251..6e3486ca34ab4 100644 --- a/packages/rocketchat-api/server/v1/chat.js +++ b/packages/rocketchat-api/server/v1/chat.js @@ -300,3 +300,20 @@ RocketChat.API.v1.addRoute('chat.getMessageReadReceipts', { authRequired: true } } } }); + +RocketChat.API.v1.addRoute('chat.reportMessage', { authRequired: true }, { + post() { + const { messageId, description } = this.bodyParams; + if (!messageId) { + return RocketChat.API.v1.failure('The required "messageId" param is missing.'); + } + + if (!description) { + return RocketChat.API.v1.failure('The required "description" param is missing.'); + } + + Meteor.runAsUser(this.userId, () => Meteor.call('reportMessage', messageId, description)); + + return RocketChat.API.v1.success(); + } +}); diff --git a/packages/rocketchat-api/server/v1/misc.js b/packages/rocketchat-api/server/v1/misc.js index 7afd4c16e981d..519a9c53d973e 100644 --- a/packages/rocketchat-api/server/v1/misc.js +++ b/packages/rocketchat-api/server/v1/misc.js @@ -18,29 +18,6 @@ RocketChat.API.v1.addRoute('info', { authRequired: false }, { } }); -RocketChat.API.v1.addRoute('settings.oauth', { authRequired: false }, { - get() { - const mountOAuthServices = () => { - const oAuthServicesEnabled = ServiceConfiguration.configurations.find({}).fetch(); - - return oAuthServicesEnabled.map((service) => { - return { - id: service._id, - name: service.service, - appId: service.appId || service.clientId, - buttonLabelText: service.buttonLabelText || '', - buttonColor: service.buttonColor || '', - buttonLabelColor: service.buttonLabelColor || '' - }; - }); - }; - - return RocketChat.API.v1.success({ - services: mountOAuthServices() - }); - } -}); - RocketChat.API.v1.addRoute('me', { authRequired: true }, { get() { const me = _.pick(this.user, [ @@ -184,3 +161,27 @@ RocketChat.API.v1.addRoute('spotlight', { authRequired: true }, { return RocketChat.API.v1.success(result); } }); + +RocketChat.API.v1.addRoute('directory', { authRequired: true }, { + get() { + const { offset, count } = this.getPaginationItems(); + const { sort, query } = this.parseJsonQuery(); + + const { text, type } = query; + const sortDirection = sort && sort === 1 ? 'asc' : 'desc'; + + const result = Meteor.runAsUser(this.userId, () => Meteor.call('browseChannels', { + text, + type, + sort: sortDirection, + page: offset, + limit: count + })); + + if (!result) { + return RocketChat.API.v1.failure('Please verify the parameters'); + } + return RocketChat.API.v1.success({ result }); + + } +}); diff --git a/packages/rocketchat-api/server/v1/rooms.js b/packages/rocketchat-api/server/v1/rooms.js index 3dd8eebc4d9c1..b4bda08164b65 100644 --- a/packages/rocketchat-api/server/v1/rooms.js +++ b/packages/rocketchat-api/server/v1/rooms.js @@ -1,5 +1,28 @@ import Busboy from 'busboy'; +function findRoomByIdOrName({ params, checkedArchived = true}) { + if ((!params.roomId || !params.roomId.trim()) && (!params.roomName || !params.roomName.trim())) { + throw new Meteor.Error('error-roomid-param-not-provided', 'The parameter "roomId" or "roomName" is required'); + } + + const fields = { ...RocketChat.API.v1.defaultFieldsToExclude }; + + let room; + if (params.roomId) { + room = RocketChat.models.Rooms.findOneById(params.roomId, { fields }); + } else if (params.roomName) { + room = RocketChat.models.Rooms.findOneByName(params.roomName, { fields }); + } + if (!room) { + throw new Meteor.Error('error-room-not-found', 'The required "roomId" or "roomName" param provided does not match any channel'); + } + if (checkedArchived && room.archived) { + throw new Meteor.Error('error-room-archived', `The channel, ${ room.name }, is archived`); + } + + return room; +} + RocketChat.API.v1.addRoute('rooms.get', { authRequired: true }, { get() { const { updatedSince } = this.queryParams; @@ -115,3 +138,20 @@ RocketChat.API.v1.addRoute('rooms.saveNotification', { authRequired: true }, { return RocketChat.API.v1.success(); } }); + +RocketChat.API.v1.addRoute('rooms.favorite', { authRequired: true }, { + post() { + const { favorite } = this.bodyParams; + + if (!this.bodyParams.hasOwnProperty('favorite')) { + return RocketChat.API.v1.failure('The \'favorite\' param is required'); + } + + const room = findRoomByIdOrName({ params: this.bodyParams }); + + Meteor.runAsUser(this.userId, () => Meteor.call('toggleFavorite', room._id, favorite)); + + return RocketChat.API.v1.success(); + } +}); + diff --git a/packages/rocketchat-api/server/v1/settings.js b/packages/rocketchat-api/server/v1/settings.js index 3662ba1485303..ac54adfd28e87 100644 --- a/packages/rocketchat-api/server/v1/settings.js +++ b/packages/rocketchat-api/server/v1/settings.js @@ -29,6 +29,33 @@ RocketChat.API.v1.addRoute('settings.public', { authRequired: false }, { } }); +RocketChat.API.v1.addRoute('settings.oauth', { authRequired: false }, { + get() { + const mountOAuthServices = () => { + const oAuthServicesEnabled = ServiceConfiguration.configurations.find({}, { fields: { secret: 0 } }).fetch(); + + return oAuthServicesEnabled.map((service) => { + if (service.custom) { + return { ...service }; + } + return { + id: service._id, + name: service.service, + clientId: service.appId || service.clientId, + buttonLabelText: service.buttonLabelText || '', + buttonColor: service.buttonColor || '', + buttonLabelColor: service.buttonLabelColor || '', + custom: false + }; + }); + }; + + return RocketChat.API.v1.success({ + services: mountOAuthServices() + }); + } +}); + RocketChat.API.v1.addRoute('settings', { authRequired: true }, { get() { const { offset, count } = this.getPaginationItems(); @@ -90,7 +117,7 @@ RocketChat.API.v1.addRoute('service.configurations', { authRequired: false }, { const ServiceConfiguration = Package['service-configuration'].ServiceConfiguration; return RocketChat.API.v1.success({ - configurations: ServiceConfiguration.configurations.find({}, {fields: {secret: 0}}).fetch() + configurations: ServiceConfiguration.configurations.find({}, { fields: { secret: 0 } }).fetch() }); } }); diff --git a/packages/rocketchat-api/server/v1/users.js b/packages/rocketchat-api/server/v1/users.js index 768bbd164ce75..12ae7a470b875 100644 --- a/packages/rocketchat-api/server/v1/users.js +++ b/packages/rocketchat-api/server/v1/users.js @@ -335,6 +335,7 @@ RocketChat.API.v1.addRoute('users.setPreferences', { authRequired: true }, { enableAutoAway: Match.Maybe(Boolean), highlights: Match.Maybe(Array), desktopNotificationDuration: Match.Maybe(Number), + messageViewMode: Match.Maybe(Number), hideUsernames: Match.Maybe(Boolean), hideRoles: Match.Maybe(Boolean), hideAvatars: Match.Maybe(Boolean), @@ -393,3 +394,18 @@ RocketChat.API.v1.addRoute('user.roles', { authRequired: true }, { })); } }); + +RocketChat.API.v1.addRoute('users.forgotPassword', { authRequired: false }, { + post() { + const { email } = this.bodyParams; + if (!email) { + return RocketChat.API.v1.failure('The \'email\' param is required'); + } + + const emailSent = Meteor.call('sendForgotPasswordEmail', email); + if (emailSent) { + return RocketChat.API.v1.success(); + } + return RocketChat.API.v1.failure('User not found'); + } +}); diff --git a/packages/rocketchat-apps/README.md b/packages/rocketchat-apps/README.md index 65b130d4c5d76..e314d30598d22 100644 --- a/packages/rocketchat-apps/README.md +++ b/packages/rocketchat-apps/README.md @@ -8,4 +8,4 @@ An orchestrator is the file/class which is responsible for orchestrating (starti A bridge is a file/class which is responsible for bridging the Rocket.Chat system's data and the App system's data. They are implementations of the interfaces inside of the Rocket.Chat Apps-engine project `src/server/bridges`. They allow the two systems to talk to each other (hince the name bridge, as they "bridge the gap"). ## What is a "Converter"? -A converter does what the name implies, it handles converting from one system's data type into the other's. +A converter does what the name implies, it handles converting from one system's data type into the other's. **Note**: This causes a schema to be forced on the rooms and messages. diff --git a/packages/rocketchat-apps/client/admin/appInstall.js b/packages/rocketchat-apps/client/admin/appInstall.js index fc0caa695f376..f41dcb84401bd 100644 --- a/packages/rocketchat-apps/client/admin/appInstall.js +++ b/packages/rocketchat-apps/client/admin/appInstall.js @@ -29,12 +29,17 @@ Template.appInstall.onCreated(function() { instance.file = new ReactiveVar(''); instance.isInstalling = new ReactiveVar(false); instance.appUrl = new ReactiveVar(''); + instance.isUpdatingId = new ReactiveVar(''); // Allow passing in a url as a query param to show installation of if (FlowRouter.getQueryParam('url')) { instance.appUrl.set(FlowRouter.getQueryParam('url')); FlowRouter.setQueryParams({ url: null }); } + + if (FlowRouter.getQueryParam('isUpdatingId')) { + instance.isUpdatingId.set(FlowRouter.getQueryParam('isUpdatingId')); + } }); Template.appInstall.events({ @@ -55,13 +60,21 @@ Template.appInstall.events({ if (url) { try { t.isInstalling.set(true); - const result = await RocketChat.API.post('apps', { url }); + let result; + + if (t.isUpdatingId.get()) { + result = await RocketChat.API.post(`apps/${ t.isUpdatingId.get() }`, { url }); + } else { + result = await RocketChat.API.post('apps', { url }); + } + FlowRouter.go(`/admin/apps/${ result.app.id }`); } catch (err) { console.warn('err', err); } finally { t.isInstalling.set(false); } + return; } @@ -85,7 +98,14 @@ Template.appInstall.events({ t.isInstalling.set(true); try { - const result = await RocketChat.API.upload('apps', data); + let result; + + if (t.isUpdatingId.get()) { + result = await RocketChat.API.upload(`apps/${ t.isUpdatingId.get() }`, data); + } else { + result = await RocketChat.API.upload('apps', data); + } + FlowRouter.go(`/admin/apps/${ result.app.id }`); } catch (err) { console.warn('err', err); diff --git a/packages/rocketchat-apps/client/admin/appLogs.js b/packages/rocketchat-apps/client/admin/appLogs.js index 94071b3564c32..3a2eac8043f30 100644 --- a/packages/rocketchat-apps/client/admin/appLogs.js +++ b/packages/rocketchat-apps/client/admin/appLogs.js @@ -59,13 +59,17 @@ Template.appLogs.helpers({ return moment(date).format('L LTS'); }, jsonStringify(data) { + let value = ''; + if (!data) { - return ''; + return value; } else if (typeof data === 'object') { - return hljs.highlight('json', JSON.stringify(data, null, 2)).value; + value = hljs.highlight('json', JSON.stringify(data, null, 2)).value; } else { - return hljs.highlight('json', data).value; + value = hljs.highlight('json', data).value; } + + return value.replace(/\\\\n/g, '
'); } }); diff --git a/packages/rocketchat-apps/client/admin/appManage.html b/packages/rocketchat-apps/client/admin/appManage.html index b27c8a2df044d..1bacc0d9cf810 100644 --- a/packages/rocketchat-apps/client/admin/appManage.html +++ b/packages/rocketchat-apps/client/admin/appManage.html @@ -24,7 +24,7 @@
{{name}}
-
v {{version}}
+
v{{version}}
{{description}}
@@ -55,31 +55,31 @@
{{#if $eq type 'string'}} -
- - {{# if i18nDescription}} -
{{{parseDescription i18nDescription}}}
- {{/if}} - {{# if i18nAlert}} -
-
- {{> icon block="rc-input__error-icon" icon="warning" classes="rc-input__error-icon-svg"}} +
+ + {{# if i18nDescription}} +
{{{parseDescription i18nDescription}}}
+ {{/if}} + {{# if i18nAlert}} +
+
+ {{> icon block="rc-input__error-icon" icon="warning" classes="rc-input__error-icon-svg"}} +
+
{{_ "i18nAlert"}}
-
{{_ "i18nAlert"}}
+ {{/if}}
- {{/if}} -
{{else if $eq type 'boolean'}} -
+
{{{parseDescription i18nDescription}}}
- {{else if $eq type 'int'}} + {{else if $eq type 'int'}}
{{/if}}
- {{else if $eq type 'password'}} + {{else if $eq type 'password'}}
{{/if}}
- {{else}} -
- -
- {{#if $eq type 'relativeUrl'}} - + {{else if $eq type 'relativeUrl'}} +
+ + {{# if i18nDescription}} +
{{{parseDescription i18nDescription}}}
{{/if}} - - {{#if $eq type 'select'}} -
- + {{# if i18nAlert}} +
+
+ {{> icon block="rc-input__error-icon" icon="warning" classes="rc-input__error-icon-svg"}} +
+
{{_ "i18nAlert"}}
- {{/if}} - - {{#if $eq type 'language'}} -
- +
+ {{else if $eq type 'font'}} +
+ + {{# if i18nDescription}} +
{{{parseDescription i18nDescription}}}
+ {{/if}} + {{# if i18nAlert}} +
+
+ {{> icon block="rc-input__error-icon" icon="warning" classes="rc-input__error-icon-svg"}} +
+
{{_ "i18nAlert"}}
- {{/if}} - - {{#if $eq type 'color'}} -
- {{#if $eq editor 'color'}} -
- - +
+ {{else if $eq type 'code'}} +
+