Commit Graph
188 Commits
Author SHA1 Message Date
eLBati 44ad6f37b1 [FIX] website_forum: Use sudo to send new question notification
Otherwise portal users can not access to some partners subscribed to the forum.
Closes #9855
2015-12-03 11:58:54 +01:00
Thibault Delavallée f6fdb0b6b3 [FIX] website_forum: new post notifications
Better message management, linked to the validation feature added in v9

 - post a "new post to see" message only when the post is validated
 - post a "new post to validate" message when the post has to be validated.
   This message is sent only to followers having sufficient karma.
2015-11-20 11:51:53 +01:00
Thibault Delavallée a6b6d02007 [FIX] website_forum: do the todo
We have a tunable parameter for flagged / offensive questions. So let us use
it instead of some other parameter * 5.
2015-11-20 11:51:49 +01:00
Thibault Delavallée feb86ae38c [FIX] website_forum: no auto subscription
Remove forum creator as follower of the forum. Indeed this means that generally
the website admin will be follower of all posts of this forum. Which is
probably not really necessary.
2015-11-20 11:25:17 +01:00
Thibault Delavallée 6dfcc5f9c8 [FIX] various: get_access_action form one to multi
As this method is overided in several modules, the mix of new and
old API makes it difficult to handle. Indeed in some cases we
receive the expected dictionary, sometimes in a list, sometimes
in a list of list, due to api.one decorator.

This is a change in the method API, however it is currently completely
buggy. Moreover this method is used internally and should not be
used as an external API. Lastly, this method is new from v9.
2015-10-30 15:44:15 +01:00
Christophe Simonis c0066c600e [FIX] website_forum: tags should be unique per forum 2015-10-28 11:55:53 +01:00
Denis Ledoux 34e90a44f8 [MERGE] forward port of branch saas-6 up to 20dba161d0 2015-10-26 19:17:21 +01:00
Xavier Morel 9dffd17bd5 [IMP] website_forum: users page performances
The read_group collating user badge counts is extremely slow when
there's a large number of users (possibly even slower than 8.0's naive
approach), replace the whole thing by a single SQL query seems to yield
pretty significant (~2 orders of magnitude) performance improvements on
the computing function resulting in ~1 order of magnitude improvement
for the page as a whole.
2015-10-06 10:33:11 +02:00
Martin Trigaux 2f2ec60854 [IMP] website_forum: rephrase label can_display_biography 2015-09-30 12:00:18 +02:00
Martin Trigaux 0a57d37b35 [FIX] website_forum: help messages
missing spaces or unclear help messages
2015-09-24 12:06:57 +02:00
Martin Trigaux a8c74c8bfd [FIX] website_forum: field label 2015-09-22 10:06:07 +02:00
Julien Louette 205ce98656 [IMP] website_forum: moderation & anti spam 2015-09-05 14:44:06 +02:00
Thibault Delavallée 59c5ff08be [IMP] various: action buttons in notifications
Main addons updated :

 - crm: Conversion and Won / Lost actions
 - hr_holidays: Approve / Refuse for hr users / officers
 - project: Assign / New (task and issues)
 - forum, website_project_issue, website_portal_sale: go to the
   website view
2015-08-28 17:36:16 +02:00
Thibault Delavallée 01ab75f597 [IMP] mail: notification emails with button
Notification emails have been redesigned. They notably include buttons
allowing to perform some action directly from the email.

The notification creation and sending has been partially rewritten
and improved. The purpose is to lessen the number of rendering to perform
when sending emails to recipients. Recipients are first categorized into
groups. Basic groups are partners and users. The notification template
is then rendered twice, one for followers and one for not-followers. In most
cases there will be few rendering to perform. Through inheritance it
is possible to further categorize users. For example HR users / officers
that have approve / refuse buttons in their email.

A custom data structure is used to store data about buttons and actions.
URLs, follow / unfollow are added in the structure and used in the
template to render the email for a given group.

New routes are added in mail. Those allow to perform some action, like
going to a form in create mode, following / unfollowing, executing a method,
sending a signal for a workflow. Those routes are for users only and rely
on classic access rights.

A generic route for viewing records is added. It replaces the old redirect
action. According to some specific action given by the already-existing
get_access_action, the record will be visible for everybody (forum, blog)
or restricted (going on the Inbox / login / form view, according to access
rights).

