mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 21:52:00 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -0,0 +1,27 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
from odoo.addons.mail.controllers.thread import ThreadController
|
||||
from odoo.addons.mail.tools.discuss import add_guest_to_context, Store
|
||||
|
||||
|
||||
class MessageReactionController(ThreadController):
|
||||
@http.route("/mail/message/reaction", methods=["POST"], type="jsonrpc", auth="public")
|
||||
@add_guest_to_context
|
||||
def mail_message_reaction(self, message_id, content, action, **kwargs):
|
||||
message = self._get_message_with_access(int(message_id), mode="create", **kwargs)
|
||||
if not message:
|
||||
raise NotFound()
|
||||
partner, guest = self._get_reaction_author(message, **kwargs)
|
||||
if not partner and not guest:
|
||||
raise NotFound()
|
||||
store = Store()
|
||||
# sudo: mail.message - access mail.message.reaction through an accessible message is allowed
|
||||
message.sudo()._message_reaction(content, action, partner, guest, store)
|
||||
return store.get_result()
|
||||
|
||||
def _get_reaction_author(self, message, **kwargs):
|
||||
return request.env["res.partner"]._get_current_persona()
|
||||
Loading…
Add table
Add a link
Reference in a new issue