From 8705fad5391c7e986c90f3fa960142edcaec8dec Mon Sep 17 00:00:00 2001 From: ThomasRoehl Date: Fri, 26 Jan 2018 13:38:45 +0100 Subject: [PATCH 1/3] fixed help request api --- .gitignore | 2 ++ packages/assistify-help-request/server/api.js | 4 +++- packages/assistify-help-request/server/types.js | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3f7fd5b8134e..0789ccbb3746 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,5 @@ pm2.json settings.json build.sh /public/livechat +.screenshots +packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json diff --git a/packages/assistify-help-request/server/api.js b/packages/assistify-help-request/server/api.js index 324442642b5c..8482d9429b19 100755 --- a/packages/assistify-help-request/server/api.js +++ b/packages/assistify-help-request/server/api.js @@ -39,6 +39,7 @@ export class HelpRequestApi { return new HelpDiscussionCreatedResponse( HelpRequestApi.getUrlForRoom(creationResult.room), + creationResult._id, creationResult.members ); } @@ -129,7 +130,7 @@ export class HelpRequestApi { let channel = {}; try { Meteor.runAsUser(seekerUser._id, () => { - channel = Meteor.call('createRequest', `Assistify_${ HelpRequestApi.getNextAssistifyRoomCode() }`, '', providerUsers.map((user) => user.username), environment); + channel = Meteor.call('createRequest', `Assistify_${ HelpRequestApi.getNextAssistifyRoomCode() }`, '', '', providerUsers.map((user) => user.username), environment); try { if (message) { RocketChat.sendMessage({ @@ -151,6 +152,7 @@ export class HelpRequestApi { const roomCreated = RocketChat.models.Rooms.findOne({_id: channel.rid}); return { room: roomCreated, + _id: channel.rid, members: roomCreated.usernames.map((user) => { return {username: user}; }) diff --git a/packages/assistify-help-request/server/types.js b/packages/assistify-help-request/server/types.js index c91393be6c9c..1bc347a65c56 100755 --- a/packages/assistify-help-request/server/types.js +++ b/packages/assistify-help-request/server/types.js @@ -1,8 +1,9 @@ // Definition of value objects. No clue why export interface is not supported export class HelpDiscussionCreatedResponse { - constructor(url, members) { + constructor(url, id, members) { this.success = true; this.url = url; + this.id = id; this.members = members; } } From f92e3af47a825e8cf7498b940ece7aa577af2c96 Mon Sep 17 00:00:00 2001 From: ThomasRoehl Date: Sun, 28 Jan 2018 17:42:56 +0100 Subject: [PATCH 2/3] changed response to return room --- packages/assistify-help-request/server/api.js | 3 +-- packages/assistify-help-request/server/types.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/assistify-help-request/server/api.js b/packages/assistify-help-request/server/api.js index 8482d9429b19..098bbe2e9228 100755 --- a/packages/assistify-help-request/server/api.js +++ b/packages/assistify-help-request/server/api.js @@ -39,7 +39,7 @@ export class HelpRequestApi { return new HelpDiscussionCreatedResponse( HelpRequestApi.getUrlForRoom(creationResult.room), - creationResult._id, + creationResult.room, creationResult.members ); } @@ -152,7 +152,6 @@ export class HelpRequestApi { const roomCreated = RocketChat.models.Rooms.findOne({_id: channel.rid}); return { room: roomCreated, - _id: channel.rid, members: roomCreated.usernames.map((user) => { return {username: user}; }) diff --git a/packages/assistify-help-request/server/types.js b/packages/assistify-help-request/server/types.js index 1bc347a65c56..fae05f86be7e 100755 --- a/packages/assistify-help-request/server/types.js +++ b/packages/assistify-help-request/server/types.js @@ -1,9 +1,9 @@ // Definition of value objects. No clue why export interface is not supported export class HelpDiscussionCreatedResponse { - constructor(url, id, members) { + constructor(url, room, members) { this.success = true; this.url = url; - this.id = id; + this.room = room; this.members = members; } } From f1e192319a1496a461018ff1eec6fed96f0f1aae Mon Sep 17 00:00:00 2001 From: ThomasRoehl Date: Thu, 1 Feb 2018 16:12:42 +0100 Subject: [PATCH 3/3] changed room information in response --- packages/assistify-help-request/server/types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/assistify-help-request/server/types.js b/packages/assistify-help-request/server/types.js index fae05f86be7e..38926d78a923 100755 --- a/packages/assistify-help-request/server/types.js +++ b/packages/assistify-help-request/server/types.js @@ -3,7 +3,7 @@ export class HelpDiscussionCreatedResponse { constructor(url, room, members) { this.success = true; this.url = url; - this.room = room; + this.room = {'_id': room._id, 'name': room.name, 't': room.t, 'expertise': room.expertise, 'topic': room.topic, 'helpRequestId': room.helpRequestId}; this.members = members; } }