The next commit will add the various inherits necessary to add the actions
in the main addons.
2015-08-28 17:30:42 +02:00
Dharmraj Jhala bc50f53d65 [IMP] website_forum: extended biography
The biography of established users (with high karma) can be seen
with an expanded tooltip. This gives to users that participate
some kind of reward and gratitude of their work.
2015-08-11 16:12:33 +02:00
Antony Lesuisse 1e90257e58 [IMP] tags: add unique constraints
- remove tags translatability
- add unique constraints
- res.partner.category is kept until we remove the parent_store test.
- hr remove tag parenthood
- hr remove unsed views and menu
2015-08-07 00:51:14 +02:00
Thibault Delavallée 4b122ad41d [MIGR] mail: migration to the new API 2015-04-27 10:36:15 +02:00
Christophe Simonis a9471c43b9 [MERGE] forward port of branch saas-6 up to e941c0f 2015-04-17 15:33:00 +02:00
Christophe Simonis 3206a35aed [MERGE] forward port of branch 8.0 up to 8ac8281 2015-04-13 12:07:58 +02:00
Olivier Dony 1ffa4d26d5 [FIX] forum: restore superuser bypass in per-post karma check
During conversion to new API[1] the superuser bypass
was dropped in the computation of karma-based
permissions on forum posts.
The check still needs to be bypassed to avoid
blocking sudo() mode when the admin account
has a low karma.
sudo() mode is used for various actions done
by the system on behalf of the forum users,
and should not fail because the admin has less
karma than the user herself.

[1] See rev. 893d7fa864
2015-04-10 18:23:32 +02:00
Xavier Morel aa25670c69 [FIX] forum: optimize vote metadata queries
Saves 2 requests per post, aka 20 requests on a full page (89 -> 68):

* don't create a new sudoed env and recordset for each post, create a
  single one so prefetch can work
* don't do unnecessary sudoed access (.parent_id.create_uid without
  reading any field)
* temp variables in template seems to save a few queries, not sure why

There's still a linear growth of requests wrt posts in the
page (single-post page has 56 queries), but it's a bit less terrible.
2015-04-10 18:23:32 +02:00
Olivier Dony 6377699c44 [FIX] website_forum: check karma access on direct message edit/unlink too
Access rights on messages are derived from the
access rights on the documents they are attached
to. Due to the karma-based nature of the forum
access rights, these do not automatically reflect
on messages, because they are not implemented as
access rules.
The check_mail_message_access() needs to be
overriden to achieve the same effect.

+ allow calling super().check_mail_message_access()
from new API (useful in forward-port)
2015-04-07 10:10:20 +02:00
Jaysinh Shukla d8784e1af4 [IMP] tools, forum: allow to strip classes from sanitized html.
This behavior is not the default behavior to remain consistent with
the previous behavior of the sanitizer.

website_forum: when converting a post into a comment the html is now
completely sanitized instead of parsed into plaintext. Inded comment
are mail.message, thus holding html content. Styling and classes are
removed to ensure only the basic html pattern is kept.
2015-03-24 15:38:30 +01:00
Christophe Simonis 5aba579e74 [MERGE] forward port of branch saas-6 up to 42db2db 2015-03-21 15:54:05 +01:00
Olivier Dony 10b8f1c907 [FIX] forum: "Relevancy" is old-fashioned -> Relevance 2015-03-16 11:34:22 +01:00
Parth Gajjar f76ca21b15 [IMP] website_forum : improve tag ordering, add 'in menu' checkox when create a forum, customize welcome_message on a forum, better fetch link title when insert it, display answers of a question on form view, ans some changes in faq 2015-03-12 15:41:10 +01:00
Christophe Simonis 0a65947499 [MERGE] forward port of branch saas-6 up to 648a558 2015-03-10 19:25:43 +01:00
Christophe Simonis 6cce8d5a55 [FIX] website_forum: remove duplicated method 2015-03-09 16:07:44 +01:00
Christophe Simonis 0894bdafe2 [MERGE] forward port of branch 8.0 up to 5e3e41b 2015-03-09 16:06:29 +01:00
Olivier Dony 64da3c5e17 [FIX] website_forum: hide questions coming from abusive users
When a user's karma is driven to a negative value
due to repeated abuse or the posting of spam,
automatically hide all their posts from public
view.
This will reduce the effectiveness of their abuse,
and simplify moderation and cleanup.
2015-03-09 14:41:14 +01:00
Olivier Dony 13476c844d [FIX] fields.html, forum: opt-in stripping of @style attrs
For public-facing HTML content provided by the user,
`<style>` tags and `style` attributes should be stripped
automatically, as they can easily be abused to deface
pages for abusive users and spammers.
<style> tags were already stripped, the optional `strip_style`
for fields.html enables the automatic stripping of style
attributes.

This is opt-in because custom style attributes are still
desirable in trusted HTML fields.
2015-03-09 14:41:14 +01:00
Thibault Delavallée 7b4a82884d [FIX] website_forum: fix crash in convert answer to comment
raised by last commits in saas-6. Browse user object as superuser
to avoid access issues.
2015-03-04 17:15:57 +01:00
Christophe Simonis 9cf6786e75 [MERGE] forward port of branch saas-6 up to fefb298 2015-03-02 18:25:40 +01:00
Thibault Delavallée f12c61cb0e [FIX] website_forum: typos and wording in field labels 2015-03-02 16:35:30 +01:00
Thibault Delavallée 0e924744a5 [FIX] website_forum: added a forgotten required on post_type on the
post model. Indeed a post is a question, a link or a discussion and cannot be
something else.

