parlement 0.9 → 0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +20 -1
- data/MEMORY +51 -0
- data/README +11 -38
- data/Rakefile +2 -2
- data/app/controllers/account_controller.rb +83 -50
- data/app/controllers/application.rb +3 -0
- data/app/controllers/elt_controller.rb +14 -3
- data/app/controllers/subscriber_controller.rb +25 -9
- data/app/helpers/elt_helper.rb +1 -1
- data/app/models/elt.rb +23 -13
- data/app/models/mail.rb +37 -17
- data/app/models/mail_notify.rb +6 -5
- data/app/models/person.rb +6 -5
- data/app/models/person_mail.rb +4 -0
- data/app/models/person_notify.rb +13 -0
- data/app/models/subscription.rb +4 -0
- data/app/views/account/_login.rhtml +9 -12
- data/app/views/account/_show.rhtml +35 -16
- data/app/views/elt/_elt.rhtml +8 -20
- data/app/views/elt/_listByVote.rhtml +9 -9
- data/app/views/elt/show.rhtml +6 -33
- data/app/views/layouts/top.rhtml +6 -0
- data/app/views/person_notify/setEmail.rhtml +24 -0
- data/app/views/subscriber/_list.rhtml +18 -0
- data/config/environment.rb +6 -4
- data/config/environments/development.rb +2 -0
- data/db/ROOT/parlement/{news → News}/Version_01.txt +0 -0
- data/db/ROOT/parlement/{news → News}/Version_02.txt +0 -0
- data/db/ROOT/parlement/{news → News}/Version_03.txt +0 -0
- data/db/ROOT/parlement/{news → News}/Version_04.txt +0 -0
- data/db/ROOT/parlement/{news → News}/Version_05.txt +0 -0
- data/db/ROOT/parlement/{news → News}/Version_06.txt +0 -0
- data/db/ROOT/parlement/{news → News}/Version_07.txt +0 -0
- data/db/ROOT/parlement/{news → News}/Version_08.txt +0 -0
- data/db/ROOT/parlement/{security → Security}/anonymity.txt +0 -0
- data/db/ROOT/parlement.txt +1 -1
- data/db/development_structure.sql +49 -34
- data/db/migrate/003_elt_children_count.rb +1 -1
- data/db/migrate/005_filter_mail.rb +22 -0
- data/public/javascripts/mybehaviour.js +10 -2
- data/public/stylesheets/default.css +21 -15
- data/test/unit/choice_test.rb +1 -1
- data/test/unit/elt_test.rb +1 -1
- data/test/unit/mail_notify_test.rb +24 -8
- data/test/unit/mail_test.rb +61 -6
- data/test/unit/{notifier_test.rb → person_notify_test.rb} +2 -2
- data/test/unit/person_test.rb +1 -1
- data/test/unit/subscriber_test.rb +12 -12
- metadata +24 -20
- data/app/models/notifier.rb +0 -13
- data/app/views/notifier/changeEmail.rhtml +0 -10
- data/public/images/comments.gif +0 -0
@@ -160,21 +160,23 @@ CREATE SEQUENCE people_id_seq
|
|
160
160
|
|
161
161
|
|
162
162
|
--
|
163
|
-
-- Name:
|
163
|
+
-- Name: person_mails; Type: TABLE; Schema: public; Owner: manu; Tablespace:
|
164
164
|
--
|
165
165
|
|
166
|
-
CREATE TABLE
|
167
|
-
|
166
|
+
CREATE TABLE person_mails (
|
167
|
+
id serial NOT NULL,
|
168
|
+
mail_id character varying(255) NOT NULL,
|
169
|
+
person_id character varying(255),
|
170
|
+
created_on timestamp without time zone NOT NULL
|
168
171
|
);
|
169
172
|
|
170
173
|
|
171
174
|
--
|
172
|
-
-- Name:
|
175
|
+
-- Name: schema_info; Type: TABLE; Schema: public; Owner: manu; Tablespace:
|
173
176
|
--
|
174
177
|
|
175
|
-
CREATE TABLE
|
176
|
-
|
177
|
-
person_id text NOT NULL
|
178
|
+
CREATE TABLE schema_info (
|
179
|
+
version integer
|
178
180
|
);
|
179
181
|
|
180
182
|
|
@@ -189,6 +191,19 @@ CREATE SEQUENCE subscribers_id_seq
|
|
189
191
|
CACHE 1;
|
190
192
|
|
191
193
|
|
194
|
+
--
|
195
|
+
-- Name: subscriptions; Type: TABLE; Schema: public; Owner: manu; Tablespace:
|
196
|
+
--
|
197
|
+
|
198
|
+
CREATE TABLE subscriptions (
|
199
|
+
elt_id text NOT NULL,
|
200
|
+
person_id text NOT NULL,
|
201
|
+
filter integer DEFAULT 0,
|
202
|
+
id serial NOT NULL,
|
203
|
+
created_on timestamp with time zone DEFAULT now() NOT NULL
|
204
|
+
);
|
205
|
+
|
206
|
+
|
192
207
|
--
|
193
208
|
-- Name: users; Type: TABLE; Schema: public; Owner: manu; Tablespace:
|
194
209
|
--
|
@@ -289,6 +304,22 @@ ALTER TABLE ONLY people
|
|
289
304
|
ADD CONSTRAINT people_pkey PRIMARY KEY (id);
|
290
305
|
|
291
306
|
|
307
|
+
--
|
308
|
+
-- Name: sent_mails_pkey; Type: CONSTRAINT; Schema: public; Owner: manu; Tablespace:
|
309
|
+
--
|
310
|
+
|
311
|
+
ALTER TABLE ONLY person_mails
|
312
|
+
ADD CONSTRAINT sent_mails_pkey PRIMARY KEY (id);
|
313
|
+
|
314
|
+
|
315
|
+
--
|
316
|
+
-- Name: subscribers_pkey; Type: CONSTRAINT; Schema: public; Owner: manu; Tablespace:
|
317
|
+
--
|
318
|
+
|
319
|
+
ALTER TABLE ONLY subscriptions
|
320
|
+
ADD CONSTRAINT subscribers_pkey PRIMARY KEY (id);
|
321
|
+
|
322
|
+
|
292
323
|
--
|
293
324
|
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: manu; Tablespace:
|
294
325
|
--
|
@@ -349,27 +380,11 @@ ALTER TABLE ONLY usersold
|
|
349
380
|
ADD CONSTRAINT "$1" FOREIGN KEY (person_id) REFERENCES people(id);
|
350
381
|
|
351
382
|
|
352
|
-
--
|
353
|
-
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
354
|
-
--
|
355
|
-
|
356
|
-
ALTER TABLE ONLY subscribers
|
357
|
-
ADD CONSTRAINT "$1" FOREIGN KEY (elt_id) REFERENCES elts(id);
|
358
|
-
|
359
|
-
|
360
|
-
--
|
361
|
-
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
362
|
-
--
|
363
|
-
|
364
|
-
ALTER TABLE ONLY delegations
|
365
|
-
ADD CONSTRAINT "$1" FOREIGN KEY (elt_id) REFERENCES elts(id);
|
366
|
-
|
367
|
-
|
368
383
|
--
|
369
384
|
-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
370
385
|
--
|
371
386
|
|
372
|
-
ALTER TABLE ONLY
|
387
|
+
ALTER TABLE ONLY subscriptions
|
373
388
|
ADD CONSTRAINT "$2" FOREIGN KEY (person_id) REFERENCES people(id);
|
374
389
|
|
375
390
|
|
@@ -393,23 +408,23 @@ ALTER TABLE ONLY delegations
|
|
393
408
|
-- Name: fk_elt_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
394
409
|
--
|
395
410
|
|
396
|
-
ALTER TABLE ONLY
|
397
|
-
ADD CONSTRAINT fk_elt_id FOREIGN KEY (elt_id) REFERENCES elts(id) ON UPDATE CASCADE;
|
411
|
+
ALTER TABLE ONLY mails
|
412
|
+
ADD CONSTRAINT fk_elt_id FOREIGN KEY (elt_id) REFERENCES elts(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
398
413
|
|
399
414
|
|
400
415
|
--
|
401
416
|
-- Name: fk_elt_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
402
417
|
--
|
403
418
|
|
404
|
-
ALTER TABLE ONLY
|
405
|
-
ADD CONSTRAINT fk_elt_id FOREIGN KEY (
|
419
|
+
ALTER TABLE ONLY choices
|
420
|
+
ADD CONSTRAINT fk_elt_id FOREIGN KEY (elt_id) REFERENCES elts(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
406
421
|
|
407
422
|
|
408
423
|
--
|
409
424
|
-- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
410
425
|
--
|
411
426
|
|
412
|
-
ALTER TABLE ONLY
|
427
|
+
ALTER TABLE ONLY elts
|
413
428
|
ADD CONSTRAINT fk_person_id FOREIGN KEY (person_id) REFERENCES people(id) ON UPDATE CASCADE;
|
414
429
|
|
415
430
|
|
@@ -417,20 +432,20 @@ ALTER TABLE ONLY choices
|
|
417
432
|
-- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
418
433
|
--
|
419
434
|
|
420
|
-
ALTER TABLE ONLY
|
421
|
-
ADD CONSTRAINT fk_person_id FOREIGN KEY (
|
435
|
+
ALTER TABLE ONLY users
|
436
|
+
ADD CONSTRAINT fk_person_id FOREIGN KEY ("login") REFERENCES people(name) ON UPDATE CASCADE;
|
422
437
|
|
423
438
|
|
424
439
|
--
|
425
440
|
-- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
426
441
|
--
|
427
442
|
|
428
|
-
ALTER TABLE ONLY
|
429
|
-
ADD CONSTRAINT fk_person_id FOREIGN KEY (
|
443
|
+
ALTER TABLE ONLY choices
|
444
|
+
ADD CONSTRAINT fk_person_id FOREIGN KEY (person_id) REFERENCES people(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
430
445
|
|
431
446
|
|
432
447
|
--
|
433
448
|
-- PostgreSQL database dump complete
|
434
449
|
--
|
435
450
|
|
436
|
-
INSERT INTO schema_info (version) VALUES (
|
451
|
+
INSERT INTO schema_info (version) VALUES (5)
|
@@ -2,7 +2,7 @@ class EltChildrenCount < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
3
3
|
add_column :elts, :elts_count, :integer, :default => 0
|
4
4
|
execute 'UPDATE elts SET elts_count = (SELECT COUNT(*) FROM elts e2 WHERE e2.parent_id = elts.id)'
|
5
|
-
add_index "elts", ["lft"], :name => "elts_lft_key"
|
5
|
+
add_index "elts", ["lft"], :name => "elts_lft_key"
|
6
6
|
add_index "elts", ["parent_id"], :name => "elts_parent_key"
|
7
7
|
end
|
8
8
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class FilterMail < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :subscribers, :filter, :integer, :default => 0
|
4
|
+
execute 'ALTER TABLE subscribers ADD id SERIAL PRIMARY KEY'
|
5
|
+
execute 'ALTER TABLE subscribers ADD created_on timestamptz NOT NULL DEFAULT now();'
|
6
|
+
execute 'ALTER TABLE subscribers RENAME TO subscriptions'
|
7
|
+
create_table :person_mails do |t|
|
8
|
+
t.column :mail_id, :string, :null => false
|
9
|
+
t.column :person_id, :string
|
10
|
+
t.column :created_on, :datetime, :null => false
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
execute 'ALTER TABLE subscriptions RENAME TO subscribers'
|
16
|
+
remove_column :subscribers, :id
|
17
|
+
remove_column :subscribers, :filter
|
18
|
+
remove_column :subscribers, :created_on
|
19
|
+
drop_table :person_mails
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -103,11 +103,19 @@ function getCookie(name) {
|
|
103
103
|
}
|
104
104
|
|
105
105
|
function setCookie(name, value) {
|
106
|
-
var
|
107
|
-
document.cookie =
|
106
|
+
var expires_date = new Date( new Date().getTime() + (3000 * 1000 * 60 * 60 * 24) );
|
107
|
+
document.cookie = name + "=" +escape( value ) +
|
108
|
+
(";expires=" + expires_date.toGMTString());
|
109
|
+
/*+
|
110
|
+
( ( path ) ? ";path=" + path : "" ) +
|
111
|
+
( ( domain ) ? ";domain=" + domain : "" ) +
|
112
|
+
( ( secure ) ? ";secure" : "" );*/
|
108
113
|
}
|
109
114
|
|
110
115
|
|
116
|
+
/*
|
117
|
+
* This is not the value itself, but an index
|
118
|
+
*/
|
111
119
|
function setFilter(filter) {
|
112
120
|
document.getElementsByClassName('result').each( function(result) {
|
113
121
|
//alert(parseInt(result.innerHTML)+', '+filter);
|
@@ -193,32 +193,36 @@ h1 .help {
|
|
193
193
|
text-align: right;
|
194
194
|
font-weight: bolder; }
|
195
195
|
|
196
|
-
#
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
div#identity iframe {
|
206
|
-
display: none; }
|
207
|
-
div#identity form.setAvatar input[type='file'] { width: 90%; }
|
196
|
+
#identity form { display: block; }
|
197
|
+
#identity form.setAvatar, #identity #edit, #identity iframe { display: none; }
|
198
|
+
#identity:hover form.setAvatar, #identity:hover #edit { display: block; }
|
199
|
+
#identity fieldset#edit {
|
200
|
+
border: solid thin yellow;
|
201
|
+
padding: 0.5em 0;
|
202
|
+
margin: 0.5em 0; }
|
203
|
+
#identity fieldset#edit label { color: #3b76ae; }
|
204
|
+
#identity fieldset#edit legend { color: #333; }
|
208
205
|
img.avatar {
|
209
206
|
float: left;
|
210
207
|
width: auto;
|
211
208
|
max-width: 30%;
|
212
209
|
_max-width: none;
|
213
210
|
margin-right: 1em; }
|
214
|
-
|
211
|
+
#identity img.avatar {
|
215
212
|
float: none;
|
216
213
|
margin: 0 auto;
|
217
214
|
display: block;
|
218
215
|
max-width: 90%;
|
219
216
|
_max-width: none;
|
220
217
|
width: expression((offsetWidth > document.body.offsetWidth*0.3) ? "100%" : offsetWidth); }
|
221
|
-
|
218
|
+
|
219
|
+
#filter {
|
220
|
+
border: none;
|
221
|
+
text-align: center; }
|
222
|
+
form#filterForm a {
|
223
|
+
font-size: larger;
|
224
|
+
font-weight: bolder; }
|
225
|
+
form#filterForm input[type='submit'] { display: none; }
|
222
226
|
|
223
227
|
div.listByDate ul, div.listByVote ul {
|
224
228
|
margin: 0 3px;
|
@@ -435,7 +439,9 @@ li.pager {
|
|
435
439
|
| | | | | | (_) / /_____| |_) | (_) | | | (_| | __/ |
|
436
440
|
|_| |_| |_|\___/___| |_.__/ \___/|_| \__,_|\___|_| */
|
437
441
|
body { -moz-border-radius: 1em 0 1em 1em; }
|
438
|
-
input, textarea
|
442
|
+
input, textarea {
|
443
|
+
-moz-border-radius: 1em 0 0 1em; }
|
444
|
+
input[type='button'], input[type='submit'], blockquote {
|
439
445
|
-moz-border-radius: 0 1em 1em 0; }
|
440
446
|
.links { -moz-border-radius: 1em 1em 0 0; }
|
441
447
|
.box, .sidebar, .choices { -moz-border-radius: 0 0 1em 1em; }
|
data/test/unit/choice_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
2
|
|
3
3
|
class ChoiceTest < Test::Unit::TestCase
|
4
|
-
#fixtures :people, :users, :elts, :mails, :attachments, :
|
4
|
+
#fixtures :people, :users, :elts, :mails, :attachments, :subscriptions, :choices
|
5
5
|
|
6
6
|
# Replace this with your real tests.
|
7
7
|
def test_truth
|
data/test/unit/elt_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
2
|
|
3
3
|
class EltTest < Test::Unit::TestCase
|
4
|
-
fixtures :people, :users, :elts, :mails, :attachments, :
|
4
|
+
fixtures :people, :users, :elts, :mails, :attachments, :subscriptions
|
5
5
|
|
6
6
|
def setup
|
7
7
|
@elt = Elt.find(1)
|
@@ -2,16 +2,16 @@ require File.dirname(__FILE__) + '/../test_helper'
|
|
2
2
|
require 'mail_notify'
|
3
3
|
|
4
4
|
class MailNotifyTest < Test::Unit::TestCase
|
5
|
-
fixtures :elts, :mails, :attachments, :people, :users, :
|
5
|
+
fixtures :elts, :mails, :attachments, :people, :users, :subscriptions
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def setup
|
8
|
+
ActionMailer::Base.delivery_method = :test
|
9
|
+
ActionMailer::Base.perform_deliveries = true
|
10
|
+
ActionMailer::Base.deliveries = []
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
@expected = TMail::Mail.new
|
13
|
+
@expected.set_content_type "text", "plain", { "charset" => CHARSET }
|
14
|
+
end
|
15
15
|
|
16
16
|
def test_deliver_mail
|
17
17
|
ActionMailer::Base.deliveries = []
|
@@ -37,5 +37,21 @@ class MailNotifyTest < Test::Unit::TestCase
|
|
37
37
|
assert_equal "mail@leparlement.org", ActionMailer::Base.deliveries[0].to[0]
|
38
38
|
#puts ActionMailer::Base.deliveries[0].to
|
39
39
|
end
|
40
|
+
|
41
|
+
def test_deliver_accents
|
42
|
+
ActionMailer::Base.deliveries = []
|
43
|
+
|
44
|
+
assert_equal 0, ActionMailer::Base.deliveries.size
|
45
|
+
|
46
|
+
elt = Elt.find('mailList')
|
47
|
+
#elt.id = "Légèreté"
|
48
|
+
elt.save
|
49
|
+
elt.publish
|
50
|
+
|
51
|
+
assert_equal 1, ActionMailer::Base.deliveries.size
|
52
|
+
assert_equal "mail@leparlement.org", ActionMailer::Base.deliveries[0].to[0]
|
53
|
+
#puts ActionMailer::Base.deliveries[0].to
|
54
|
+
#puts elt.id
|
55
|
+
end
|
40
56
|
end
|
41
57
|
|
data/test/unit/mail_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
2
|
|
3
3
|
class MailTest < Test::Unit::TestCase
|
4
|
-
fixtures :people, :users, :elts, :mails, :attachments, :
|
4
|
+
fixtures :people, :users, :elts, :mails, :attachments, :subscriptions
|
5
5
|
|
6
6
|
def setup
|
7
7
|
@mail = Mail.find(1)
|
@@ -93,7 +93,7 @@ class MailTest < Test::Unit::TestCase
|
|
93
93
|
end
|
94
94
|
|
95
95
|
# Not used, just make sure mails are entered chronologically
|
96
|
-
def
|
96
|
+
def test_receiveChildThenParent
|
97
97
|
ActionMailer::Base.deliveries = []
|
98
98
|
|
99
99
|
mailFile = TMail::Mail.parse(read_fixture('mail_rubyChild').to_s)
|
@@ -109,7 +109,7 @@ class MailTest < Test::Unit::TestCase
|
|
109
109
|
assert_equal (mailsCount + 1), Mail.count
|
110
110
|
assert_equal (eltsCount + 1), Elt.count
|
111
111
|
|
112
|
-
assert_equal
|
112
|
+
assert_equal "mailingList", elt.parent_id
|
113
113
|
end
|
114
114
|
|
115
115
|
def test_re_receive
|
@@ -169,15 +169,31 @@ class MailTest < Test::Unit::TestCase
|
|
169
169
|
mailFile = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
170
170
|
elt = Mail.receive(mailFile).elt
|
171
171
|
|
172
|
-
#
|
173
|
-
#puts
|
172
|
+
#puts mailFile.to_yaml
|
174
173
|
#puts mailFile.type_param('charset')
|
175
|
-
|
176
174
|
#puts elt.body
|
177
175
|
|
178
176
|
assert elt.body =~ /même/
|
179
177
|
end
|
180
178
|
|
179
|
+
def test_receive_utf8
|
180
|
+
ActionMailer::Base.deliveries = []
|
181
|
+
|
182
|
+
mailsCount = Mail.count
|
183
|
+
eltsCount = Elt.count
|
184
|
+
deliveredMailsCount = ActionMailer::Base.deliveries.size
|
185
|
+
|
186
|
+
mailFile = TMail::Mail.parse(read_fixture('utf8').to_s)
|
187
|
+
elt = Mail.receive(mailFile).elt
|
188
|
+
|
189
|
+
#puts mailFile.body
|
190
|
+
#puts mailFile.type_param('charset')
|
191
|
+
#puts elt.body
|
192
|
+
|
193
|
+
assert elt.body =~ /dérangeant/
|
194
|
+
assert elt.body =~ /…/
|
195
|
+
end
|
196
|
+
|
181
197
|
def test_receive_accents
|
182
198
|
ActionMailer::Base.deliveries = []
|
183
199
|
|
@@ -200,6 +216,28 @@ class MailTest < Test::Unit::TestCase
|
|
200
216
|
assert elt.body =~ /éêè à ça/
|
201
217
|
end
|
202
218
|
|
219
|
+
def test_receive_accents_2
|
220
|
+
ActionMailer::Base.deliveries = []
|
221
|
+
|
222
|
+
mailsCount = Mail.count
|
223
|
+
eltsCount = Elt.count
|
224
|
+
deliveredMailsCount = ActionMailer::Base.deliveries.size
|
225
|
+
|
226
|
+
|
227
|
+
mailFile = TMail::Mail.parse(read_fixture('accents_2').to_s)
|
228
|
+
elt = Mail.receive(mailFile).elt
|
229
|
+
|
230
|
+
#print mailFile.to_yaml
|
231
|
+
#puts
|
232
|
+
#puts mailFile.type_param('charset')
|
233
|
+
|
234
|
+
#puts elt.subject
|
235
|
+
#puts elt.body
|
236
|
+
|
237
|
+
assert elt.subject =~ /Contrôle des criminels/
|
238
|
+
assert elt.body =~ /peut-être/
|
239
|
+
end
|
240
|
+
|
203
241
|
def test_receive_no_choice
|
204
242
|
ActionMailer::Base.deliveries = []
|
205
243
|
|
@@ -256,5 +294,22 @@ class MailTest < Test::Unit::TestCase
|
|
256
294
|
assert_equal "image/jpeg", elt.attachments.first.content_type
|
257
295
|
assert_equal 2, ActionMailer::Base.deliveries.last.parts.size
|
258
296
|
end
|
297
|
+
|
298
|
+
def test_send_and_record_mails
|
299
|
+
#puts "test_send_and_record_mails"
|
300
|
+
ActionMailer::Base.deliveries = []
|
301
|
+
deliveredMailsCount = ActionMailer::Base.deliveries.size
|
302
|
+
mail = TMail::Mail.parse(read_fixture('avatar').to_s)
|
303
|
+
elt = Mail.receive(mail).elt
|
304
|
+
# people and avatar mail!
|
305
|
+
#puts "--------------------------"
|
306
|
+
assert_equal deliveredMailsCount + 2, ActionMailer::Base.deliveries.size
|
307
|
+
|
308
|
+
# TODO make sure the pseudo parent has a vote "result"!!!
|
309
|
+
assert_equal elt.all_recipients.size, PersonMail.count
|
310
|
+
# Again, to check there is no second sending
|
311
|
+
elt.publish
|
312
|
+
assert_equal elt.all_recipients.size, PersonMail.count
|
313
|
+
end
|
259
314
|
end
|
260
315
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
-
require '
|
2
|
+
require 'person_notify'
|
3
3
|
|
4
|
-
class
|
4
|
+
class PersonNotifyTest < Test::Unit::TestCase
|
5
5
|
def setup
|
6
6
|
ActionMailer::Base.delivery_method = :test
|
7
7
|
ActionMailer::Base.perform_deliveries = true
|
data/test/unit/person_test.rb
CHANGED
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../test_helper'
|
|
2
2
|
|
3
3
|
class PersonTest < Test::Unit::TestCase
|
4
4
|
#fixtures :people, LoginEngine.config(:user_table).to_sym
|
5
|
-
fixtures :people, :users, :elts, :mails, :attachments, :
|
5
|
+
fixtures :people, :users, :elts, :mails, :attachments, :subscriptions
|
6
6
|
|
7
7
|
def setup
|
8
8
|
@person = Person.find(:first)
|
@@ -1,42 +1,42 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
2
|
|
3
3
|
class SubscriberTest < Test::Unit::TestCase
|
4
|
-
|
4
|
+
fixtures :people, :users, :elts, :mails, :attachments, :subscriptions
|
5
5
|
|
6
|
-
|
6
|
+
def setup
|
7
7
|
@elt = Elt.find('mail')
|
8
8
|
@person = Person.find('first')
|
9
|
-
|
9
|
+
end
|
10
10
|
|
11
|
-
|
11
|
+
def test_add_subscriber
|
12
12
|
num = @elt.subscribers.size
|
13
13
|
@elt.subscribers << Person.find('bob')
|
14
14
|
assert_equal (num + 1), @elt.subscribers.size
|
15
|
-
|
15
|
+
end
|
16
16
|
|
17
|
-
|
17
|
+
def test_delete_subscriber
|
18
18
|
num = @elt.subscribers.size
|
19
19
|
@elt.subscribers.delete(@person)
|
20
20
|
assert_equal (num - 1), @elt.subscribers.size
|
21
|
-
|
21
|
+
end
|
22
22
|
|
23
23
|
def test_add_subscribed_elt
|
24
24
|
num = @person.subscribed_elts.size
|
25
25
|
@person.subscribed_elts << Elt.find('0')
|
26
26
|
assert_equal (num + 1), @person.subscribed_elts.size
|
27
|
-
|
27
|
+
end
|
28
28
|
|
29
|
-
|
29
|
+
def test_delete_subscribed_elt
|
30
30
|
num = @person.subscribed_elts.size
|
31
31
|
@person.subscribed_elts.delete(@elt)
|
32
32
|
assert_equal (num - 1), @person.subscribed_elts.size
|
33
|
-
|
33
|
+
end
|
34
34
|
|
35
|
-
|
35
|
+
def test_all_recipients
|
36
36
|
num = @elt.all_recipients.size
|
37
37
|
@elt.subscribers << Person.find('bob')
|
38
38
|
@elt.parent.subscribers << Person.find('bob2')
|
39
39
|
assert_equal (num + 2), @elt.all_recipients.size
|
40
|
-
|
40
|
+
end
|
41
41
|
end
|
42
42
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: parlement
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "0.
|
7
|
-
date: 2006-
|
6
|
+
version: "0.10"
|
7
|
+
date: 2006-12-17 00:00:00 +01:00
|
8
8
|
summary: Trusted Direct Democracy on a forum
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -12,7 +12,7 @@ email: emmanuel.charpentier@free.fr
|
|
12
12
|
homepage: http://leparlement.org
|
13
13
|
rubyforge_project: parlement
|
14
14
|
description: "This is a forum and mailing list project, which aims to be a complete Direct Democracy implementation where everybody can propose polls, vote on them, or delegate their voice to someone else. Trust through: - cluster - PGP signatures - electoral lists"
|
15
|
-
autorequire: rails redcloth
|
15
|
+
autorequire: rails redcloth term-ansicolor
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
18
18
|
has_rdoc: false
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- COPYING
|
33
33
|
- Rakefile
|
34
34
|
- README
|
35
|
+
- MEMORY
|
35
36
|
- app/apis
|
36
37
|
- app/controllers
|
37
38
|
- app/helpers
|
@@ -49,7 +50,6 @@ files:
|
|
49
50
|
- app/helpers/mailman.rb
|
50
51
|
- app/helpers/account_helper.rb
|
51
52
|
- app/helpers/subscriber_helper.rb
|
52
|
-
- app/models/notifier.rb
|
53
53
|
- app/models/user.rb
|
54
54
|
- app/models/person.rb
|
55
55
|
- app/models/mail.rb
|
@@ -57,14 +57,17 @@ files:
|
|
57
57
|
- app/models/choice.rb
|
58
58
|
- app/models/mail_notify.rb
|
59
59
|
- app/models/user_notify.rb
|
60
|
+
- app/models/person_notify.rb
|
61
|
+
- app/models/person_mail.rb
|
62
|
+
- app/models/subscription.rb
|
60
63
|
- app/views/layouts
|
61
64
|
- app/views/elt
|
62
65
|
- app/views/account
|
63
|
-
- app/views/notifier
|
64
66
|
- app/views/person
|
65
67
|
- app/views/_help.rhtml
|
66
68
|
- app/views/subscriber
|
67
69
|
- app/views/mail_notify
|
70
|
+
- app/views/person_notify
|
68
71
|
- app/views/layouts/top.rhtml
|
69
72
|
- app/views/layouts/scaffold.rhtml
|
70
73
|
- app/views/elt/_elt.rhtml
|
@@ -84,11 +87,12 @@ files:
|
|
84
87
|
- app/views/account/logout.rhtml
|
85
88
|
- app/views/account/signup.rhtml
|
86
89
|
- app/views/account/_show.rhtml
|
87
|
-
- app/views/notifier/changeEmail.rhtml
|
88
90
|
- app/views/person/show.rhtml
|
89
91
|
- app/views/person/_listElts.rhtml
|
92
|
+
- app/views/subscriber/_list.rhtml
|
90
93
|
- app/views/mail_notify/publish.text.html.rhtml
|
91
94
|
- app/views/mail_notify/publish.text.plain.rhtml
|
95
|
+
- app/views/person_notify/setEmail.rhtml
|
92
96
|
- config/environments
|
93
97
|
- config/database.yml
|
94
98
|
- config/routes.rb
|
@@ -107,6 +111,7 @@ files:
|
|
107
111
|
- db/migrate/002_nested_set.rb
|
108
112
|
- db/migrate/003_elt_children_count.rb
|
109
113
|
- db/migrate/004_people_image.rb
|
114
|
+
- db/migrate/005_filter_mail.rb
|
110
115
|
- db/ROOT/perso
|
111
116
|
- db/ROOT/parlement.txt
|
112
117
|
- db/ROOT/perso.txt
|
@@ -116,21 +121,21 @@ files:
|
|
116
121
|
- db/ROOT/mail.txt
|
117
122
|
- db/ROOT/parlement/security.txt
|
118
123
|
- db/ROOT/parlement/test.txt
|
119
|
-
- db/ROOT/parlement/
|
120
|
-
- db/ROOT/parlement/news
|
124
|
+
- db/ROOT/parlement/News
|
121
125
|
- db/ROOT/parlement/news.txt
|
122
126
|
- db/ROOT/parlement/top-politics.txt
|
123
127
|
- db/ROOT/parlement/ddRing.txt
|
128
|
+
- db/ROOT/parlement/Security
|
124
129
|
- db/ROOT/parlement/our-constitution.txt
|
125
|
-
- db/ROOT/parlement/
|
126
|
-
- db/ROOT/parlement/
|
127
|
-
- db/ROOT/parlement/
|
128
|
-
- db/ROOT/parlement/
|
129
|
-
- db/ROOT/parlement/
|
130
|
-
- db/ROOT/parlement/
|
131
|
-
- db/ROOT/parlement/
|
132
|
-
- db/ROOT/parlement/
|
133
|
-
- db/ROOT/parlement/
|
130
|
+
- db/ROOT/parlement/News/Version_03.txt
|
131
|
+
- db/ROOT/parlement/News/Version_04.txt
|
132
|
+
- db/ROOT/parlement/News/Version_05.txt
|
133
|
+
- db/ROOT/parlement/News/Version_07.txt
|
134
|
+
- db/ROOT/parlement/News/Version_06.txt
|
135
|
+
- db/ROOT/parlement/News/Version_01.txt
|
136
|
+
- db/ROOT/parlement/News/Version_08.txt
|
137
|
+
- db/ROOT/parlement/News/Version_02.txt
|
138
|
+
- db/ROOT/parlement/Security/anonymity.txt
|
134
139
|
- lib/localization.rb
|
135
140
|
- lib/tasks
|
136
141
|
- lib/data_import.rb
|
@@ -157,7 +162,6 @@ files:
|
|
157
162
|
- public/images/Sleep-Deprivation-5.JPG
|
158
163
|
- public/images/indicator.gif
|
159
164
|
- public/images/smile.png
|
160
|
-
- public/images/comments.gif
|
161
165
|
- public/images/eltBackground.svg
|
162
166
|
- public/images/world.png
|
163
167
|
- public/images/world.svg
|
@@ -372,12 +376,12 @@ files:
|
|
372
376
|
test_files:
|
373
377
|
- test/unit/mail_test.rb
|
374
378
|
- test/unit/elt_test.rb
|
375
|
-
- test/unit/notifier_test.rb
|
376
379
|
- test/unit/person_test.rb
|
377
380
|
- test/unit/attachment_test.rb
|
378
381
|
- test/unit/mail_notify_test.rb
|
379
382
|
- test/unit/subscriber_test.rb
|
380
383
|
- test/unit/choice_test.rb
|
384
|
+
- test/unit/person_notify_test.rb
|
381
385
|
rdoc_options: []
|
382
386
|
|
383
387
|
extra_rdoc_files: []
|
@@ -390,7 +394,7 @@ requirements:
|
|
390
394
|
- none
|
391
395
|
dependencies:
|
392
396
|
- !ruby/object:Gem::Dependency
|
393
|
-
name: rails
|
397
|
+
name: rails redcloth term-ansicolor
|
394
398
|
version_requirement:
|
395
399
|
version_requirements: !ruby/object:Gem::Version::Requirement
|
396
400
|
requirements:
|
data/app/models/notifier.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
class Notifier < ActionMailer::Base
|
2
|
-
def changeEmail(person, link)
|
3
|
-
# Email header info MUST be added here
|
4
|
-
@recipients = person.email
|
5
|
-
@subject = "[parleR] check key: "+person.check_key
|
6
|
-
@from = MAIL_FROM
|
7
|
-
|
8
|
-
# Email body substitutions go here
|
9
|
-
@body["name"] = person.name
|
10
|
-
@body["link"] = link
|
11
|
-
@body["check_key"] = person.check_key
|
12
|
-
end
|
13
|
-
end
|