1 |
commit: 232f45b7a5b4096e10cfc34edd080e7605b06c1b |
2 |
Author: Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Jun 27 15:36:20 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jun 27 15:36:20 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=232f45b7 |
7 |
|
8 |
Application receives meeting log from IRC bot |
9 |
|
10 |
--- |
11 |
site/app/controllers/agendas_controller.rb | 2 ++ |
12 |
site/app/models/agenda.rb | 6 +++++- |
13 |
site/db/schema.rb | 3 ++- |
14 |
site/spec/models/agenda_spec.rb | 10 ++++++++++ |
15 |
4 files changed, 19 insertions(+), 2 deletions(-) |
16 |
|
17 |
diff --git a/site/app/controllers/agendas_controller.rb b/site/app/controllers/agendas_controller.rb |
18 |
index 18a178d..669f364 100644 |
19 |
--- a/site/app/controllers/agendas_controller.rb |
20 |
+++ b/site/app/controllers/agendas_controller.rb |
21 |
@@ -17,6 +17,8 @@ class AgendasController < ApplicationController |
22 |
data = JSON.parse(request.env["rack.input"].read) |
23 |
Agenda.update_voting_options data['agenda'] |
24 |
Agenda.process_results data data['votes'] |
25 |
+ agenda = Agenda.current |
26 |
+ agenda.meeting_log = data['lines'] |
27 |
Participation.mark_participations data |
28 |
end |
29 |
|
30 |
|
31 |
diff --git a/site/app/models/agenda.rb b/site/app/models/agenda.rb |
32 |
index 46cf2d8..5580828 100644 |
33 |
--- a/site/app/models/agenda.rb |
34 |
+++ b/site/app/models/agenda.rb |
35 |
@@ -5,6 +5,7 @@ class Agenda < ActiveRecord::Base |
36 |
fields do |
37 |
meeting_time :datetime |
38 |
email_reminder_sent :boolean, :null => false, :default => false |
39 |
+ meeting_log :text, :null => false, :default => '' |
40 |
timestamps |
41 |
end |
42 |
|
43 |
@@ -32,7 +33,10 @@ class Agenda < ActiveRecord::Base |
44 |
end |
45 |
|
46 |
def update_permitted? |
47 |
- acting_user.council_member? || acting_user.administrator? |
48 |
+ return false if meeting_log_changed? |
49 |
+ return true if acting_user.council_member? |
50 |
+ return true if acting_user.administrator? |
51 |
+ false |
52 |
end |
53 |
|
54 |
def destroy_permitted? |
55 |
|
56 |
diff --git a/site/db/schema.rb b/site/db/schema.rb |
57 |
index bc8535a..39dd08b 100644 |
58 |
--- a/site/db/schema.rb |
59 |
+++ b/site/db/schema.rb |
60 |
@@ -10,7 +10,7 @@ |
61 |
# |
62 |
# It's strongly recommended to check this file into your version control system. |
63 |
|
64 |
-ActiveRecord::Schema.define(:version => 20110624141720) do |
65 |
+ActiveRecord::Schema.define(:version => 20110627151021) do |
66 |
|
67 |
create_table "agenda_items", :force => true do |t| |
68 |
t.string "title" |
69 |
@@ -34,6 +34,7 @@ ActiveRecord::Schema.define(:version => 20110624141720) do |
70 |
t.string "state", :default => "open" |
71 |
t.datetime "key_timestamp" |
72 |
t.boolean "email_reminder_sent", :default => false, :null => false |
73 |
+ t.text "meeting_log", :default => "", :null => false |
74 |
end |
75 |
|
76 |
add_index "agendas", ["state"], :name => "index_agendas_on_state" |
77 |
|
78 |
diff --git a/site/spec/models/agenda_spec.rb b/site/spec/models/agenda_spec.rb |
79 |
index b84f462..12b38a3 100644 |
80 |
--- a/site/spec/models/agenda_spec.rb |
81 |
+++ b/site/spec/models/agenda_spec.rb |
82 |
@@ -31,6 +31,16 @@ describe Agenda do |
83 |
end |
84 |
end |
85 |
|
86 |
+ it 'should allow no one to edit or change meeting_log' do |
87 |
+ a = Factory(:agenda) |
88 |
+ a.meeting_log = 'changed' |
89 |
+ |
90 |
+ for u in users_factory(AllRoles) |
91 |
+ a.should_not be_editable_by(u, :meeting_log) |
92 |
+ a.should_not be_updatable_by(u) |
93 |
+ end |
94 |
+ end |
95 |
+ |
96 |
def test_migration(object, migration, prohibited, allowed, final_state) |
97 |
# object - object to migrate |
98 |
# migration - migration name |