Added constraints to avoid having posts that do not match the accepted types
on the forum; and to avoid having forums having a default post type not
matching the accepted ones.
2015-03-02 16:35:30 +01:00
Thibault Delavallée 7ebd605b19 [IMP] website_forum: wording in karma labels 2015-02-24 11:01:26 +01:00
Jay Patel ccba676ed7 [IMP] website_forum: added check of links and images in posted
content. This is done at model level and raises a karma error.

Unnecessary fields have been removed; only one field for editor remain currently.
2015-02-24 11:01:26 +01:00
Christophe Simonis ff6bf5bb2f [FIX] website_forum: handle plaintext of empty posts 2015-02-09 15:40:01 +01:00
Jaysinh Shukla 5f987f8745 [IMP] website_forum: added social sharing on questions.
A widget based on website share widget has been added that allows to share
questions and answers on social networks. Old posts can also be bumped
through sharing.

New fields have been added on forum model allowing to disable the old
question bump and social sharing modals.

Courtesy of RD India: Ajay Patel (apa@odoo.com), Jaysinh Shukla
(jsh@odoo.com)
Courtesy of use Merge: Damien Bouvy (dbo@odoo.com)
2015-01-22 17:02:17 +01:00
Thibault Delavallée 9135d677e8 [FIX] website_forum: res.users inheritance: fixed call to super in
get_serialised_gamification_summary, parameter was forgotten. Regression probably
added in the migration to the new API.
2015-01-20 17:34:33 +01:00
David Monjoie 28c79ec7d0 [IMP][REF] website_forum: added the published mixin. A hook on res.users
has also been added, because the action open_website_url linked to the publish
button is not defined on res.users model (but on its inherited partner).
It now has the method that is routed on its partner.
2015-01-20 17:34:33 +01:00
Olivier Dony 025a81225b [FIX] website_forum: bad conflict resolution during last forward-port
kdiff3 use should be forbidden :-)
2015-01-20 10:33:04 +01:00
Christophe Simonis 18e22be138 [MERGE] forward port of branch 8.0 up to 0aab81c 2015-01-19 17:15:56 +01:00
Goffin Simon 0fd773a486 [IMP] Cleanup and refactoring of exception handling
Unify and refactor exception handling in framework and addons.

The generic `except_osv` is now deprecated, and replaced by more specialized exception subtypes:
 - `UserError` (renamed from Warning, as it conflicts with the built-in `Warning`) raised when a non-technical error occurs during a business operation. It could be a missing information in the data provided by the user, or a misconfiguration.
 - `AccessError`: raised when any operation is denied because the user conducting it does not have the required access rights.
 - `AccessDenied`: raised when an operation that requires authenticated access is attempted via an unauthenticated request.
 - `MissingError`: raised when an operation is attempted on a record that does not exist.
 - `ValidationError`: raised when an operation violates a SQL or Python constraint.
 - All other exceptions are internal errors due to a system problem or bug, and raised untouched to the client-side, which should display a traceback.

All exceptions take a single message argument.

The `test_exceptions` module has been updated to showcase both new and old (deprecated) exceptions.

A great many old `except_osv` had a useless title with "Error!" or "Warning", those have been removed, as this is handled by the client-side widget that displays the messages.

This commit introduces a more consistent policy for logging errors and warnings:
 - All messages that do not require administrator attention should be logged at INFO level or lower. This includes all errors that are notified to the user in a friendly manner, even for access right problems or validation errors during business operations.
 - All messages that indicate a likely misconfiguration or malicious use by the users should be logged at WARNING level, as they typically require administrator attention.
 - All other unhandled internal errors cannot typically be handled by the user and should be logged at ERROR or higher level, as they require immediate administrator attention.
2015-01-16 17:15:18 +01:00
Martin Trigaux fc9ce0bcff [FIX] website_forum: description not translated
Make the field description on a forum translatable and add it in the forum view. opw 619786
2015-01-15 15:37:31 +01:00
Jeremy Kersten df2ddd8951 [FIX] website_forum: Manual forward port from 30a6be0 and 0de1d89
Code has been refactored since 8.0
2015-01-12 17:57:19 +01:00
Jeremy Kersten 0de1d89648 [FIX] website_forum: add name get on forum.post #4364
When comment is created, emails are sent with subject: "Re: False" and footer: "About Forum False".
Now, when the post is a comment, we fallback to the name of the parent (the main forum post).
2015-01-12 15:27:32 +01:00
Christophe Simonis fab4d6d442 [MERGE] forward port of branch 8.0 up to ea54d4a 2015-01-06 11:49:04 +01:00
Christophe Matthieu 6471fa6ddb [FIX] website_sale: Discussion not working on product and gives '500: Internal Server Error' if public user try to comment on product (without login). Need to redirect to the login page (all user who want to write a comment have already buy the product and can use the portal login) 2015-01-05 13:30:36 +01:00
Binjal Desai a8c44dd743 [FIX] website_forum: post: if no create_date, relevancy is 0.
Fix a crash when creating a post in backend without create_date being set.
2014-12-26 15:52:33 +01:00