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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -7
  3. data/README.rdoc +4 -0
  4. data/VERSION +1 -1
  5. data/app/controllers/message_train/messages_controller.rb +1 -1
  6. data/app/models/message_train/attachment.rb +1 -1
  7. data/app/models/message_train/box.rb +2 -2
  8. data/app/models/message_train/conversation.rb +3 -3
  9. data/app/models/message_train/ignore.rb +1 -1
  10. data/app/models/message_train/message.rb +4 -4
  11. data/app/models/message_train/receipt.rb +2 -2
  12. data/app/views/message_train/messages/_message.html.haml +4 -4
  13. data/app/views/message_train/messages/new.html.haml +1 -1
  14. data/db/migrate/20150721160322_create_message_train_messages.rb +1 -1
  15. data/db/migrate/20150721161144_create_message_train_attachments.rb +1 -1
  16. data/db/migrate/20150721161940_create_message_train_receipts.rb +1 -1
  17. data/db/migrate/20150721163838_create_message_train_ignores.rb +1 -1
  18. data/db/migrate/20151004184347_add_unique_index_to_receipts.rb +1 -1
  19. data/message_train.gemspec +14 -14
  20. data/spec/controllers/message_train/messages_controller_spec.rb +1 -1
  21. data/spec/dummy/config/routes.rb +1 -0
  22. data/spec/dummy/db/migrate/{20150901183629_create_message_train_conversations.message_train.rb → 20160207190402_create_message_train_conversations.message_train.rb} +0 -0
  23. data/spec/dummy/db/migrate/{20150901183630_create_message_train_messages.message_train.rb → 20160207190403_create_message_train_messages.message_train.rb} +1 -1
  24. data/spec/dummy/db/migrate/{20150901183631_create_message_train_attachments.message_train.rb → 20160207190404_create_message_train_attachments.message_train.rb} +1 -1
  25. data/spec/dummy/db/migrate/{20150901183632_create_message_train_receipts.message_train.rb → 20160207190405_create_message_train_receipts.message_train.rb} +1 -1
  26. data/spec/dummy/db/migrate/{20150901183633_create_message_train_ignores.message_train.rb → 20160207190406_create_message_train_ignores.message_train.rb} +1 -1
  27. 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
  28. 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
  29. data/spec/dummy/db/migrate/{20151124001417_create_message_train_unsubscribes.message_train.rb → 20160207190409_create_message_train_unsubscribes.message_train.rb} +1 -1
  30. data/spec/dummy/db/schema.rb +24 -24
  31. data/spec/dummy/db/test.sqlite3 +0 -0
  32. data/spec/features/boxes_spec.rb +1 -1
  33. data/spec/models/message_train/box_spec.rb +9 -24
  34. metadata +12 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 712bc245d27104152fc3be51a4d599273f839b44
4
- data.tar.gz: 6decf2e25a128e08535900656121aece93e6f02f
3
+ metadata.gz: 6ca8f7374b6197d38499d0d1bac1ccfb13387fe4
4
+ data.tar.gz: 945d789ade7dbe77f94bddbbcfc10f7a06bc261d
5
5
  SHA512:
6
- metadata.gz: 9853cb01edcc15fe18103c15a66f4f008868a7e9143b395c6d41b1967b35950da5370a2b47783bee75e76b4ea3e3af41a84bb973f22212dd61e7928ed3ccfb5a
7
- data.tar.gz: c140454a9b30a82c4c37cf2a235b5110dac49aafe55f03e8a9159f243225b9a9311f99e9956683cb1001e5229c436734fecd815f641aa55aa63a2ba5a2355260
6
+ metadata.gz: 90ac0f49acf314026f290268f5ba503c3d1327e5b0630ffe230198c83ce4ac220ade58e21297da2c1ca3ee8ccdacca6101547e3d17cb8f744d725b7aa3ccbf01
7
+ data.tar.gz: 74f865f58d13e3616b61d4a39d79cd4dbc05aea4289db8650c90d980cac5bd2cf2d33db3b5269660c86e5cdb016569984ed29c82e4b37b01665077f4fe870797
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
- # gem "activesupport", ">= 2.3.5"
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 "sdoc", "~> 0.4.1"
27
- gem "bundler", "~> 1.0"
28
- gem "jeweler", "~> 2.0"
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 "launchy", "~> 2.1.2", require: false
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.3.1
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(conversation_id: params[:conversation_id])
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
@@ -1,6 +1,6 @@
1
1
  module MessageTrain
2
2
  class Attachment < ActiveRecord::Base
3
- belongs_to :message
3
+ belongs_to :message, foreign_key: :message_train_message_id
4
4
  has_attached_file :attachment, styles: lambda { |attachment|
5
5
  attachment.instance.image? ? {
6
6
  thumb: '235x',
@@ -60,10 +60,10 @@ module MessageTrain
60
60
  end
61
61
 
62
62
  def new_message(args = {})
63
- if args[:conversation_id].nil?
63
+ if args[:message_train_conversation_id].nil?
64
64
  message = MessageTrain::Message.new(args)
65
65
  else
66
- conversation = find_conversation(args[:conversation_id])
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(:conversation_id)
114
+ MessageTrain::Ignore.find_all_by_participant(participant).pluck(:message_train_conversation_id)
115
115
  end
116
116
  end
117
117
  end
@@ -1,7 +1,7 @@
1
1
  module MessageTrain
2
2
  class Ignore < ActiveRecord::Base
3
3
  belongs_to :participant, polymorphic: true
4
- belongs_to :conversation
4
+ belongs_to :conversation, foreign_key: :message_train_conversation_id
5
5
 
6
6
  validates_presence_of :conversation, :participant
7
7
 
@@ -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(:conversation_id)
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(:message_id)
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.conversation_id, objects: { 'messages' => {message.id.to_s => message.id.to_s} }) } }
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.conversation_id, objects: { 'messages' => {message.id.to_s => message.id.to_s} }) } }
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.conversation_id), class: 'btn btn-primary'
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.conversation_id), class: 'btn btn-primary'
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,4 +1,4 @@
1
- - if @message.conversation_id.nil?
1
+ - if @message.message_train_conversation_id.nil?
2
2
  - add_title :new_message.l
3
3
  - else
4
4
  - add_title :reply.l
@@ -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 :conversation, index: true, foreign_key: true
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 :message, index: true, foreign_key: true
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 :message, index: true, foreign_key: true
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 :conversation, index: true, foreign_key: true
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, [:message_id, :recipient_type, :recipient_id], name: :message_recipient, unique: true
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
@@ -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.3.1 ruby lib
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.3.1"
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-01-26"
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/20150901183629_create_message_train_conversations.message_train.rb",
209
- "spec/dummy/db/migrate/20150901183630_create_message_train_messages.message_train.rb",
210
- "spec/dummy/db/migrate/20150901183631_create_message_train_attachments.message_train.rb",
211
- "spec/dummy/db/migrate/20150901183632_create_message_train_receipts.message_train.rb",
212
- "spec/dummy/db/migrate/20150901183633_create_message_train_ignores.message_train.rb",
213
- "spec/dummy/db/migrate/20150901183634_add_received_through_to_message_train_receipts.message_train.rb",
214
- "spec/dummy/db/migrate/20151004184519_add_unique_index_to_receipts.message_train.rb",
215
- "spec/dummy/db/migrate/20151124001417_create_message_train_unsubscribes.message_train.rb",
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.conversation_id
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
 
@@ -1,5 +1,6 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
+
3
4
  mount MessageTrain::Engine => '/', :as => 'message_train'
4
5
  devise_for :users
5
6
  end
@@ -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 :conversation, index: true, foreign_key: true
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 :message, index: true, foreign_key: true
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 :message, index: true, foreign_key: true
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 :conversation, index: true, foreign_key: true
6
+ t.references :message_train_conversation, index: true, foreign_key: true
7
7
 
8
8
  t.timestamps null: false
9
9
  end
@@ -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, [:message_id, :recipient_type, :recipient_id], name: :message_recipient, unique: true
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: :unsubscribes, unique: true
13
+ add_index :message_train_unsubscribes, [:recipient_type, :recipient_id, :from_type, :from_id], name: :unsubscribe, unique: true
14
14
  end
15
15
  end
@@ -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: 20151124001417) do
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 "message_id"
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", null: false
31
- t.datetime "updated_at", null: false
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", ["message_id"], name: "index_message_train_attachments_on_message_id"
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 "conversation_id"
46
- t.datetime "created_at", null: false
47
- t.datetime "updated_at", null: false
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", ["conversation_id"], name: "index_message_train_ignores_on_conversation_id"
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 "conversation_id"
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", default: false
61
- t.datetime "created_at", null: false
62
- t.datetime "updated_at", null: false
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", ["conversation_id"], name: "index_message_train_messages_on_conversation_id"
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 "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
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", ["message_id", "recipient_type", "recipient_id"], name: "message_recipient", unique: true
83
- add_index "message_train_receipts", ["message_id"], name: "index_message_train_receipts_on_message_id"
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: "unsubscribes", unique: true
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|
Binary file
@@ -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: 2
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
- describe 'when no conversation id is set' do
87
- subject { user_in_box.new_message }
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
- describe 'when a conversation id is set' do
91
- let(:user_hash) { { 'users' => 'second-user' } }
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(:recipients_to_save) { should eq user_hash }
95
- its(:subject) { should eq 'Re: Unread Conversation' }
96
- its(:body) { should match /<blockquote>.*<\/blockquote>.*<p>&nbsp;<\/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.3.1
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-01-26 00:00:00.000000000 Z
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: '4'
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: '4'
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/20150901183629_create_message_train_conversations.message_train.rb
601
- - spec/dummy/db/migrate/20150901183630_create_message_train_messages.message_train.rb
602
- - spec/dummy/db/migrate/20150901183631_create_message_train_attachments.message_train.rb
603
- - spec/dummy/db/migrate/20150901183632_create_message_train_receipts.message_train.rb
604
- - spec/dummy/db/migrate/20150901183633_create_message_train_ignores.message_train.rb
605
- - spec/dummy/db/migrate/20150901183634_add_received_through_to_message_train_receipts.message_train.rb
606
- - spec/dummy/db/migrate/20151004184519_add_unique_index_to_receipts.message_train.rb
607
- - spec/dummy/db/migrate/20151124001417_create_message_train_unsubscribes.message_train.rb
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