FIX: ensures users can open channel invites (#24067)

We were incorrectly generating URLs with message id even when it was not provided, resulting in a route ending with "undefined", which was causing an error.

This commit also uses this opportunity to:
- move `invite_users` into a proper controller inside the API namespace
- refactors the code into a service: `Chat::InviteUsersToChannel`
This commit is contained in:
Joffrey JAFFEUX
2023-10-24 18:51:33 +02:00
committed by GitHub
parent 930dc38500
commit 5fec841c19
16 changed files with 355 additions and 175 deletions

View File

@ -91,7 +91,7 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
.dom(".mention-without-membership-notice__body__link")
.hasText(I18n.t("chat.mention_warning.invite"));
pretender.put(`/chat/${this.channel.id}/invite`, () => {
pretender.post(`/chat/api/channels/${this.channel.id}/invites`, () => {
return [200, { "Content-Type": "application/json" }, {}];
});