-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Conversation
# 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 Please don't forget to add these new endpoints to the documentation. Thanks! |
@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. |
# Conflicts: # package-lock.json
}, | ||
}); | ||
|
||
RocketChat.API.v1.addRoute('livechat/config/:token', { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) }); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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.
This reverts commit 41994f1.
|
||
html = `${ html }</div>`; | ||
|
||
let fromEmail = RocketChat.settings.get('From_Email').match(/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/i); |
There was a problem hiding this comment.
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?
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.