liquid_feedback_frontend
annotate app/main/timeline/_action/update.lua @ 172:165f4bd02cf3
don't show the first draft of a new initiative as a new draft event in the timeline
new draft should only show changes of drafts drafts of new initiatives as they are handled by the new initiative event
new draft should only show changes of drafts drafts of new initiatives as they are handled by the new initiative event
| author | Daniel Poelzleithner <poelzi@poelzi.org> |
|---|---|
| date | Sun Oct 10 19:40:32 2010 +0200 (2010-10-10) |
| parents | 3d0b6f87d8e5 |
| children |
| rev | line source |
|---|---|
| bsw@11 | 1 execute.view{ |
| bsw@11 | 2 module = "timeline", |
| bsw@11 | 3 view = "_constants" |
| bsw@11 | 4 } |
| bsw@11 | 5 |
| bsw@11 | 6 local options_string = param.get("options_string") |
| bsw@11 | 7 |
| bsw@11 | 8 if not options_string then |
| bsw@11 | 9 local active_options = "" |
| bsw@11 | 10 for event_ident, event_name in pairs(event_names) do |
| bsw@11 | 11 if param.get("option_" .. event_ident, atom.boolean) then |
| bsw@11 | 12 active_options = active_options .. event_ident .. ":" |
| bsw@11 | 13 local filter_idents = {} |
| bsw@11 | 14 for filter_ident, filter_name in pairs(filter_names) do |
| bsw@11 | 15 if param.get("option_" .. event_ident .. "_" .. filter_ident, atom.boolean) then |
| bsw@11 | 16 filter_idents[#filter_idents+1] = filter_ident |
| bsw@11 | 17 end |
| bsw@11 | 18 end |
| bsw@11 | 19 if #filter_idents > 0 then |
| bsw@11 | 20 active_options = active_options .. table.concat(filter_idents, "|") .. " " |
| bsw@11 | 21 else |
| bsw@11 | 22 active_options = active_options .. "* " |
| bsw@11 | 23 end |
| bsw@11 | 24 end |
| bsw@11 | 25 end |
| bsw@11 | 26 if #active_options > 0 then |
| bsw@11 | 27 options_string = active_options |
| bsw@11 | 28 end |
| bsw@11 | 29 end |
| bsw@11 | 30 |
| bsw@162 | 31 if not options_string then |
| bsw@162 | 32 options_string = "issue_created:* issue_finished_after_voting:* issue_accepted:* issue_voting_started:* suggestion_created:* issue_canceled:* initiative_created:* issue_finished_without_voting:* draft_created:* initiative_revoked:* issue_half_frozen:* " |
| bsw@162 | 33 end |
| bsw@162 | 34 |
| poelzi@145 | 35 if param.get_list("option_ignore_area", atom.string) then |
| poelzi@145 | 36 options_string = options_string.." ignore_area:"..table.concat(param.get_list("option_ignore_area", atom.string), "|") |
| poelzi@145 | 37 end |
| poelzi@145 | 38 |
| bsw@11 | 39 local setting_key = "liquidfeedback_frontend_timeline_current_options" |
| bsw@11 | 40 local setting = Setting:by_pk(app.session.member.id, setting_key) |
| bsw@11 | 41 |
| bsw@11 | 42 if not setting or setting.value ~= options_string then |
| bsw@11 | 43 if not setting then |
| bsw@11 | 44 setting = Setting:new() |
| bsw@11 | 45 setting.member_id = app.session.member_id |
| bsw@11 | 46 setting.key = setting_key |
| bsw@11 | 47 end |
| bsw@11 | 48 if options_string then |
| bsw@11 | 49 setting.value = options_string |
| bsw@11 | 50 setting:save() |
| bsw@11 | 51 end |
| bsw@11 | 52 end |
| bsw@11 | 53 |
| bsw@11 | 54 local date = param.get("date") |
| bsw/jbe@19 | 55 |
| bsw/jbe@19 | 56 if param.get("search_from") == "last_24h" then |
| bsw/jbe@19 | 57 date = "last_24h" |
| bsw/jbe@19 | 58 end |
| bsw@11 | 59 |
| bsw@11 | 60 if date and #date > 0 then |
| bsw@11 | 61 local setting_key = "liquidfeedback_frontend_timeline_current_date" |
| bsw@11 | 62 local setting = Setting:by_pk(app.session.member.id, setting_key) |
| bsw@11 | 63 if not setting or setting.value ~= date then |
| bsw@11 | 64 if not setting then |
| bsw@11 | 65 setting = Setting:new() |
| bsw@11 | 66 setting.member_id = app.session.member.id |
| bsw@11 | 67 setting.key = setting_key |
| bsw@11 | 68 end |
| bsw@11 | 69 setting.value = date |
| bsw@11 | 70 setting:save() |
| bsw@11 | 71 end |
| bsw@11 | 72 end |
| bsw@11 | 73 |
| bsw@11 | 74 local setting_key = "liquidfeedback_frontend_timeline_current_options" |
| bsw@11 | 75 local setting = Setting:by_pk(app.session.member.id, setting_key) |
| bsw@11 | 76 |
| bsw@11 | 77 local timeline_params = {} |
| bsw@11 | 78 if setting and setting.value then |
| bsw@11 | 79 for event_ident, filter_idents in setting.value:gmatch("(%S+):(%S+)") do |
| bsw@11 | 80 timeline_params["option_" .. event_ident] = true |
| bsw@11 | 81 if filter_idents ~= "*" then |
| bsw@11 | 82 for filter_ident in filter_idents:gmatch("([^\|]+)") do |
| bsw@11 | 83 timeline_params["option_" .. event_ident .. "_" .. filter_ident] = true |
| bsw@11 | 84 end |
| bsw@11 | 85 end |
| bsw@11 | 86 end |
| bsw@11 | 87 end |
| bsw@11 | 88 |
| bsw@11 | 89 local setting_key = "liquidfeedback_frontend_timeline_current_date" |
| bsw@11 | 90 local setting = Setting:by_pk(app.session.member.id, setting_key) |
| bsw@11 | 91 |
| bsw@11 | 92 if setting then |
| bsw@11 | 93 timeline_params.date = setting.value |
| bsw@11 | 94 end |
| bsw@11 | 95 |
| bsw@11 | 96 timeline_params.show_options = param.get("show_options", atom.boolean) |
| bsw@11 | 97 |
| bsw@11 | 98 if param.get("save", atom.boolean) then |
| bsw@11 | 99 request.redirect{ |
| bsw@11 | 100 module = "timeline", |
| poelzi@144 | 101 view = "save_filter", |
| poelzi@144 | 102 params = { |
| poelzi@144 | 103 current_name = param.get("current_name") |
| poelzi@144 | 104 } |
| bsw@11 | 105 } |
| bsw@11 | 106 else |
| bsw@11 | 107 request.redirect{ |
| bsw@11 | 108 module = "timeline", |
| bsw@11 | 109 view = "index", |
| bsw@11 | 110 params = timeline_params |
| bsw@11 | 111 } |
| bsw@11 | 112 end |