Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Livechat REST endpoints #11900

Merged
merged 23 commits into from
Sep 20, 2018
Merged

Conversation

renatobecker-zz
Copy link

This PR provides new Livechat REST endpoints, which will be used in the new Livechat client, replacing the Meteor.methods that we are currently using.

# Conflicts:
#	packages/rocketchat-livechat/imports/server/rest/visitors.js
#	packages/rocketchat-livechat/server/lib/Livechat.js
#	packages/rocketchat-livechat/server/methods/sendOfflineMessage.js
#	packages/rocketchat-livechat/server/methods/sendTranscript.js
# Conflicts:
#	packages/rocketchat-livechat/server/models/Rooms.js
@renatobecker-zz renatobecker-zz added this to the 0.70.0 milestone Aug 29, 2018
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11900 August 29, 2018 20:34 Inactive
@MartinSchoeler
Copy link
Contributor

@renatobecker Please don't forget to add these new endpoints to the documentation. Thanks!

@MartinSchoeler MartinSchoeler added the documentation: needed Needs addition/changes to documentation label Aug 30, 2018
@renatobecker-zz
Copy link
Author

@MartinSchoeler, yes, the documentation is something I've already planned .. I'm just waiting for the approval of the PR to start doing it.

Thanks.

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11900 September 5, 2018 13:29 Inactive
MarcosSpessatto
MarcosSpessatto previously approved these changes Sep 5, 2018
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11900 September 11, 2018 14:15 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11900 September 11, 2018 19:46 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11900 September 14, 2018 20:37 Inactive
},
});

RocketChat.API.v1.addRoute('livechat/config/:token', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this endpoint can be combined with the above one, having token as an option parameter.

import _ from 'underscore';
import LivechatVisitors from '../../models/LivechatVisitors';

export const online = RocketChat.models.Users.findOnlineAgents().count() > 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a function as well because it currently runs only at startup and will always reflect the initial server state..

changing to a function will make it be evaluated every time it's called, which is the desired behavior.

ts: new Date(),
};

return RocketChat.Livechat.getRoom(guest, message, { jitsiTimeout: new Date(Date.now() + 3600 * 1000) });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the jitsiTimeout param should be used only on video.call endpoint..

};
};

export const settings = config();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as online comment above, settings should be evaluated every time it is requested.. the current implementation does not get updated if I change any setting while the server is running.

@@ -0,0 +1,32 @@
import livechat from '../lib/livechat';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on previous files only used items were imported, I suggest to to the same here.

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11900 September 19, 2018 19:33 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11900 September 19, 2018 22:46 Inactive

html = `${ html }</div>`;

let fromEmail = RocketChat.settings.get('From_Email').match(/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/i);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if using TLD like .photography?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants