[FIX] mail_group: don't pollute sitemap

Controller /groups/<model(mail.group):group> is already in the sitemap,
so it is useless to list all messages. It will explode the sitemap, for
pages that don't need to be really indexed. What we want is the thread,
not one page by message.

And since no domain was set on domainConverter, the most of urls are
just 404. e.g. groupA with msg1/msg2 and groupB by with msg3/msg4 will
generate:
    groupA/msg1
    groupA/msg2
    groupA/msg3
    groupA/msg4
    groupB/msg1
    groupB/msg2
    groupB/msg3
    groupB/msg4

instead of
    groupA/msg1
    groupA/msg2
    groupB/msg3
    groupB/msg4

If we really wanted to index this route, then the domainConverter would
have to be:

```py
  '''/groups/<model("mail.group"):group>/<model("mail.group.message", "[('mail_group_id', '=', group.id)]"):message>''',
```

On our production, it removes around 90K entries in the sitemap ~40%

closes odoo/odoo#144938

X-original-commit: 2c90dca02357377301e788d16bbd05d37bd09785
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Jeremy Kersten
2023-12-05 10:55:00 +00:00
parent 870acffba6
commit 3652f90e61
+1 -1
View File
@@ -141,7 +141,7 @@ class PortalMailGroup(http.Controller):
})
@http.route('/groups/<model("mail.group"):group>/<model("mail.group.message"):message>',
type='http', auth='public', sitemap=True, website=True)
type='http', auth='public', sitemap=False, website=True)
def group_view_message(self, group, message, mode='thread', date_begin=None, date_end=None, **post):
if group != message.mail_group_id:
raise werkzeug.exceptions.NotFound()