mirror of https://github.com/OCA/social.git
[FIX] mail_tracking: mixed classes
In migration #873 the classes DiscussController and MailController which are the result of an upstream functionality split are merge altogether in this module override causing undesired side effects in other modules trying to extend those (i.e.: portal) TT41432pull/1053/head
parent
3807245955
commit
61a3307900
|
@ -1,3 +1,4 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import main
|
||||
from . import discuss
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from odoo import http
|
||||
|
||||
from odoo.addons.mail.controllers.discuss import DiscussController
|
||||
|
||||
|
||||
class MailTrackingDiscussController(DiscussController):
|
||||
@http.route()
|
||||
def mail_init_messaging(self):
|
||||
"""Route used to initial values of Discuss app"""
|
||||
values = super().mail_init_messaging()
|
||||
values.update(
|
||||
{"failed_counter": http.request.env["mail.message"].get_failed_count()}
|
||||
)
|
||||
return values
|
||||
|
||||
@http.route("/mail/failed/messages", methods=["POST"], type="json", auth="user")
|
||||
def discuss_failed_messages(self, max_id=None, min_id=None, limit=30, **kwargs):
|
||||
return http.request.env["mail.message"]._message_fetch(
|
||||
domain=[("is_failed_message", "=", True)],
|
||||
max_id=max_id,
|
||||
min_id=min_id,
|
||||
limit=limit,
|
||||
)
|
|
@ -10,7 +10,6 @@ import werkzeug
|
|||
import odoo
|
||||
from odoo import SUPERUSER_ID, api, http
|
||||
|
||||
from odoo.addons.mail.controllers.discuss import DiscussController
|
||||
from odoo.addons.mail.controllers.mail import MailController
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
@ -30,7 +29,7 @@ def db_env(dbname):
|
|||
yield api.Environment(cr, SUPERUSER_ID, {})
|
||||
|
||||
|
||||
class MailTrackingController(MailController, DiscussController):
|
||||
class MailTrackingController(MailController):
|
||||
def _request_metadata(self):
|
||||
"""Prepare remote info metadata"""
|
||||
request = http.request.httprequest
|
||||
|
@ -97,21 +96,3 @@ class MailTrackingController(MailController, DiscussController):
|
|||
response.mimetype = "image/gif"
|
||||
response.data = base64.b64decode(BLANK)
|
||||
return response
|
||||
|
||||
@http.route()
|
||||
def mail_init_messaging(self):
|
||||
"""Route used to initial values of Discuss app"""
|
||||
values = super().mail_init_messaging()
|
||||
values.update(
|
||||
{"failed_counter": http.request.env["mail.message"].get_failed_count()}
|
||||
)
|
||||
return values
|
||||
|
||||
@http.route("/mail/failed/messages", methods=["POST"], type="json", auth="user")
|
||||
def discuss_failed_messages(self, max_id=None, min_id=None, limit=30, **kwargs):
|
||||
return http.request.env["mail.message"]._message_fetch(
|
||||
domain=[("is_failed_message", "=", True)],
|
||||
max_id=max_id,
|
||||
min_id=min_id,
|
||||
limit=limit,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue