message_train 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -7
- data/README.rdoc +4 -0
- data/VERSION +1 -1
- data/app/controllers/message_train/messages_controller.rb +1 -1
- data/app/models/message_train/attachment.rb +1 -1
- data/app/models/message_train/box.rb +2 -2
- data/app/models/message_train/conversation.rb +3 -3
- data/app/models/message_train/ignore.rb +1 -1
- data/app/models/message_train/message.rb +4 -4
- data/app/models/message_train/receipt.rb +2 -2
- data/app/views/message_train/messages/_message.html.haml +4 -4
- data/app/views/message_train/messages/new.html.haml +1 -1
- data/db/migrate/20150721160322_create_message_train_messages.rb +1 -1
- data/db/migrate/20150721161144_create_message_train_attachments.rb +1 -1
- data/db/migrate/20150721161940_create_message_train_receipts.rb +1 -1
- data/db/migrate/20150721163838_create_message_train_ignores.rb +1 -1
- data/db/migrate/20151004184347_add_unique_index_to_receipts.rb +1 -1
- data/message_train.gemspec +14 -14
- data/spec/controllers/message_train/messages_controller_spec.rb +1 -1
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/dummy/db/migrate/{20150901183629_create_message_train_conversations.message_train.rb → 20160207190402_create_message_train_conversations.message_train.rb} +0 -0
- data/spec/dummy/db/migrate/{20150901183630_create_message_train_messages.message_train.rb → 20160207190403_create_message_train_messages.message_train.rb} +1 -1
- data/spec/dummy/db/migrate/{20150901183631_create_message_train_attachments.message_train.rb → 20160207190404_create_message_train_attachments.message_train.rb} +1 -1
- data/spec/dummy/db/migrate/{20150901183632_create_message_train_receipts.message_train.rb → 20160207190405_create_message_train_receipts.message_train.rb} +1 -1
- data/spec/dummy/db/migrate/{20150901183633_create_message_train_ignores.message_train.rb → 20160207190406_create_message_train_ignores.message_train.rb} +1 -1
- data/spec/dummy/db/migrate/{20150901183634_add_received_through_to_message_train_receipts.message_train.rb → 20160207190407_add_received_through_to_message_train_receipts.message_train.rb} +0 -0
- data/spec/dummy/db/migrate/{20151004184519_add_unique_index_to_receipts.message_train.rb → 20160207190408_add_unique_index_to_receipts.message_train.rb} +1 -1
- data/spec/dummy/db/migrate/{20151124001417_create_message_train_unsubscribes.message_train.rb → 20160207190409_create_message_train_unsubscribes.message_train.rb} +1 -1
- data/spec/dummy/db/schema.rb +24 -24
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/features/boxes_spec.rb +1 -1
- data/spec/models/message_train/box_spec.rb +9 -24
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ca8f7374b6197d38499d0d1bac1ccfb13387fe4
|
4
|
+
data.tar.gz: 945d789ade7dbe77f94bddbbcfc10f7a06bc261d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ac0f49acf314026f290268f5ba503c3d1327e5b0630ffe230198c83ce4ac220ade58e21297da2c1ca3ee8ccdacca6101547e3d17cb8f744d725b7aa3ccbf01
|
7
|
+
data.tar.gz: 74f865f58d13e3616b61d4a39d79cd4dbc05aea4289db8650c90d980cac5bd2cf2d33db3b5269660c86e5cdb016569984ed29c82e4b37b01665077f4fe870797
|
data/Gemfile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
|
-
# gem
|
5
|
-
gem 'rails', '~> 4'
|
4
|
+
# gem 'activesupport', '>= 2.3.5'
|
5
|
+
gem 'rails', '~> 4.2.5'
|
6
6
|
gem 'paperclip', '~> 4.3'
|
7
7
|
gem 'rails-i18n', '~> 4'
|
8
8
|
gem 'haml-rails', '~> 0.9'
|
@@ -23,9 +23,9 @@ gem 'cocoon', '~> 1.2'
|
|
23
23
|
# Add dependencies to develop your gem here.
|
24
24
|
# Include everything needed to run rake, tests, features, etc.
|
25
25
|
group :development do
|
26
|
-
gem
|
27
|
-
gem
|
28
|
-
gem
|
26
|
+
gem 'sdoc', '~> 0.4.1'
|
27
|
+
gem 'bundler', '~> 1.0'
|
28
|
+
gem 'jeweler', '~> 2.0'
|
29
29
|
end
|
30
30
|
|
31
31
|
group :development, :test do
|
@@ -47,7 +47,7 @@ group :test do
|
|
47
47
|
gem 'database_cleaner', '~> 1.4'
|
48
48
|
gem 'rspec-collection_matchers', '~> 1.1'
|
49
49
|
gem 'shoulda-matchers', '~> 2.8'
|
50
|
-
gem
|
50
|
+
gem 'launchy', '~> 2.1.2', require: false
|
51
51
|
gem 'coveralls', '~> 0.8', require: false
|
52
52
|
gem 'rspec-html-matchers', '~> 0.7'
|
53
53
|
gem 'selenium-webdriver', '~> 2'
|
data/README.rdoc
CHANGED
@@ -139,6 +139,10 @@ Or in your initializer:
|
|
139
139
|
|
140
140
|
== Upgrading
|
141
141
|
|
142
|
+
=== 0.4.0
|
143
|
+
|
144
|
+
Version 0.4.0 introduced database changes to the foreign key columns to work with Rails 4.2.5. Let me know if you need help migrating your app to the newly named foreign keys.
|
145
|
+
|
142
146
|
=== 0.3.0
|
143
147
|
|
144
148
|
A new config variable was added for the user model, which will be used to generate a new user if the user is anonymous.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -11,7 +11,7 @@ module MessageTrain
|
|
11
11
|
|
12
12
|
# GET /box/:division/messages/new
|
13
13
|
def new
|
14
|
-
@message = @box.new_message(
|
14
|
+
@message = @box.new_message(message_train_conversation_id: params[:conversation_id])
|
15
15
|
end
|
16
16
|
|
17
17
|
# GET /box/:division/messages/:id/edit
|
@@ -60,10 +60,10 @@ module MessageTrain
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def new_message(args = {})
|
63
|
-
if args[:
|
63
|
+
if args[:message_train_conversation_id].nil?
|
64
64
|
message = MessageTrain::Message.new(args)
|
65
65
|
else
|
66
|
-
conversation = find_conversation(args[:
|
66
|
+
conversation = find_conversation(args[:message_train_conversation_id])
|
67
67
|
previous_message = conversation.messages.last
|
68
68
|
message = conversation.messages.build(args)
|
69
69
|
message.subject = "Re: #{conversation.subject}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module MessageTrain
|
2
2
|
class Conversation < ActiveRecord::Base
|
3
|
-
has_many :messages
|
4
|
-
has_many :ignores
|
3
|
+
has_many :messages, foreign_key: :message_train_conversation_id
|
4
|
+
has_many :ignores, foreign_key: :message_train_conversation_id
|
5
5
|
has_many :receipts, through: :messages
|
6
6
|
has_many :attachments, through: :messages
|
7
7
|
|
@@ -111,7 +111,7 @@ module MessageTrain
|
|
111
111
|
}
|
112
112
|
|
113
113
|
def self.ignored_ids_for(participant)
|
114
|
-
MessageTrain::Ignore.find_all_by_participant(participant).pluck(:
|
114
|
+
MessageTrain::Ignore.find_all_by_participant(participant).pluck(:message_train_conversation_id)
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -4,10 +4,10 @@ module MessageTrain
|
|
4
4
|
serialize :recipients_to_save, Hash
|
5
5
|
|
6
6
|
# Relationships
|
7
|
-
belongs_to :conversation
|
7
|
+
belongs_to :conversation, foreign_key: :message_train_conversation_id
|
8
8
|
belongs_to :sender, polymorphic: true
|
9
|
-
has_many :attachments
|
10
|
-
has_many :receipts
|
9
|
+
has_many :attachments, foreign_key: :message_train_message_id
|
10
|
+
has_many :receipts, foreign_key: :message_train_message_id
|
11
11
|
|
12
12
|
# Validations
|
13
13
|
validates_presence_of :sender, :subject
|
@@ -50,7 +50,7 @@ module MessageTrain
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def self.conversation_ids
|
53
|
-
pluck(:
|
53
|
+
pluck(:message_train_conversation_id)
|
54
54
|
end
|
55
55
|
|
56
56
|
def self.receipts
|
@@ -2,7 +2,7 @@ module MessageTrain
|
|
2
2
|
class Receipt < ActiveRecord::Base
|
3
3
|
belongs_to :recipient, polymorphic: true
|
4
4
|
belongs_to :received_through, polymorphic: true
|
5
|
-
belongs_to :message
|
5
|
+
belongs_to :message, foreign_key: :message_train_message_id
|
6
6
|
validates_presence_of :recipient, :message
|
7
7
|
|
8
8
|
default_scope { order(updated_at: :desc) }
|
@@ -31,7 +31,7 @@ module MessageTrain
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.message_ids
|
34
|
-
pluck(:
|
34
|
+
pluck(:message_train_message_id)
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.messages
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- if message.draft
|
2
|
-
.panel.panel-default{ class: message_class(@box, message), id: "message_train_message_#{message.id}", data: { mark_path: message_train.box_conversation_path(@box.division, id: message.
|
2
|
+
.panel.panel-default{ class: message_class(@box, message), id: "message_train_message_#{message.id}", data: { mark_path: message_train.box_conversation_path(@box.division, id: message.message_train_conversation_id, objects: { 'messages' => {message.id.to_s => message.id.to_s} }) } }
|
3
3
|
.panel-heading{role: "tab", id: "message_#{message.id}_heading"}
|
4
4
|
.message-actions.pull-right
|
5
5
|
= message_read_toggle message
|
@@ -15,7 +15,7 @@
|
|
15
15
|
.panel-body
|
16
16
|
= render partial: 'message_train/messages/form', locals: { message: message }
|
17
17
|
- else
|
18
|
-
.panel.panel-default{ class: message_class(@box, message), id: "message_train_message_#{message.id}", data: { mark_path: message_train.box_conversation_path(@box.division, id: message.
|
18
|
+
.panel.panel-default{ class: message_class(@box, message), id: "message_train_message_#{message.id}", data: { mark_path: message_train.box_conversation_path(@box.division, id: message.message_train_conversation_id, objects: { 'messages' => {message.id.to_s => message.id.to_s} }) } }
|
19
19
|
.panel-heading{role: "tab", id: "message_#{message.id}_heading"}
|
20
20
|
.message-actions.pull-right
|
21
21
|
= message_read_toggle message
|
@@ -40,6 +40,6 @@
|
|
40
40
|
- if @box.parent.allows_sending_by?(@box_user)
|
41
41
|
.panel-footer
|
42
42
|
- if @collective.nil?
|
43
|
-
= link_to :reply.l, message_train.new_box_message_path(@box, conversation_id: message.
|
43
|
+
= link_to :reply.l, message_train.new_box_message_path(@box, conversation_id: message.message_train_conversation_id), class: 'btn btn-primary'
|
44
44
|
- else
|
45
|
-
= link_to :reply.l, message_train.new_collective_box_message_path(@collective.path_part, @box, conversation_id: message.
|
45
|
+
= link_to :reply.l, message_train.new_collective_box_message_path(@collective.path_part, @box, conversation_id: message.message_train_conversation_id), class: 'btn btn-primary'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class CreateMessageTrainMessages < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :message_train_messages do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :message_train_conversation, index: true, foreign_key: true
|
5
5
|
t.references :sender, polymorphic: true, index: true
|
6
6
|
t.text :recipients_to_save
|
7
7
|
t.string :subject
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class CreateMessageTrainAttachments < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :message_train_attachments do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :message_train_message, index: true, foreign_key: true
|
5
5
|
t.attachment :attachment
|
6
6
|
|
7
7
|
t.timestamps null: false
|
@@ -2,7 +2,7 @@ class CreateMessageTrainReceipts < ActiveRecord::Migration
|
|
2
2
|
def change
|
3
3
|
create_table :message_train_receipts do |t|
|
4
4
|
t.references :recipient, polymorphic: true
|
5
|
-
t.references :
|
5
|
+
t.references :message_train_message, index: true, foreign_key: true
|
6
6
|
t.boolean :marked_read, default: false
|
7
7
|
t.boolean :marked_trash, default: false
|
8
8
|
t.boolean :marked_deleted, default: false
|
@@ -2,7 +2,7 @@ class CreateMessageTrainIgnores < ActiveRecord::Migration
|
|
2
2
|
def change
|
3
3
|
create_table :message_train_ignores do |t|
|
4
4
|
t.references :participant, polymorphic: true
|
5
|
-
t.references :
|
5
|
+
t.references :message_train_conversation, index: true, foreign_key: true
|
6
6
|
|
7
7
|
t.timestamps null: false
|
8
8
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class AddUniqueIndexToReceipts < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
add_index :message_train_receipts, [:
|
3
|
+
add_index :message_train_receipts, [:message_train_message_id, :recipient_type, :recipient_id], name: :message_recipient, unique: true
|
4
4
|
end
|
5
5
|
end
|
data/message_train.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: message_train 0.
|
5
|
+
# stub: message_train 0.4.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "message_train"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.4.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Karen Lundgren"]
|
14
|
-
s.date = "2016-
|
14
|
+
s.date = "2016-02-07"
|
15
15
|
s.description = "Rails 4 Engine providing private/public messaging for any object, such as Users or Groups"
|
16
16
|
s.email = "karen.e.lundgren@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -205,14 +205,14 @@ Gem::Specification.new do |s|
|
|
205
205
|
"spec/dummy/db/migrate/20150721141009_rolify_create_roles.rb",
|
206
206
|
"spec/dummy/db/migrate/20150721141128_create_groups.rb",
|
207
207
|
"spec/dummy/db/migrate/20150721150307_add_display_name_column_to_users.rb",
|
208
|
-
"spec/dummy/db/migrate/
|
209
|
-
"spec/dummy/db/migrate/
|
210
|
-
"spec/dummy/db/migrate/
|
211
|
-
"spec/dummy/db/migrate/
|
212
|
-
"spec/dummy/db/migrate/
|
213
|
-
"spec/dummy/db/migrate/
|
214
|
-
"spec/dummy/db/migrate/
|
215
|
-
"spec/dummy/db/migrate/
|
208
|
+
"spec/dummy/db/migrate/20160207190402_create_message_train_conversations.message_train.rb",
|
209
|
+
"spec/dummy/db/migrate/20160207190403_create_message_train_messages.message_train.rb",
|
210
|
+
"spec/dummy/db/migrate/20160207190404_create_message_train_attachments.message_train.rb",
|
211
|
+
"spec/dummy/db/migrate/20160207190405_create_message_train_receipts.message_train.rb",
|
212
|
+
"spec/dummy/db/migrate/20160207190406_create_message_train_ignores.message_train.rb",
|
213
|
+
"spec/dummy/db/migrate/20160207190407_add_received_through_to_message_train_receipts.message_train.rb",
|
214
|
+
"spec/dummy/db/migrate/20160207190408_add_unique_index_to_receipts.message_train.rb",
|
215
|
+
"spec/dummy/db/migrate/20160207190409_create_message_train_unsubscribes.message_train.rb",
|
216
216
|
"spec/dummy/db/schema.rb",
|
217
217
|
"spec/dummy/db/seeds.rb",
|
218
218
|
"spec/dummy/db/seeds/conversations.seeds.rb",
|
@@ -282,7 +282,7 @@ Gem::Specification.new do |s|
|
|
282
282
|
s.specification_version = 4
|
283
283
|
|
284
284
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
285
|
-
s.add_runtime_dependency(%q<rails>, ["~> 4"])
|
285
|
+
s.add_runtime_dependency(%q<rails>, ["~> 4.2.5"])
|
286
286
|
s.add_runtime_dependency(%q<paperclip>, ["~> 4.3"])
|
287
287
|
s.add_runtime_dependency(%q<rails-i18n>, ["~> 4"])
|
288
288
|
s.add_runtime_dependency(%q<haml-rails>, ["~> 0.9"])
|
@@ -311,7 +311,7 @@ Gem::Specification.new do |s|
|
|
311
311
|
s.add_development_dependency(%q<byebug>, ["~> 5"])
|
312
312
|
s.add_development_dependency(%q<high_voltage>, ["~> 2.4"])
|
313
313
|
else
|
314
|
-
s.add_dependency(%q<rails>, ["~> 4"])
|
314
|
+
s.add_dependency(%q<rails>, ["~> 4.2.5"])
|
315
315
|
s.add_dependency(%q<paperclip>, ["~> 4.3"])
|
316
316
|
s.add_dependency(%q<rails-i18n>, ["~> 4"])
|
317
317
|
s.add_dependency(%q<haml-rails>, ["~> 0.9"])
|
@@ -341,7 +341,7 @@ Gem::Specification.new do |s|
|
|
341
341
|
s.add_dependency(%q<high_voltage>, ["~> 2.4"])
|
342
342
|
end
|
343
343
|
else
|
344
|
-
s.add_dependency(%q<rails>, ["~> 4"])
|
344
|
+
s.add_dependency(%q<rails>, ["~> 4.2.5"])
|
345
345
|
s.add_dependency(%q<paperclip>, ["~> 4.3"])
|
346
346
|
s.add_dependency(%q<rails-i18n>, ["~> 4"])
|
347
347
|
s.add_dependency(%q<haml-rails>, ["~> 0.9"])
|
@@ -43,7 +43,7 @@ describe MessageTrain::MessagesController do
|
|
43
43
|
|
44
44
|
describe "GET #new" do
|
45
45
|
before do
|
46
|
-
get :new, box_division: 'in', conversation_id: unread_message.
|
46
|
+
get :new, box_division: 'in', conversation_id: unread_message.message_train_conversation_id
|
47
47
|
end
|
48
48
|
it_should_behave_like 'a successful page', which_renders: 'new'
|
49
49
|
|
data/spec/dummy/config/routes.rb
CHANGED
File without changes
|
@@ -2,7 +2,7 @@
|
|
2
2
|
class CreateMessageTrainMessages < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :message_train_messages do |t|
|
5
|
-
t.references :
|
5
|
+
t.references :message_train_conversation, index: true, foreign_key: true
|
6
6
|
t.references :sender, polymorphic: true, index: true
|
7
7
|
t.text :recipients_to_save
|
8
8
|
t.string :subject
|
@@ -2,7 +2,7 @@
|
|
2
2
|
class CreateMessageTrainAttachments < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :message_train_attachments do |t|
|
5
|
-
t.references :
|
5
|
+
t.references :message_train_message, index: true, foreign_key: true
|
6
6
|
t.attachment :attachment
|
7
7
|
|
8
8
|
t.timestamps null: false
|
@@ -3,7 +3,7 @@ class CreateMessageTrainReceipts < ActiveRecord::Migration
|
|
3
3
|
def change
|
4
4
|
create_table :message_train_receipts do |t|
|
5
5
|
t.references :recipient, polymorphic: true
|
6
|
-
t.references :
|
6
|
+
t.references :message_train_message, index: true, foreign_key: true
|
7
7
|
t.boolean :marked_read, default: false
|
8
8
|
t.boolean :marked_trash, default: false
|
9
9
|
t.boolean :marked_deleted, default: false
|
@@ -3,7 +3,7 @@ class CreateMessageTrainIgnores < ActiveRecord::Migration
|
|
3
3
|
def change
|
4
4
|
create_table :message_train_ignores do |t|
|
5
5
|
t.references :participant, polymorphic: true
|
6
|
-
t.references :
|
6
|
+
t.references :message_train_conversation, index: true, foreign_key: true
|
7
7
|
|
8
8
|
t.timestamps null: false
|
9
9
|
end
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# This migration comes from message_train (originally 20151004184347)
|
2
2
|
class AddUniqueIndexToReceipts < ActiveRecord::Migration
|
3
3
|
def change
|
4
|
-
add_index :message_train_receipts, [:
|
4
|
+
add_index :message_train_receipts, [:message_train_message_id, :recipient_type, :recipient_id], name: :message_recipient, unique: true
|
5
5
|
end
|
6
6
|
end
|
@@ -10,6 +10,6 @@ class CreateMessageTrainUnsubscribes < ActiveRecord::Migration
|
|
10
10
|
|
11
11
|
add_index :message_train_unsubscribes, [:recipient_type, :recipient_id], name: :unsubscribe_recipient
|
12
12
|
add_index :message_train_unsubscribes, [:from_type, :from_id], name: :unsubscribe_from
|
13
|
-
add_index :message_train_unsubscribes, [:recipient_type, :recipient_id, :from_type, :from_id], name: :
|
13
|
+
add_index :message_train_unsubscribes, [:recipient_type, :recipient_id, :from_type, :from_id], name: :unsubscribe, unique: true
|
14
14
|
end
|
15
15
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160207190409) do
|
15
15
|
|
16
16
|
create_table "groups", force: :cascade do |t|
|
17
17
|
t.string "title"
|
@@ -22,16 +22,16 @@ ActiveRecord::Schema.define(version: 20151124001417) do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
create_table "message_train_attachments", force: :cascade do |t|
|
25
|
-
t.integer "
|
25
|
+
t.integer "message_train_message_id"
|
26
26
|
t.string "attachment_file_name"
|
27
27
|
t.string "attachment_content_type"
|
28
28
|
t.integer "attachment_file_size"
|
29
29
|
t.datetime "attachment_updated_at"
|
30
|
-
t.datetime "created_at",
|
31
|
-
t.datetime "updated_at",
|
30
|
+
t.datetime "created_at", null: false
|
31
|
+
t.datetime "updated_at", null: false
|
32
32
|
end
|
33
33
|
|
34
|
-
add_index "message_train_attachments", ["
|
34
|
+
add_index "message_train_attachments", ["message_train_message_id"], name: "index_message_train_attachments_on_message_train_message_id"
|
35
35
|
|
36
36
|
create_table "message_train_conversations", force: :cascade do |t|
|
37
37
|
t.string "subject"
|
@@ -42,45 +42,45 @@ ActiveRecord::Schema.define(version: 20151124001417) do
|
|
42
42
|
create_table "message_train_ignores", force: :cascade do |t|
|
43
43
|
t.integer "participant_id"
|
44
44
|
t.string "participant_type"
|
45
|
-
t.integer "
|
46
|
-
t.datetime "created_at",
|
47
|
-
t.datetime "updated_at",
|
45
|
+
t.integer "message_train_conversation_id"
|
46
|
+
t.datetime "created_at", null: false
|
47
|
+
t.datetime "updated_at", null: false
|
48
48
|
end
|
49
49
|
|
50
|
-
add_index "message_train_ignores", ["
|
50
|
+
add_index "message_train_ignores", ["message_train_conversation_id"], name: "index_message_train_ignores_on_message_train_conversation_id"
|
51
51
|
add_index "message_train_ignores", ["participant_type", "participant_id"], name: "participant_index"
|
52
52
|
|
53
53
|
create_table "message_train_messages", force: :cascade do |t|
|
54
|
-
t.integer "
|
54
|
+
t.integer "message_train_conversation_id"
|
55
55
|
t.integer "sender_id"
|
56
56
|
t.string "sender_type"
|
57
57
|
t.text "recipients_to_save"
|
58
58
|
t.string "subject"
|
59
59
|
t.text "body"
|
60
|
-
t.boolean "draft",
|
61
|
-
t.datetime "created_at",
|
62
|
-
t.datetime "updated_at",
|
60
|
+
t.boolean "draft", default: false
|
61
|
+
t.datetime "created_at", null: false
|
62
|
+
t.datetime "updated_at", null: false
|
63
63
|
end
|
64
64
|
|
65
|
-
add_index "message_train_messages", ["
|
65
|
+
add_index "message_train_messages", ["message_train_conversation_id"], name: "index_message_train_messages_on_message_train_conversation_id"
|
66
66
|
add_index "message_train_messages", ["sender_type", "sender_id"], name: "index_message_train_messages_on_sender_type_and_sender_id"
|
67
67
|
|
68
68
|
create_table "message_train_receipts", force: :cascade do |t|
|
69
69
|
t.integer "recipient_id"
|
70
70
|
t.string "recipient_type"
|
71
|
-
t.integer "
|
72
|
-
t.boolean "marked_read",
|
73
|
-
t.boolean "marked_trash",
|
74
|
-
t.boolean "marked_deleted",
|
75
|
-
t.boolean "sender",
|
76
|
-
t.datetime "created_at",
|
77
|
-
t.datetime "updated_at",
|
71
|
+
t.integer "message_train_message_id"
|
72
|
+
t.boolean "marked_read", default: false
|
73
|
+
t.boolean "marked_trash", default: false
|
74
|
+
t.boolean "marked_deleted", default: false
|
75
|
+
t.boolean "sender", default: false
|
76
|
+
t.datetime "created_at", null: false
|
77
|
+
t.datetime "updated_at", null: false
|
78
78
|
t.integer "received_through_id"
|
79
79
|
t.string "received_through_type"
|
80
80
|
end
|
81
81
|
|
82
|
-
add_index "message_train_receipts", ["
|
83
|
-
add_index "message_train_receipts", ["
|
82
|
+
add_index "message_train_receipts", ["message_train_message_id", "recipient_type", "recipient_id"], name: "message_recipient", unique: true
|
83
|
+
add_index "message_train_receipts", ["message_train_message_id"], name: "index_message_train_receipts_on_message_train_message_id"
|
84
84
|
add_index "message_train_receipts", ["received_through_type", "received_through_id"], name: "index_message_train_receipts_on_received_through"
|
85
85
|
add_index "message_train_receipts", ["recipient_type", "recipient_id"], name: "index_message_train_receipts_on_recipient"
|
86
86
|
|
@@ -94,7 +94,7 @@ ActiveRecord::Schema.define(version: 20151124001417) do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
add_index "message_train_unsubscribes", ["from_type", "from_id"], name: "unsubscribe_from"
|
97
|
-
add_index "message_train_unsubscribes", ["recipient_type", "recipient_id", "from_type", "from_id"], name: "
|
97
|
+
add_index "message_train_unsubscribes", ["recipient_type", "recipient_id", "from_type", "from_id"], name: "unsubscribe", unique: true
|
98
98
|
add_index "message_train_unsubscribes", ["recipient_type", "recipient_id"], name: "unsubscribe_recipient"
|
99
99
|
|
100
100
|
create_table "roles", force: :cascade do |t|
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/spec/features/boxes_spec.rb
CHANGED
@@ -17,7 +17,7 @@ RSpec.feature 'Boxes' do
|
|
17
17
|
visit '/box/in'
|
18
18
|
click_link 'Last'
|
19
19
|
end
|
20
|
-
it_behaves_like 'a bootstrap page listing a collection of items', MessageTrain::Conversation, plural_title: 'Inbox', minimum:
|
20
|
+
it_behaves_like 'a bootstrap page listing a collection of items', MessageTrain::Conversation, plural_title: 'Inbox', minimum: 1
|
21
21
|
|
22
22
|
describe 'does not list Roles dropdown' do
|
23
23
|
subject { page }
|
@@ -83,17 +83,18 @@ module MessageTrain
|
|
83
83
|
end
|
84
84
|
|
85
85
|
describe '#new_message' do
|
86
|
-
|
87
|
-
|
86
|
+
context 'when conversation is set' do
|
87
|
+
let(:expected_recipients) { { 'users' => 'second-user' } }
|
88
|
+
subject { user_in_box.new_message(message_train_conversation_id: unread_conversation.id) }
|
88
89
|
it { should be_a_new MessageTrain::Message }
|
90
|
+
its(:subject) { should eq 'Re: Unread Conversation' }
|
91
|
+
its(:recipients_to_save) { should eq expected_recipients }
|
89
92
|
end
|
90
|
-
|
91
|
-
|
92
|
-
subject { user_in_box.new_message(conversation_id: unread_conversation.id) }
|
93
|
+
context 'when conversation is not set' do
|
94
|
+
subject { user_in_box.new_message }
|
93
95
|
it { should be_a_new MessageTrain::Message }
|
94
|
-
its(:
|
95
|
-
its(:
|
96
|
-
its(:body) { should match /<blockquote>.*<\/blockquote>.*<p> <\/p>/ }
|
96
|
+
its(:subject) { should eq nil }
|
97
|
+
its(:recipients_to_save) { should be_empty }
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
@@ -376,22 +377,6 @@ module MessageTrain
|
|
376
377
|
end
|
377
378
|
end
|
378
379
|
|
379
|
-
describe '#new_message' do
|
380
|
-
context 'when conversation is set' do
|
381
|
-
let(:expected_recipients) { { 'users' => 'second-user' } }
|
382
|
-
subject { user_in_box.new_message(conversation_id: unread_conversation.id) }
|
383
|
-
it { should be_a_new MessageTrain::Message }
|
384
|
-
its(:subject) { should eq 'Re: Unread Conversation' }
|
385
|
-
its(:recipients_to_save) { should eq expected_recipients }
|
386
|
-
end
|
387
|
-
context 'when conversation is not set' do
|
388
|
-
subject { user_in_box.new_message }
|
389
|
-
it { should be_a_new MessageTrain::Message }
|
390
|
-
its(:subject) { should eq nil }
|
391
|
-
its(:recipients_to_save) { should be_empty }
|
392
|
-
end
|
393
|
-
end
|
394
|
-
|
395
380
|
describe '#authorize' do
|
396
381
|
describe 'given participant is the same as parent' do
|
397
382
|
describe 'when bad type' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: message_train
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karen Lundgren
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.2.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: paperclip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -597,14 +597,14 @@ files:
|
|
597
597
|
- spec/dummy/db/migrate/20150721141009_rolify_create_roles.rb
|
598
598
|
- spec/dummy/db/migrate/20150721141128_create_groups.rb
|
599
599
|
- spec/dummy/db/migrate/20150721150307_add_display_name_column_to_users.rb
|
600
|
-
- spec/dummy/db/migrate/
|
601
|
-
- spec/dummy/db/migrate/
|
602
|
-
- spec/dummy/db/migrate/
|
603
|
-
- spec/dummy/db/migrate/
|
604
|
-
- spec/dummy/db/migrate/
|
605
|
-
- spec/dummy/db/migrate/
|
606
|
-
- spec/dummy/db/migrate/
|
607
|
-
- spec/dummy/db/migrate/
|
600
|
+
- spec/dummy/db/migrate/20160207190402_create_message_train_conversations.message_train.rb
|
601
|
+
- spec/dummy/db/migrate/20160207190403_create_message_train_messages.message_train.rb
|
602
|
+
- spec/dummy/db/migrate/20160207190404_create_message_train_attachments.message_train.rb
|
603
|
+
- spec/dummy/db/migrate/20160207190405_create_message_train_receipts.message_train.rb
|
604
|
+
- spec/dummy/db/migrate/20160207190406_create_message_train_ignores.message_train.rb
|
605
|
+
- spec/dummy/db/migrate/20160207190407_add_received_through_to_message_train_receipts.message_train.rb
|
606
|
+
- spec/dummy/db/migrate/20160207190408_add_unique_index_to_receipts.message_train.rb
|
607
|
+
- spec/dummy/db/migrate/20160207190409_create_message_train_unsubscribes.message_train.rb
|
608
608
|
- spec/dummy/db/schema.rb
|
609
609
|
- spec/dummy/db/seeds.rb
|
610
610
|
- spec/dummy/db/seeds/conversations.seeds.rb
|