Skip to content
Snippets Groups Projects

:sparkles: block more discuss features

Merged Vincent Hatakeyama requested to merge topic/17.0/more into branch/17.0
Files
5
+ 28
3
@@ -32,5 +32,19 @@
channel = self.env["discuss.channel"].browse(record.res_id)
if channel.channel_type == "chat":
# check that all members have messaging group
users = self.sudo().env["res.users"].search([("partner_id", "in", channel.mapped("channel_member_ids.partner_id.id"))])
users = (
self.sudo()
.env["res.users"]
.search(
[
(
"partner_id",
"in",
channel.mapped(
"channel_member_ids.partner_id.id"
),
)
]
)
)
for user in users:
@@ -36,4 +50,15 @@
for user in users:
if not user.has_group("mail_messaging_group.group_messaging") and not user.has_group("base.group_public") and not user.has_group("base.group_portal"):
raise AccessError(_("Creating messages to user that can not read them is not allowed."))
if (
not user.has_group(
"mail_messaging_group.group_messaging"
)
and not user.has_group("base.group_public")
and not user.has_group("base.group_portal")
):
raise AccessError(
_(
"Creating messages to user that can not read "
"them is not allowed."
)
)
return created
Loading