Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
Browse files Browse the repository at this point in the history
…nto view-logs

* 'develop' of https://github.com/RocketChat/Rocket.Chat:
  [NEW] Allow to send Agent custom fields through the Omnichannel CRM integration (#16286)
  [FIX] Spotify embed and collapsed (#17356)
  Improve: Better Push Notification code (#17338)
  LingoHub Update 🚀 (#17365)
  [FIX] Allow Screensharing in BBB Iframe (#17290)
  [NEW] Make the header for rooms clickable (#16762)
  Import data pagination (#17355)
  Allow to set a comment when forwarding omnichannel rooms. (#17353)
  [FIX] Web Client memory leak caused by the Emoji library (#17320)
  [FIX] Omnichannel room info panel opening whenever a message is sent (#17348)
  [FIX] New user added by admin doesn't receive random password email (#17249)
  Bump https-proxy-agent from 2.2.1 to 2.2.4 (#17323)
  [NEW] Adds ability for Rocket.Chat Apps to create discussions (#16683)
  Add possibility to sort the Omnichannel current chats list by column (#17347)
  [IMPROVE] Redesign Administration > Import (#17289)
  • Loading branch information
dudizilla committed Apr 20, 2020
2 parents 584d60e + 83240bc commit 68342c7
Show file tree
Hide file tree
Showing 80 changed files with 2,965 additions and 1,441 deletions.
2 changes: 0 additions & 2 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ nooitaf:colors
ostrio:cookies
pauli:accounts-linkedin
raix:handlebar-helpers
rocketchat:push
raix:ui-dropped-event

rocketchat:tap-i18n
Expand All @@ -87,7 +86,6 @@ matb33:collection-hooks
meteorhacks:inject-initial
[email protected]
[email protected]
raix:eventemitter
[email protected]
[email protected]
templating
Expand Down
2 changes: 0 additions & 2 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ pauli:[email protected]
pauli:[email protected]
[email protected]
raix:[email protected]
raix:[email protected]
raix:[email protected]
raix:[email protected]
[email protected]
Expand All @@ -127,7 +126,6 @@ rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
Expand Down
3 changes: 2 additions & 1 deletion .storybook/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@babel/preset-flow"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining"
]
}
8 changes: 2 additions & 6 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { withKnobs } from '@storybook/addon-knobs';
import { MINIMAL_VIEWPORTS, INITIAL_VIEWPORTS } from '@storybook/addon-viewport/dist/defaults';
import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport/dist/defaults';
import { addDecorator, addParameters, configure } from '@storybook/react';

import { rocketChatDecorator } from './mocks/decorators';

addParameters({
viewport: {
viewports: {
...MINIMAL_VIEWPORTS,
...INITIAL_VIEWPORTS,
},
defaultViewport: 'responsive',
viewports: MINIMAL_VIEWPORTS,
},
});

Expand Down
4 changes: 2 additions & 2 deletions app/api/server/v1/push.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { Push } from 'meteor/rocketchat:push';

import { appTokensCollection } from '../../../push/server';
import { API } from '../api';

API.v1.addRoute('push.token', { authRequired: true }, {
Expand Down Expand Up @@ -47,7 +47,7 @@ API.v1.addRoute('push.token', { authRequired: true }, {
throw new Meteor.Error('error-token-param-not-valid', 'The required "token" body param is missing or invalid.');
}

const affectedRecords = Push.appCollection.remove({
const affectedRecords = appTokensCollection.remove({
$or: [{
'token.apn': token,
}, {
Expand Down
35 changes: 33 additions & 2 deletions app/apps/server/bridges/rooms.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { RoomType } from '@rocket.chat/apps-engine/definition/rooms';
import { Meteor } from 'meteor/meteor';

import { Rooms, Subscriptions, Users } from '../../../models/server';
import { addUserToRoom } from '../../../lib/server/functions/addUserToRoom';
import { Rooms, Subscriptions, Users } from '../../../models/server';

export class AppRoomBridge {
constructor(orch) {
Expand Down Expand Up @@ -120,4 +120,35 @@ export class AppRoomBridge {
addUserToRoom(rm._id, member);
}
}

async createDiscussion(room, parentMessage = null, reply = '', members = [], appId) {
this.orch.debugLog(`The App ${ appId } is creating a new discussion.`, room);

const rcRoom = this.orch.getConverters().get('rooms').convertAppRoom(room);

let rcMessage;
if (parentMessage) {
rcMessage = this.orch.getConverters().get('messages').convertAppMessage(parentMessage);
}

if (!rcRoom.prid || !Rooms.findOneById(rcRoom.prid)) {
throw new Error('There must be a parent room to create a discussion.');
}

const discussion = {
prid: rcRoom.prid,
t_name: rcRoom.fname,
pmid: rcMessage ? rcMessage._id : undefined,
reply: reply && reply.trim() !== '' ? reply : undefined,
users: members.length > 0 ? members : [],
};

let rid;
Meteor.runAsUser(room.creator.id, () => {
const info = Meteor.call('createDiscussion', discussion);
rid = info.rid;
});

return rid;
}
}
11 changes: 11 additions & 0 deletions app/apps/server/converters/rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class AppRoomsConverter {
closedAt: room.closedAt,
lm: room.lastModifiedAt,
customFields: room.customFields,
prid: typeof room.parentRoom === 'undefined' ? undefined : room.parentRoom.id,
};

return Object.assign(newRoom, room._unmappedProperties_);
Expand Down Expand Up @@ -195,7 +196,17 @@ export class AppRoomsConverter {

return this.orch.getConverters().get('users').convertById(responseBy._id);
},
parentRoom: (room) => {
const { prid } = room;

if (!prid) {
return undefined;
}

delete room.prid;

return this.orch.getConverters().get('rooms').convertById(prid);
},
};

return transformMappedData(room, map);
Expand Down
2 changes: 1 addition & 1 deletion app/authorization/server/functions/hasPermission.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Permissions, Users, Subscriptions } from '../../../models/server/raw';
const rolesHasPermission = mem(async (permission, roles) => {
const result = await Permissions.findOne({ _id: permission, roles: { $in: roles } });
return !!result;
});
}, process.env.TEST_MODE === 'true' ? { maxAge: 0 } : undefined);

const getRoles = mem(async (uid, scope) => {
const { roles: userRoles = [] } = await Users.findOne({ _id: uid });
Expand Down
9 changes: 5 additions & 4 deletions app/emoji-emojione/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ emojione.emojioneList[':asterisk_symbol:'] = {

// fix for :+1: - had to replace all function that does its conversion: https://github.com/joypixels/emojione/blob/4.5.0/lib/js/emojione.js#L249
(function(ns) {
ns.shortnameConversionMap = mem(ns.shortnameConversionMap);
ns.unicodeCharRegex = mem(ns.unicodeCharRegex);
ns.shortnameConversionMap = mem(ns.shortnameConversionMap, { maxAge: 1000 });

ns.unicodeCharRegex = mem(ns.unicodeCharRegex, { maxAge: 1000 });

const convertShortName = mem(function(shortname) {
// the fix is basically adding this .replace(/[+]/g, '\\$&')
Expand Down Expand Up @@ -202,7 +203,7 @@ emojione.emojioneList[':asterisk_symbol:'] = {
return `<span class="emojione emojione-${ category } _${ fname }" ${ title }>${ alt }</span>`;
}
return `<img class="emojione" alt="${ alt }" ${ title } src="${ ePath }${ fname }${ ns.fileExtension }"/>`;
});
}, { maxAge: 1000 });

const convertUnicode = mem(function(entire, m1, m2, m3) {
const mappedUnicode = ns.mapUnicodeToShort();
Expand All @@ -228,7 +229,7 @@ emojione.emojioneList[':asterisk_symbol:'] = {
return `${ m2 }<span class="emojione emojione-${ category } _${ unicode }" ${ title }>${ alt }</span>`;
}
return `${ m2 }<img class="emojione" alt="${ alt }" ${ title } src="${ ePath }${ unicode }${ ns.fileExtension }"/>`;
});
}, { maxAge: 1000 });

ns.shortnameToImage = function(str) {
// replace regular shortnames first
Expand Down
55 changes: 0 additions & 55 deletions app/importer/client/admin/adminImport.html

This file was deleted.

136 changes: 0 additions & 136 deletions app/importer/client/admin/adminImport.js

This file was deleted.

Loading

0 comments on commit 68342c7

Please sign in to comment.