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

[IMPROVE] Replace livechat:departments publication by REST Calls #15478

Merged
merged 9 commits into from
Oct 4, 2019

Conversation

MarcosSpessatto
Copy link
Member

No description provided.

@MarcosSpessatto MarcosSpessatto changed the title [BREAK] Replace publications to Rest Calls [BREAK] Replace livechat:departments to REST Calls Oct 1, 2019
@MarcosSpessatto MarcosSpessatto marked this pull request as ready for review October 2, 2019 15:56
@MarcosSpessatto MarcosSpessatto added this to the 2.2.0 milestone Oct 2, 2019
@MarcosSpessatto MarcosSpessatto changed the title [BREAK] Replace livechat:departments to REST Calls [IMPROVE] Replace livechat:departments to REST Calls Oct 3, 2019
}
}
this.autorun(async () => {
const { department, agents } = await APIClient.v1.get(`livechat/department/${ FlowRouter.getParam('_id') }`);
Copy link
Member

Choose a reason for hiding this comment

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

it is currently doing the request even without an _id .. this request is only needed when editing a department

const room = LivechatRoom.findOne({ _id: rid });
this.visitorId.set(room && room.v && room.v._id);
this.departmentId.set(room && room.departmentId);
this.tags.set(room && room.tags);
const { department } = await APIClient.v1.get(`livechat/department/${ this.departmentId.get() }`);
Copy link
Member

Choose a reason for hiding this comment

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

this is being called on every message sent (due to changes on room object).

I recommend moving this GET to a separate autorun orbserving only this.departmentId

@sampaiodiego sampaiodiego changed the title [IMPROVE] Replace livechat:departments to REST Calls [IMPROVE] Replace livechat:departments publication by REST Calls Oct 4, 2019
@sampaiodiego sampaiodiego merged commit 4ac63d8 into develop Oct 4, 2019
@sampaiodiego sampaiodiego deleted the change-publications-to-rest branch October 4, 2019 20:28
@rodrigok rodrigok mentioned this pull request Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants