Conversation
c2ef850 to
4126ad1
Compare
AndreuOForgeFlow
left a comment
There was a problem hiding this comment.
Interesting feature 💯 LGTM 👍
a47197b to
aaee1f3
Compare
GuillemCForgeFlow
left a comment
There was a problem hiding this comment.
the main problem is that it should be following the odoo way to load messages, so we should adapt more to follow odoo standards.
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
There was a problem hiding this comment.
| # Part of Odoo. See LICENSE file for full copyright and licensing details. |
I would remove these copyright statements, it doesn't apply for OCA modules
| class MailboxControllerExtended(http.Controller): | ||
| @http.route( | ||
| "/mail/sent_history/messages", methods=["POST"], type="json", auth="user" | ||
| ) | ||
| def discuss_sent_history_messages( | ||
| self, search_term=None, before=None, after=None, limit=30, around=None | ||
| ): | ||
| partner_id = request.env.user.partner_id.id | ||
| domain = [("author_id", "=", partner_id), ("message_type", "in", ["comment"])] | ||
| res = request.env["mail.message"]._message_fetch( | ||
| domain, | ||
| search_term=search_term, | ||
| before=before, | ||
| after=after, | ||
| around=around, | ||
| limit=limit, | ||
| ) | ||
| return {**res, "messages": res["messages"].message_format()} |
There was a problem hiding this comment.
this is never used, right? where is it called?
| def get_sent_history(self): | ||
| partner = self.env.user.partner_id | ||
|
|
||
| messages = self.search( | ||
| [ | ||
| ("author_id", "=", partner.id), | ||
| ("message_type", "in", ["comment"]), | ||
| ], | ||
| order="date asc", | ||
| ) | ||
|
|
||
| return messages.message_format() |
There was a problem hiding this comment.
this is dangerous as we have no limit here in the search, this could cause perfomance issues in systems where we have lots of records
this set up will also cause the lazy load feature (existing in the other menus) to not work correctly
| super.setup(...arguments); | ||
|
|
||
| this.messagingService.isReady.then(async () => { | ||
| const messages = await this.rpc( |
There was a problem hiding this comment.
what about using orm.call instead, which is the most standard way
|
|
||
| <t t-inherit="mail.DiscussSidebarMailboxes" t-inherit-mode="extension"> | ||
| <xpath | ||
| expr="//div[contains(@class, 'd-flex') and contains(@class, 'flex-column')]" |
There was a problem hiding this comment.
this can break anytime the parent template changes, you could use the DiscussSidebarMailboxes root component
This module introduces a “Sent History” mailbox in Odoo's messaging system, giving users a dedicated view of all messages and notes they have personally sent. Users can also search through their sent messages using the search bar.