Changeset d3efc818ad12f25b70157a80a98888a3fbaac544
- Timestamp:
- 08/23/10 22:36:53 (18 months ago)
- Author:
- Antti-Juhani Kaijanaho <antti-juhani@…>
- Children:
- ec0da3f87768820f9ca9e8065c7998e9d825bd4c
- Parents:
- 22d9643ba8d951cde698749cf25dbe905e197a4f
- git-committer:
- Antti-Juhani Kaijanaho <antti-juhani@…> (08/23/10 22:36:53)
- Message:
-
[http::markread,article] Prevent marking read after explicit unmarking
Fixes #70.
Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>
- Location:
- http
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r563ece2
|
rd3efc81
|
|
| 95 | 95 | boost::shared_ptr<db::user> u = req->get_user(); |
| 96 | 96 | |
| 97 | | if (is_single && u) u->mark_read(art->msgid()); |
| | 97 | if (is_single && u && req->get_query_param("markread") != "no") |
| | 98 | u->mark_read(art->msgid()); |
| 98 | 99 | |
| 99 | 100 | db::thread_node::ptr tn = |
-
|
r22d9643
|
rd3efc81
|
|
| 41 | 41 | (boost::shared_ptr<request> req, response::factory) |
| 42 | 42 | { |
| 43 | | if (req->get_method() != "POST") |
| 44 | | { |
| 45 | | boost::shared_ptr<error_resource> er |
| 46 | | (new error_resource |
| 47 | | (cb, "405 Method not allowed")); |
| 48 | | er->add_header("Allow", "POST"); |
| 49 | | throw resource_exception(er); |
| 50 | | } |
| 51 | | |
| 52 | 43 | db::user::ptr u = req->get_user(); |
| 53 | 44 | |
| … |
… |
|
| 62 | 53 | bool value = lookup(fd, "undo") != "yes"; |
| 63 | 54 | std::string msgid = lookup(fd, "msgid"); |
| 64 | | std::string redir = lookup(fd, "redir"); |
| | 55 | ::uri redir = lookup(fd, "redir"); |
| | 56 | redir.replace_query_param("markread","no"); |
| 65 | 57 | |
| 66 | | if (value) |
| 67 | | u->mark_read(msgid); |
| 68 | | else |
| 69 | | u->unmark_read(msgid); |
| 70 | | |
| | 58 | if (req->get_method() == "POST") |
| | 59 | { |
| | 60 | if (value) |
| | 61 | u->mark_read(msgid); |
| | 62 | else |
| | 63 | u->unmark_read(msgid); |
| | 64 | } |
| 71 | 65 | boost::shared_ptr<redir_resource> r |
| 72 | | (new redir_resource(cb, redir, "303 See other")); |
| | 66 | (new redir_resource(cb, redir.to_string(), |
| | 67 | "303 See other")); |
| 73 | 68 | throw resource_exception(r); |
| 74 | 69 | } |