summaryrefslogtreecommitdiff
path: root/addons/website_forum/controllers/main.py
AgeCommit message (Collapse)Author
2019-03-15[IMP] website(_profile,_forum,_slides): move validation email to profile and ↵David Beguin
use in forum and elearning Email validation was necessary on the forum to be able to begin to use the forum (ask or answer questions, vote, etc..) As the new elearning also uses karma since 705376a982d64fb41800f148a167ef0fc28ce4c6, the email validation is now also necessary in the eLearning platform. This is why this commit is moving the email validation process to website_profile and extend website_slides (eLearning) and website_forum to use this feature. In function of where the user asked to send him the validation email, the user is redirected on the forum or on the elearning when he clicks on 'Validate my account' in the received 'email validation' email. Task ID : 1943788 PR #31321
2019-02-18[IMP] website(_profile,_forum,_survey) : redesign website all_users pageDavid Beguin
As the eLearning (website_slides) is also using website_profile users, the All Users page is moved from website_forum to website_profile, to be useable in both forum and eLearning. This page displays also the number of karma point, badges and certificates of each user. The users are sorted by their karma points and the first 3 users are promoted on a podium. Use span instead of b tag in profile page Task ID : 1922159 PR #31109
2019-02-14[IMP] gamification,forum: remove deprecated alert when sending badgejem-odoo
Since 56645335b7bae0415242ec51193e493119a58879, when a user get a badge, an email is sent. The subtype is not used anymore, so the alert mecanism in forum to display a message to the user to show him his new badges can not work. This commit removes this dead code. Task-1922159
2019-02-14[REF] website_forum : use website_profile templates and adds forum specific ↵David Beguin
information Adds forum specific information into the website_profile template page. Removes everything linked to profile that is already in website_profile module to avoid duplicates. As there can be more than one forum, the profile page shows everything linked to every forum, except if the forum id is given in url arguments. The old route (forum/forum-1/user/user_id) have been kept for backward compatibility reasons. Adds the 'Go to forum' button in the 'new rank reached' mail to encourage the users to continue to be active on the forum as well, to gain more karma point and improve there rank. Image rpc calls have been reviewed for profile page part to use only the standard way to get image -> web/image/model_name/id/image_size Task ID : 1922159 PR #30988
2019-01-30[IMP] website_forum: make method privateSwapnesh Shah
Model methods should be private by default unless they need to be exposed via RPC on purpose (e.g. for the web client). The `send_forum_validation_email()` method is only called by a controller and has no reason to be exposed via RPC, hence the conversion to private. Closes #30669
2019-01-23[FIX] website_forum: avoid traceback on ack notifJeremy Kersten
Before this commit, notification_read raise a traceback on some button click. Eg: Flag/unglaG It was hidden in the console, but we can just avoid it too closes odoo/odoo#30524
2019-01-23[FIX] website_forum: small ui fixJeremy Kersten
Force image to stay in their container (img_fluid could be removed by end user) Stop to use row_users now that we use bs4, allow to be more responsive, force height to be the same for each card. Small imp replacing multiple if by elif Decrease big margin between questions Place tag on the top (if you have many tag, or very long, the ui is broken)
2018-12-06[REF] base, *: refactor binary_contentThanhDodeurOdoo
*: tools, web, website, website_forum, mail, im_livechat This commit refactors ir_http to make it more readable and flexible. Move the resize function of web/image to odoo.tools Co-authored-by: XavierDo <xdo@odoo.com> Co-authored-by: Antony Lesuisse <al@openerp.com> closes: #28563 task: #1908896
2018-12-06[REF] website_forum: mass moderation, modern UI bs4 and clean typeJeremy Kersten
Now forum only allow to post message of type 'question'. New 'modern' UI with Bootstrap 4 New moderation modal for bulk spam Co-authored-by: qha <qha@odoo.com> Co-authored-by: qsm <qsm@odoo.com> Co-authored-by: jke <jke@odoo.com> Thanks to @qha-odoo for UI Thanks to @qsm-odoo for reviewSsss closes odoo/odoo#29235
2018-10-11[FIX] website_hr(_recruitment): make website specificRomain Derie
As commit 066cfc9598a30 did for other website_module, this commit make theses 2 modules multi-website compatible. Mostly by: - Adding website_id in form/list views - Preventing routes from being accessed by wrong website (only needed for admin as portal users will get a 403) - Adapt search([]) with multi website domain - Add domain in model converter in routes for URL autocomplete (eg menu URL) Note that it is not needed for sitemap.xml closes odoo/odoo#27528
2018-09-25[IMP] website(_*): add kwargs in routes where necessaryRomain Derie
task-32836
2018-09-25[FIX] website_blog, website_forum: missing template nameRomain Derie
This commit adds various fixes to blog and forum: - Some templates were mising a name, resulting in ugly page title (eg: forum_all) - Latest Blogs page was checking seo keywords to display tags, maybe it was coming from an old tag implementation that used seo keywords? - If only one forum, land on it directly when accessing /forum, like blog does - ..
2018-08-13[IMP] website_[blog|event|forum|sale|slide]: make website specificJeremy Kersten
Set up env & tools for module website multiwebsite (blog, event, sale..) website_id in modelConverter and ir_rule add _compute_domain_keys to have a different cache per website or rules would not be correctly website_dependant eg: blog 1 on website 1, blog 2 on website 2 access blog 1 from website 1 => can access -> normal access blog 1 from website 2 => can access -> should crash because (ir rule) split mixing website.published.mixin and website.published.multi.mixin to have website_id only on last one. multi mixing will: - override website_published compute to take current_website into account (not in backend) - force website when clicking on published in backend - website blog, website_sale, website_event, website_forum, website_slides are now multi website Co-authored-by: Derie Romain <rde@odoo.com> Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-06[REF] *: use native date/datetime for Date/Datetime fieldsRaphael Collet
From this commit onwards, Date fields will return datetime.date objects and Datetime fields will return datetime.datetime objects, this implies a number of things that are clearly explained both in the ORM API for master. This commit also introduces a number of helper functions for dates and datetimes that are exposed in tools.date_utils and fields.Date[time], explained in the documentation as well. Task-ID: 47189
2018-04-09[IMP] website_forum: better management of archived forumHiral Bhavsar
Before this commit, badge, user,... was available when a forum is archived. Now we display a msg to explain to the user that the forum has been archived. Related to task-33955
2018-02-15[FIX] website_forum: fix 'submit a link' featureJeremy Kersten
The pooling of the title was wrong since P3 refactoring.
2017-10-20[MERGE] forward port branch saas-16 up to dc2a6c6cd2aChristophe Simonis
2017-10-16[FIX] website_forum: 404 error message for empty questionGoffin Simon
When a empty question was posted in the forum, a 404 error was raised. opw:76940
2017-09-27[IMP] website*: clean sitemap + add method to declare sitemap function.Jeremy Kersten
Don't add useless routes or route that will return 404. Improve generate function from ModelConverter to have a better management of query_string. Now we have an helper sitemap_qs2dom that will analyse the current route and check if query string is plausible and if yes, generate a domain, when the query_string don't seems to match the route, we return a Falsy domain. Before this commit, if qs was /product/ipad, enumerate_page check for each modelconverter of the route a name ilike '/product/ipad'. Now we check all routes that contains product and one converter that match ipad or routes that contains ipad and one converter that match product. This commit a new way to declare the sitemap for a route. def sitemap_xx(env, rule, query_string): yield {'loc': '/my_url'} @http.route(..., sitemap=sitemap_xx) In this case, only the loc returned by this function will be in the sitemap for all rules. You can pass sitempa=False, if you don't want that route are into the sitemap
2017-08-24[MERGE] forward port branch saas-17 up to 877e7098719Christophe Simonis
2017-08-20[FIX] P3: fix base64 and StringIO usesXavier Morel
* StringIO removed from stdlib, replace with io * try to correctly handle BytesIO/StringIO (one is for bytes the other is for text) * fix base64: Python 3 removed bytes-encoding and bytes-bytes codecs (via #encode) so replace all calls to str.encode('base64'), also b64encode is a bytes->bytes conversion so attempt to properly handle that issue #8530
2017-08-19[FIX] P3: / has become 'real division' in all casesXavier Morel
2017-08-16[REF] web_editor, website, *: complete refactoringqsm-odoo
* mass_mailing, payment, point_of_sale, portal, survey, web, web_tour, website_blog, website_crm_partner_assign, website_event, website_event_questions, website_form, website_forum, website_gengo, website_hr_recruitment, website_links, website_mail, website_mail_channel, website_mass_mailing, website_quote, website_sale, website_sale_options, website_slides, website_twitter This commit reviews the whole "JS side" of the web_editor and website apps. This is a first step to be able to improve them with new and better functionnalities; this commit is not supposed to change any visual behavior. The main goal was to achieve a structure similar to the backend one. Now, the frontend side also has a root widget (like the WebClient) and all other widgets are attached to it one way or another. This allows the benefits of using the 'trigger_up' functionnality for example. As RPC are now mainly done with the `this._rpc` functionnality (being possible thanks to the parent hierarchy), the frontend will also be possible to test thanks to QUnit in a future update (besides the "text" editor side which still requires a refactoring to be able to do that). --- Here are some of the changes: (-) conventions and documentation The code has been updated to follow JS conventions and a lot of code has been commented (around +2000 lines of comment). This also means that lots of functions have been renamed to use camelCase or simply to make their name understandable. See https://github.com/odoo/odoo/wiki/Javascript-coding-guidelines. (-) deprecated: web_editor.base The "web_editor.base" module has been split and does not force the modules which require it to wait for DOM ready anymore. This was indeed slowing loading times, but also prevented to use some modules in some contexts (see the LESS editor use in web_studio which is the subject of another task). Now the "editor context" can be got thanks to the "web_editor.context" JS module with its "get" function. The "web_editor.base" module should probably not be used anymore (see its code and recent updates). (-) new: web.dom_ready If a JS module should wait for the DOM to be ready to be executed, a new JS module has been created: "web.dom_ready". This should always be used in a module which only want to instantiate stuff. Do not extend (or worst, include) classes after DOM ready. (-) website.website The "website.website" module has been split. "website.website" does not return anything useful anymore, it just initialize some miscellaneous stuff, without waiting for the DOM to be ready. You might want to check "website.utils", "website.content.compatibility" or `WebsiteRoot`. Also `website.form` has been deleted (use `this._rpc`), so has been `website.error`. `website.prompt` will be removed in a future update to be replaced by `Dialog.prompt`. (-) widgets are great Many classes which were not widgets are now widgets. This allows them to use the 'events', the 'xmlDependencies' and the 'this._rpc' features for example. Here are some of the main ones: - Snippet options: these were classes with a `$el` for the menu element and `$target` for the customized element. This is still the case but following standard `Widget` structure (one exception: using `this.$(...)` searches in the `$target` as before this update). - Snippet animations: instead of class instances with a `$target` element which can be `start` and `stop`, these are now standard widgets which can be `start` and `destroy`. `this.$target` is an alias to `this.$el` for ease of compatibility. - Snippet editors: instead of class instances in charge of an editor overlay, these are now widgets. Each "child" snippet editor is properly attached as a "child", which allows editors to communicate and to be properly destroyed. (-) root widgets and website navbar The frontend is different of the backend. In the backend, the page has an empty <body/> element and all the components are instantiated from parent to children (i.e. the `WebClient` is instantiated and is in charge of instantiating the `ControlPanel`, etc). The frontend cannot work like that on page loadings as they are way more frequent than in the backend and we do not want them to flicker. A frontend page is loaded as a <body/> element which already contains the website navbar and its menus and the whole content page. JS code has to be "attached" to these existing elements. This is possible thanks to the `RootWidget` instances and the specialized `WebsiteRoot`, `IframeRoot` and `WebsiteNavbar` (see code for details). (-) lazy loading No more (or at least a lot less) XML/JS has to be loaded on page loading, thanks to the use of the `Widget.xmlDependencies` feature. XML which have to be lazy loaded is loaded only on related Widget instantiation if necessary, which allows to execute a lot of JS code before the DOM is ready and to start many widgets on DOM ready (not later). A visual benefit of this is clicking on the 'edit' button as soon as it is possible: before this commit, this was sometimes not doing anything as event handlers were not binded yet. Still a possible exception: loading the session and locales. This may be asynchronous stuff which is still required before widget instantiations but this will be the subject of another task. (-) deprecated code and code location More than reviewing code and organizing it, many apparent dead code was removed. More importantly, mislocated code was put in the right app. This is the case for snippet animations which is a concept for website apps but was defined in the web_editor app, or some translation concepts which were part of website but should have been part of web_editor. --- There are probably more things to say about this commit but I will let the comments speak for those.
2017-08-08[MOV] website, http_routing: move (un)slug support to http_routingThibault Delavallée
Slug and unslug API is now available in http_routing. Indeed there is no link to any website or any reason to not support slufigied URLs when website is not installed. A new unslug_url method is added as a tool coming from an embedded method from website. Doing it allows to have all slug related methods defined at the same point. Support of slug and unslug in qweb rendering is also moved directly in http_routing version of ir_ui_view instead of website inheritance. This is done in order to keep things coherent. Some code from website about ModelConverter is also moved. Indeed both versions of ir_http uses some kind of placeholder to store the uid when converting urls to python. This commit unifies it by using the website one directly in base to simplify the override. This commit also updates all module importing slug. Enterprise modules will have to be updated, see related commit.
2017-07-18[FIX] P3: / has become 'real division' in all casesXavier Morel
2017-06-06[MERGE] forward port branch saas-16 up to 6f3eada2c3aChristophe Simonis
2017-06-03[MERGE] Forward-port 10.0 up to 76cd8d2558d2a1fc11681dbc4a134ba06fb698c0Olivier Dony
2017-06-02[FIX] website_forum: archived forum -> no askNicolas Lempereur
An archived forum could still be posted in, something better should be done in the next version (eg. website published present on a lot of record type) but as of 10.0 just this improvement is done. opw-745510 closes #17365
2017-05-15[FIX] P3: urllib, urllib2 and urlparseXavier Morel
In Python 3, all of these were "consolidated" under urllib(.request, .parse, .errors) which is inconvenient. Since we already have hard dependencies on requests and werkzeug(.urls, which is a backport of Python 3's unicode-aware urllib.parse) migrate *everything* to that. A sticking point is urllib2.URLError, those were (mostly) replaced by the slightly more general IOError which URLError extends.
2017-05-10[FIX] P3: list -> iterable builtins (#16811)xmo-odoo
In Python 3: * various builtins and dict methods were changed to return view/iterable objects rather than lists * and the separate Python 2 view/iterable builtins and methods were removed altogether This is problematic when using these items as list (which the happens repeatedly in Odoo), but more viciously when iterating *multiple times* over them (which also happens, which I've messed up multiple times while writing this, and which is a pain to debug even when you've just created the issue). Convert all code using these to semantics-matching cross-version helper functions to get the LCD behaviour between P2 and P3, and forbid the builtins via lint. issue #8530
2016-11-02[IMP] website_forum: Change profile picture for forum users.Dhaval Panchal
2016-08-20[MERGE] forward port branch saas-12 up to 9ad5f26Christophe Simonis
2016-08-10[MIG] website_forum: migrate remaining message_post and update code accordinglyThibault Delavallée
2016-08-10[IMP] various: use odoo for imports instead of openerp and update class namesThibault Delavallée
2016-08-04[REF] website_*: remove `render` method on websiteJérome Maes
Since saas-3, website controllers use `request.website.render` to render the template of a web page. This was kept for retro compatibility. It's time to stop using deprecated stuff. Same for `_render` method on website. 'json' route don't use `request.render` since `JsonRequest` has no `render` method.
2016-08-03[MERGE] forward port branch saas-10 up to c956075Christophe Simonis
2016-08-03[MERGE] forward port branch 9.0 up to cadb481Christophe Simonis
2016-08-03[REF] web, *: change deprecated import openerp.addons.web.http to odoo.httpfwi-odoo
We also remove the mock in web as there is no need for it anymore.
2016-08-01[FIX] website_forum: don't allow a user to submit 2 pending post simutaneously.Jeremy Kersten
Before this commit, a user was able to post withtout limit new post. They was added to the modarator queue. Now we only support 1 post by user. This commit is related to #12803
2016-07-29[FIX] website_forum: don't allow to post an empty questionJeremy Kersten
Instead to post the empty question, now we redirect the end user to the question page with a warning. This commit closes #12962
2016-06-08[MERGE] forward port of branch saas-10 up to 2f948c7Christophe Simonis
2016-06-03[MERGE] forward port of branch 9.0 up to 5419485Christophe Simonis
2016-06-03[MERGE] forward port of branch saas-6 up to d5df729Christophe Simonis
2016-06-03[MERGE] forward port of branch 8.0 up to 2779d46Christophe Simonis
2016-06-02[FIX] website_forum: convert content of posted comment to plaintextMartin Trigaux
HTML content should be escaped before being sanitized. Any content (link, image, code,...) that is acceptable in usual mail.message but should not be interprated when posted on a comment of the forum. Fixes #3737
2016-05-30Revert "[FIX] website_forum: notification of comments like answers"Martin Trigaux
This reverts commit e32ba845de73a251fba4f12af45c880898cb4344. This commit is wrong as it had an undifined variable and was losing the content of the comment anyway. Fixes #12213
2016-05-27[FIX] website_forum: notification of comments like answersMartin Trigaux
Fixes #12096
2016-04-01[MERGE] forward port of branch saas-10 up to 6e95659Christophe Simonis
2016-04-01[MERGE] forward port of branch saas-7 up to 2d2028aDenis Ledoux
2016-03-30[FIX] website_forum: avatar route now uses 128x128 imageOlivier Dony
Many users upload large images for their avatar (multi-Mb files). This makes most forum pages longer to load than necessary, and wastes bandwidth. 128x128 images (`image_medium` field) are sufficient for displaying avatar pictures on posts and profiles.