message_train 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -0
- data/.ruby-gemset +1 -1
- data/.scss-lint.yml +7 -0
- data/.simplecov +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +6 -2
- data/LICENSE.txt +2 -2
- data/README.rdoc +5 -5
- data/Rakefile +22 -21
- data/VERSION +1 -1
- data/app/assets/javascripts/message_train.js +1 -1
- data/app/assets/stylesheets/message_train.scss +29 -19
- data/app/controllers/concerns/message_train_support.rb +41 -37
- data/app/controllers/message_train/application_controller.rb +1 -0
- data/app/controllers/message_train/boxes_controller.rb +5 -4
- data/app/controllers/message_train/conversations_controller.rb +8 -7
- data/app/controllers/message_train/messages_controller.rb +25 -22
- data/app/controllers/message_train/participants_controller.rb +27 -23
- data/app/controllers/message_train/unsubscribes_controller.rb +37 -23
- data/app/helpers/message_train/application_helper.rb +6 -8
- data/app/helpers/message_train/attachments_helper.rb +12 -4
- data/app/helpers/message_train/boxes_helper.rb +38 -11
- data/app/helpers/message_train/collectives_helper.rb +38 -12
- data/app/helpers/message_train/conversations_helper.rb +43 -35
- data/app/helpers/message_train/messages_helper.rb +32 -25
- data/app/mailers/message_train/application_mailer.rb +7 -4
- data/app/mailers/message_train/previews/receipt_mailer_preview.rb +2 -3
- data/app/mailers/message_train/receipt_mailer.rb +14 -4
- data/app/models/message_train/attachment.rb +41 -25
- data/app/models/message_train/box.rb +159 -122
- data/app/models/message_train/conversation.rb +84 -41
- data/app/models/message_train/ignore.rb +8 -2
- data/app/models/message_train/message.rb +72 -42
- data/app/models/message_train/receipt.rb +30 -17
- data/app/models/message_train/unsubscribe.rb +1 -0
- data/app/views/application/404.html.haml +1 -1
- data/app/views/layouts/mailer.html.haml +2 -2
- data/app/views/layouts/mailer.text.haml +1 -1
- data/app/views/message_train/application/_attachment_fields.html.haml +1 -1
- data/app/views/message_train/application/_widget.html.haml +1 -1
- data/app/views/message_train/application/results.json.jbuilder +1 -1
- data/app/views/message_train/boxes/_dropdown_list.html.haml +1 -1
- data/app/views/message_train/boxes/_list_item.html.haml +1 -1
- data/app/views/message_train/boxes/show.html.haml +1 -1
- data/app/views/message_train/collectives/_dropdown_list.html.haml +1 -1
- data/app/views/message_train/collectives/_list_item.html.haml +1 -1
- data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_ignored_toggle.html.haml +2 -2
- data/app/views/message_train/conversations/_read_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_trashed_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/show.html.haml +2 -2
- data/app/views/message_train/conversations/show.json.jbuilder +5 -1
- data/app/views/message_train/messages/_form.html.haml +1 -1
- data/app/views/message_train/messages/_message.html.haml +6 -6
- data/app/views/message_train/messages/_toggle.html.haml +1 -1
- data/app/views/message_train/messages/show.json.jbuilder +5 -1
- data/app/views/message_train/participants/_participant.json.jbuilder +1 -1
- data/app/views/message_train/participants/index.json.jbuilder +1 -1
- data/app/views/message_train/participants/show.json.jbuilder +1 -1
- data/app/views/message_train/receipt_mailer/notification_email.html.haml +1 -1
- data/app/views/message_train/receipt_mailer/notification_email.text.haml +1 -1
- data/app/views/message_train/unsubscribes/index.html.haml +1 -1
- data/config/environment.rb +1 -1
- data/config/initializers/date_time.rb +2 -2
- data/config/locales/en.yml +1 -1
- data/config/routes.rb +37 -15
- data/lib/generators/message_train/install/install_generator.rb +26 -11
- data/lib/generators/message_train/install/templates/initializer.rb +0 -2
- data/lib/generators/message_train/utils.rb +11 -4
- data/lib/message_train/configuration.rb +4 -5
- data/lib/message_train/engine.rb +1 -7
- data/lib/message_train/localization.rb +14 -18
- data/lib/message_train/mixin.rb +211 -150
- data/lib/message_train/version.rb +1 -0
- data/lib/message_train.rb +7 -6
- data/message_train.gemspec +24 -11
- data/spec/controllers/message_train/boxes_controller_spec.rb +63 -15
- data/spec/controllers/message_train/concerns_spec.rb +17 -13
- data/spec/controllers/message_train/conversations_controller_spec.rb +44 -12
- data/spec/controllers/message_train/messages_controller_spec.rb +87 -40
- data/spec/controllers/message_train/participants_controller_spec.rb +10 -4
- data/spec/controllers/message_train/unsubscribes_controller_spec.rb +43 -13
- data/spec/dummy/Rakefile +2 -1
- data/spec/dummy/app/assets/stylesheets/application.css.scss +7 -23
- data/spec/dummy/app/controllers/application_controller.rb +7 -7
- data/spec/dummy/app/models/group.rb +1 -1
- data/spec/dummy/app/models/role.rb +11 -7
- data/spec/dummy/app/models/user.rb +6 -5
- data/spec/dummy/app/views/layouts/_top_navigation.html.haml +1 -1
- data/spec/dummy/app/views/layouts/application.html.haml +1 -1
- data/spec/dummy/app/views/pages/index.html.haml +1 -1
- data/spec/dummy/config/application.rb +23 -17
- data/spec/dummy/config/environments/development.rb +5 -4
- data/spec/dummy/config/environments/production.rb +10 -6
- data/spec/dummy/config/environments/test.rb +4 -3
- data/spec/dummy/config/initializers/assets.rb +2 -1
- data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -2
- data/spec/dummy/config/initializers/bootstrap_leather.rb +1 -1
- data/spec/dummy/config/initializers/devise.rb +63 -44
- data/spec/dummy/config/initializers/high_voltage.rb +1 -1
- data/spec/dummy/config/initializers/message_train.rb +5 -2
- data/spec/dummy/config/initializers/mime_types.rb +1 -1
- data/spec/dummy/config/initializers/paperclip.rb +5 -2
- data/spec/dummy/config/initializers/rolify.rb +3 -2
- data/spec/dummy/config/initializers/wrap_parameters.rb +2 -1
- data/spec/dummy/config/routes.rb +1 -3
- data/spec/dummy/config/settings.yml +1 -1
- data/spec/dummy/db/schema.rb +98 -98
- data/spec/dummy/db/seeds/conversations.seeds.rb +160 -160
- data/spec/dummy/db/seeds/development/conversations.seeds.rb +6 -2
- data/spec/dummy/db/seeds/groups.seeds.rb +11 -12
- data/spec/dummy/db/seeds/test/attachments.seeds.rb +13 -3
- data/spec/dummy/db/seeds/test/conversations.seeds.rb +6 -2
- data/spec/dummy/db/seeds/unsubscribes.seeds.rb +1 -1
- data/spec/dummy/db/seeds/users.seeds.rb +47 -42
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/attachment.rb +6 -2
- data/spec/factories/group.rb +1 -4
- data/spec/factories/message.rb +29 -23
- data/spec/factories/user.rb +6 -4
- data/spec/features/boxes_spec.rb +76 -24
- data/spec/features/conversations_spec.rb +19 -7
- data/spec/features/messages_spec.rb +24 -5
- data/spec/features/unsubscribes_spec.rb +36 -9
- data/spec/helpers/message_train/application_helper_spec.rb +1 -1
- data/spec/helpers/message_train/attachment_helper_spec.rb +27 -12
- data/spec/helpers/message_train/boxes_helper_spec.rb +1 -1
- data/spec/helpers/message_train/collectives_helper_spec.rb +25 -9
- data/spec/helpers/message_train/conversations_helper_spec.rb +239 -120
- data/spec/helpers/message_train/messages_helper_spec.rb +137 -81
- data/spec/message_train_spec.rb +3 -2
- data/spec/models/group_spec.rb +12 -9
- data/spec/models/message_train/attachment_spec.rb +33 -30
- data/spec/models/message_train/box_spec.rb +243 -60
- data/spec/models/message_train/conversation_spec.rb +16 -12
- data/spec/models/message_train/ignore_spec.rb +3 -1
- data/spec/models/message_train/message_spec.rb +22 -7
- data/spec/models/message_train/receipt_spec.rb +14 -4
- data/spec/models/role_spec.rb +10 -6
- data/spec/models/user_spec.rb +74 -22
- data/spec/rails_helper.rb +9 -4
- data/spec/spec_helper.rb +6 -54
- data/spec/support/controller_behaviors.rb +8 -5
- data/spec/support/controller_macros.rb +2 -2
- data/spec/support/factory_girl.rb +1 -1
- data/spec/support/feature_behaviors.rb +42 -13
- data/spec/support/loaded_site/attachments.rb +8 -0
- data/spec/support/loaded_site/conversations.rb +73 -0
- data/spec/support/{groups.rb → loaded_site/groups.rb} +1 -1
- data/spec/support/{loaded_site.rb → loaded_site/loaded_site.rb} +1 -1
- data/spec/support/{messages.rb → loaded_site/messages.rb} +13 -5
- data/spec/support/{roles.rb → loaded_site/roles.rb} +1 -1
- data/spec/support/{users.rb → loaded_site/users.rb} +1 -1
- data/spec/support/shared_connection.rb +8 -6
- data/spec/support/utilities.rb +10 -10
- metadata +67 -10
- data/spec/dummy/config/unused/temporary_i18n_debugging.rb +0 -12
- data/spec/support/attachments.rb +0 -4
- data/spec/support/conversations.rb +0 -23
@@ -1,14 +1,20 @@
|
|
1
1
|
module MessageTrain
|
2
|
+
# Ignore model
|
2
3
|
class Ignore < ActiveRecord::Base
|
3
4
|
belongs_to :participant, polymorphic: true
|
4
5
|
belongs_to :conversation, foreign_key: :message_train_conversation_id
|
5
6
|
|
6
7
|
validates_presence_of :conversation, :participant
|
7
8
|
|
8
|
-
scope :find_all_by_participant,
|
9
|
+
scope :find_all_by_participant, (lambda do |participant|
|
10
|
+
where(participant: participant)
|
11
|
+
end)
|
9
12
|
|
10
13
|
def self.conversations
|
11
|
-
MessageTrain::Conversation.joins(:ignores)
|
14
|
+
MessageTrain::Conversation.joins(:ignores)
|
15
|
+
.where(
|
16
|
+
message_train_ignores: { id: where(nil) }
|
17
|
+
)
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module MessageTrain
|
2
|
+
# Message model
|
2
3
|
class Message < ActiveRecord::Base
|
3
4
|
# Serializations
|
4
5
|
serialize :recipients_to_save, Hash
|
@@ -19,7 +20,11 @@ module MessageTrain
|
|
19
20
|
after_save :set_conversation_subject_if_alone
|
20
21
|
|
21
22
|
# Nested Attributes
|
22
|
-
accepts_nested_attributes_for
|
23
|
+
accepts_nested_attributes_for(
|
24
|
+
:attachments,
|
25
|
+
reject_if: :all_blank,
|
26
|
+
allow_destroy: true
|
27
|
+
)
|
23
28
|
|
24
29
|
# Scopes
|
25
30
|
default_scope { order(updated_at: :desc) }
|
@@ -27,12 +32,15 @@ module MessageTrain
|
|
27
32
|
scope :drafts, -> { where(draft: true) }
|
28
33
|
scope :by, ->(participant) { where(sender: participant) }
|
29
34
|
scope :drafts_by, ->(participant) { drafts.by(participant) }
|
35
|
+
scope :filter_by_receipt_method, (lambda do |receipt_method, participant|
|
36
|
+
where(
|
37
|
+
id: where(nil).receipts.send(receipt_method, participant).message_ids
|
38
|
+
)
|
39
|
+
end)
|
30
40
|
|
31
41
|
def mark(mark_to_set, participant)
|
32
42
|
receipt_to_mark = receipts.for(participant).first
|
33
|
-
|
34
|
-
receipt_to_mark.mark(mark_to_set)
|
35
|
-
end
|
43
|
+
receipt_to_mark.present? && receipt_to_mark.mark(mark_to_set)
|
36
44
|
end
|
37
45
|
|
38
46
|
def self.mark(mark_to_set, participant)
|
@@ -54,37 +62,45 @@ module MessageTrain
|
|
54
62
|
end
|
55
63
|
|
56
64
|
def self.receipts
|
57
|
-
MessageTrain::Receipt.joins(:message)
|
65
|
+
MessageTrain::Receipt.joins(:message)
|
66
|
+
.where(message_train_messages: { id: where(nil) })
|
58
67
|
end
|
59
68
|
|
60
69
|
def self.conversations
|
61
|
-
MessageTrain::Conversation.joins(:messages)
|
70
|
+
MessageTrain::Conversation.joins(:messages)
|
71
|
+
.where(
|
72
|
+
message_train_messages: { id: where(nil) }
|
73
|
+
)
|
62
74
|
end
|
63
75
|
|
64
76
|
def method_missing(method_sym, *arguments, &block)
|
65
|
-
# the first argument is a Symbol, so you need to_s it if you want to
|
77
|
+
# the first argument is a Symbol, so you need to_s it if you want to
|
78
|
+
# pattern match
|
66
79
|
if method_sym.to_s =~ /^is_((.*)_(by|to|for|through))\?$/
|
67
|
-
!receipts.send(
|
80
|
+
!receipts.send(Regexp.last_match[1].to_sym, arguments.first).empty?
|
68
81
|
elsif method_sym.to_s =~ /^mark_(.*)_for$/
|
69
|
-
receipts.for(arguments.first).first.mark(
|
82
|
+
receipts.for(arguments.first).first.mark(Regexp.last_match[1].to_sym)
|
70
83
|
else
|
71
84
|
super
|
72
85
|
end
|
73
86
|
end
|
74
87
|
|
75
88
|
def self.method_missing(method_sym, *arguments, &block)
|
76
|
-
# the first argument is a Symbol, so you need to_s it if you want to
|
89
|
+
# the first argument is a Symbol, so you need to_s it if you want to
|
90
|
+
# pattern match
|
77
91
|
if method_sym.to_s =~ /^with_(.*_(by|to|for|through))$/
|
78
|
-
filter_by_receipt_method(
|
92
|
+
filter_by_receipt_method(Regexp.last_match[1].to_sym, arguments.first)
|
79
93
|
else
|
80
94
|
super
|
81
95
|
end
|
82
96
|
end
|
83
97
|
|
84
|
-
# It's important to know Object defines respond_to to take two parameters:
|
98
|
+
# It's important to know Object defines respond_to to take two parameters:
|
99
|
+
# the method to check, and whether to include private methods
|
85
100
|
# http://www.ruby-doc.org/core/classes/Object.html#M000333
|
86
101
|
def respond_to?(method_sym, include_private = false)
|
87
|
-
if method_sym.to_s =~ /^is_.*_(by|to|for|through)\?$/ ||
|
102
|
+
if method_sym.to_s =~ /^is_.*_(by|to|for|through)\?$/ ||
|
103
|
+
method_sym.to_s =~ /^mark_.*_for\?$/
|
88
104
|
true
|
89
105
|
else
|
90
106
|
super
|
@@ -99,11 +115,7 @@ module MessageTrain
|
|
99
115
|
end
|
100
116
|
end
|
101
117
|
|
102
|
-
|
103
|
-
|
104
|
-
scope :filter_by_receipt_method, ->(receipt_method, participant) {
|
105
|
-
where(id: where(nil).receipts.send(receipt_method, participant).message_ids)
|
106
|
-
}
|
118
|
+
private
|
107
119
|
|
108
120
|
def create_conversation_if_blank
|
109
121
|
if conversation.nil?
|
@@ -112,35 +124,20 @@ module MessageTrain
|
|
112
124
|
end
|
113
125
|
|
114
126
|
def generate_sender_receipt
|
115
|
-
receipts.first_or_create!(
|
127
|
+
receipts.first_or_create!(
|
128
|
+
recipient: sender,
|
129
|
+
received_through: sender,
|
130
|
+
sender: true
|
131
|
+
)
|
116
132
|
end
|
117
133
|
|
118
134
|
def generate_receipts_or_set_draft
|
119
135
|
unless draft
|
120
136
|
recipients_to_save.each do |table, slugs|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
slug = slug.strip
|
126
|
-
slug_column = MessageTrain.configuration.slug_columns[table.to_sym] || :slug
|
127
|
-
if model.exists?(slug_column => slug)
|
128
|
-
recipient = model.find_by(slug_column => slug)
|
129
|
-
end_recipient_method = MessageTrain.configuration.valid_recipients_methods[table.to_sym]
|
130
|
-
if end_recipient_method.nil?
|
131
|
-
unless conversation.is_ignored?(recipient)
|
132
|
-
receipts.create!(recipient: recipient, received_through: recipient)
|
133
|
-
end
|
134
|
-
else
|
135
|
-
recipient.send(end_recipient_method).uniq.each do |end_recipient|
|
136
|
-
unless conversation.is_ignored?(end_recipient) || end_recipient == sender
|
137
|
-
receipts.create!(recipient: end_recipient, received_through: recipient)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
else
|
142
|
-
errors.add :recipients_to_save, :name_not_found.l(name: slug)
|
143
|
-
end
|
137
|
+
slugs = slugs.split(',')
|
138
|
+
sender.class.table_name == table && (slugs -= [sender.slug])
|
139
|
+
slugs.each do |slug|
|
140
|
+
send_receipts(table, slug)
|
144
141
|
end
|
145
142
|
end
|
146
143
|
reload
|
@@ -158,5 +155,38 @@ module MessageTrain
|
|
158
155
|
end
|
159
156
|
end
|
160
157
|
|
158
|
+
def send_receipts(table, slug)
|
159
|
+
model_name = table.classify
|
160
|
+
model = model_name.constantize
|
161
|
+
slug = slug.strip
|
162
|
+
slug_column = MessageTrain.configuration
|
163
|
+
.slug_columns[table.to_sym] || :slug
|
164
|
+
if model.exists?(slug_column => slug)
|
165
|
+
recipient = model.find_by(slug_column => slug)
|
166
|
+
end_recipient_method = MessageTrain.configuration
|
167
|
+
.valid_recipients_methods[
|
168
|
+
table.to_sym
|
169
|
+
]
|
170
|
+
if end_recipient_method.nil?
|
171
|
+
unless conversation.participant_ignored?(recipient)
|
172
|
+
receipts.create!(
|
173
|
+
recipient: recipient,
|
174
|
+
received_through: recipient
|
175
|
+
)
|
176
|
+
end
|
177
|
+
else
|
178
|
+
recipient.send(end_recipient_method).uniq.each do |end_recipient|
|
179
|
+
next if conversation.participant_ignored?(end_recipient) ||
|
180
|
+
end_recipient == sender
|
181
|
+
receipts.create!(
|
182
|
+
recipient: end_recipient,
|
183
|
+
received_through: recipient
|
184
|
+
)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
else
|
188
|
+
errors.add :recipients_to_save, :name_not_found.l(name: slug)
|
189
|
+
end
|
190
|
+
end
|
161
191
|
end
|
162
192
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module MessageTrain
|
2
|
+
# Receipt model
|
2
3
|
class Receipt < ActiveRecord::Base
|
3
4
|
belongs_to :recipient, polymorphic: true
|
4
5
|
belongs_to :received_through, polymorphic: true
|
@@ -6,15 +7,19 @@ module MessageTrain
|
|
6
7
|
validates_presence_of :recipient, :message
|
7
8
|
|
8
9
|
default_scope { order(updated_at: :desc) }
|
9
|
-
scope :sender_receipt, -> { where(
|
10
|
-
scope :recipient_receipt, -> { where(
|
10
|
+
scope :sender_receipt, -> { where(sender: true) }
|
11
|
+
scope :recipient_receipt, -> { where(sender: false) }
|
11
12
|
scope :by, ->(sender) { sender_receipt.for(sender) }
|
12
|
-
scope :for,
|
13
|
+
scope :for, (lambda do |recipient|
|
14
|
+
where(recipient: recipient)
|
15
|
+
end)
|
13
16
|
scope :to, ->(recipient) { recipient_receipt.for(recipient) }
|
14
|
-
scope :through,
|
15
|
-
|
16
|
-
|
17
|
-
scope :
|
17
|
+
scope :through, (lambda do |received_through|
|
18
|
+
where(received_through: received_through)
|
19
|
+
end)
|
20
|
+
scope :trashed, ->(setting = true) { where(marked_trash: setting) }
|
21
|
+
scope :read, ->(setting = true) { where(marked_read: setting) }
|
22
|
+
scope :deleted, ->(setting = true) { where(marked_deleted: setting) }
|
18
23
|
|
19
24
|
after_create :notify
|
20
25
|
|
@@ -35,7 +40,8 @@ module MessageTrain
|
|
35
40
|
end
|
36
41
|
|
37
42
|
def self.messages
|
38
|
-
MessageTrain::Message.joins(:receipts)
|
43
|
+
MessageTrain::Message.joins(:receipts)
|
44
|
+
.where(message_train_receipts: { id: where(nil) })
|
39
45
|
end
|
40
46
|
|
41
47
|
def self.conversation_ids
|
@@ -43,36 +49,43 @@ module MessageTrain
|
|
43
49
|
end
|
44
50
|
|
45
51
|
def self.conversations
|
46
|
-
MessageTrain::Conversation.joins(:receipts)
|
52
|
+
MessageTrain::Conversation.joins(:receipts)
|
53
|
+
.where(
|
54
|
+
message_train_receipts: { id: where(nil) }
|
55
|
+
)
|
47
56
|
end
|
48
57
|
|
49
58
|
def self.method_missing(method_sym, *arguments, &block)
|
50
|
-
# the first argument is a Symbol, so you need to_s it if you want to
|
59
|
+
# the first argument is a Symbol, so you need to_s it if you want to
|
60
|
+
# pattern match
|
51
61
|
if method_sym.to_s =~ /^receipts_(by|to|for|through)$/
|
52
|
-
send(
|
62
|
+
send(Regexp.last_match[1].to_sym, arguments.first)
|
53
63
|
elsif method_sym.to_s =~ /^(.*)_(by|to|for|through)$/
|
54
|
-
send(
|
64
|
+
send(Regexp.last_match[1].to_sym)
|
65
|
+
.send(Regexp.last_match[2].to_sym, arguments.first)
|
55
66
|
elsif method_sym.to_s =~ /^un(.*)$/
|
56
|
-
send(
|
67
|
+
send(Regexp.last_match[1].to_sym, false)
|
57
68
|
else
|
58
69
|
super
|
59
70
|
end
|
60
71
|
end
|
61
72
|
|
62
|
-
# It's important to know Object defines respond_to to take two parameters:
|
73
|
+
# It's important to know Object defines respond_to to take two parameters:
|
74
|
+
# the method to check, and whether to include private methods
|
63
75
|
# http://www.ruby-doc.org/core/classes/Object.html#M000333
|
64
76
|
def self.respond_to?(method_sym, include_private = false)
|
65
|
-
if method_sym.to_s =~ /^(.*)_(by|to|for|through)$/ ||
|
77
|
+
if method_sym.to_s =~ /^(.*)_(by|to|for|through)$/ ||
|
78
|
+
method_sym.to_s =~ /^un(.*)$/
|
66
79
|
true
|
67
80
|
else
|
68
81
|
super
|
69
82
|
end
|
70
83
|
end
|
71
84
|
|
72
|
-
|
85
|
+
private
|
73
86
|
|
74
87
|
def notify
|
75
|
-
unless sender?
|
88
|
+
unless sender? || recipient.unsubscribed_from?(received_through)
|
76
89
|
ReceiptMailer.notification_email(self).deliver_later
|
77
90
|
end
|
78
91
|
end
|
@@ -1 +1 @@
|
|
1
|
-
= yield
|
1
|
+
= yield
|
@@ -1 +1 @@
|
|
1
|
-
= conversation_toggle conversation, 'remove', :deleted, :put, :mark_as_name.l(name: :deleted.l), data: { confirm: :delete_forever_this_cannot_be_undone.l }, collective: collective
|
1
|
+
= conversation_toggle conversation, 'remove', :deleted, :put, :mark_as_name.l(name: :deleted.l), data: { confirm: :delete_forever_this_cannot_be_undone.l }, collective: collective
|
@@ -1,4 +1,4 @@
|
|
1
|
-
- if conversation.
|
1
|
+
- if conversation.participant_ignored?(@box_user)
|
2
2
|
= conversation_toggle conversation, 'volume-up', :unignore, :delete, :mark_as_name.l(name: :unignored.l), collective: collective
|
3
3
|
- else
|
4
|
-
= conversation_toggle conversation, 'volume-off', :ignore, :delete, :mark_as_name.l(name: :ignored.l), data: { confirm: :are_you_sure.l}, collective: collective
|
4
|
+
= conversation_toggle conversation, 'volume-off', :ignore, :delete, :mark_as_name.l(name: :ignored.l), data: { confirm: :are_you_sure.l}, collective: collective
|
@@ -1,4 +1,4 @@
|
|
1
1
|
- if conversation.includes_unread_for?(@box_user)
|
2
2
|
= conversation_toggle conversation, 'eye-open', :read, :put, :mark_as_name.l(name: :read.l), collective: collective
|
3
3
|
- else
|
4
|
-
= conversation_toggle conversation, 'eye-close', :unread, :put, :mark_as_name.l(name: :unread.l), collective: collective
|
4
|
+
= conversation_toggle conversation, 'eye-close', :unread, :put, :mark_as_name.l(name: :unread.l), collective: collective
|
@@ -1,4 +1,4 @@
|
|
1
1
|
- if options[:collective].nil?
|
2
2
|
= icon_link_to icon, '', message_train.box_path(@box.division, objects: { 'conversations' => {conversation.id.to_s => conversation.id.to_s}}, mark_to_set: mark_to_set, format: :json), options
|
3
3
|
- else
|
4
|
-
= icon_link_to icon, '', message_train.collective_box_path(options[:collective].path_part, @box.division, objects: { 'conversations' => {conversation.id.to_s => conversation.id.to_s}}, mark_to_set: mark_to_set, format: :json), options
|
4
|
+
= icon_link_to icon, '', message_train.collective_box_path(options[:collective].path_part, @box.division, objects: { 'conversations' => {conversation.id.to_s => conversation.id.to_s}}, mark_to_set: mark_to_set, format: :json), options
|
@@ -1,4 +1,4 @@
|
|
1
1
|
- if conversation.includes_untrashed_for?(@box_user)
|
2
2
|
= conversation_toggle conversation, 'trash', :trash, :put, :mark_as_name.l(name: :trashed.l), data: { confirm: :are_you_sure.l}, collective: collective
|
3
3
|
- else
|
4
|
-
= conversation_toggle conversation, 'inbox', :untrash, :put, :mark_as_name.l(name: :untrashed.l), collective: collective
|
4
|
+
= conversation_toggle conversation, 'inbox', :untrash, :put, :mark_as_name.l(name: :untrashed.l), collective: collective
|
@@ -5,8 +5,8 @@
|
|
5
5
|
.btn.btn-default.btn-lg= conversation_ignored_toggle(@conversation)
|
6
6
|
#message_train_conversation.clear-both
|
7
7
|
- unless @messages.empty?
|
8
|
-
#message_train_messages.messages.panel-group{aria: { multiselectable: 'true' }, role:
|
8
|
+
#message_train_messages.messages.panel-group{aria: { multiselectable: 'true' }, role: 'tablist'}
|
9
9
|
= render @messages
|
10
10
|
= paginate @messages
|
11
11
|
= modal 'attachment_preview', :attachment_preview.l do
|
12
|
-
#image_placeholder
|
12
|
+
#image_placeholder
|
@@ -8,7 +8,7 @@
|
|
8
8
|
= g.text_field :users, label: :recipients.l, class: 'recipient-input'
|
9
9
|
- add_footer_javascript do
|
10
10
|
:javascript
|
11
|
-
url =
|
11
|
+
url = '/box/in/participants/users.json'
|
12
12
|
var suggestions = new Bloodhound({
|
13
13
|
prefetch: url,
|
14
14
|
remote: {
|
@@ -1,33 +1,33 @@
|
|
1
1
|
- if message.draft
|
2
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
|
-
.panel-heading{role:
|
3
|
+
.panel-heading{role: 'tab', id: "message_#{message.id}_heading"}
|
4
4
|
.message-actions.pull-right
|
5
5
|
= message_read_toggle message
|
6
6
|
= message_trashed_toggle message
|
7
7
|
- if @box.division == :trash
|
8
8
|
= message_deleted_toggle message
|
9
9
|
%h4.panel-title
|
10
|
-
= link_to "#message_#{message.id}_collapse", aria: { controls: "message_#{message.id}_collapse", expanded: 'true' }, data: { parent: '#accordion', toggle: 'collapse' }, role:
|
10
|
+
= link_to "#message_#{message.id}_collapse", aria: { controls: "message_#{message.id}_collapse", expanded: 'true' }, data: { parent: '#accordion', toggle: 'collapse' }, role: 'button' do
|
11
11
|
%span.caret
|
12
12
|
= :message_draft.l
|
13
13
|
%small= message.updated_at
|
14
|
-
.panel-collapse.collapse.in{aria: { labelledby: "message_#{message.id}_heading" }, role:
|
14
|
+
.panel-collapse.collapse.in{aria: { labelledby: "message_#{message.id}_heading" }, role: 'tabpanel', id: "message_#{message.id}_collapse"}
|
15
15
|
.panel-body
|
16
16
|
= render partial: 'message_train/messages/form', locals: { message: message }
|
17
17
|
- else
|
18
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
|
-
.panel-heading{role:
|
19
|
+
.panel-heading{role: 'tab', id: "message_#{message.id}_heading"}
|
20
20
|
.message-actions.pull-right
|
21
21
|
= message_read_toggle message
|
22
22
|
= message_trashed_toggle message
|
23
23
|
- if @box.division == :trash
|
24
24
|
= message_deleted_toggle message
|
25
25
|
%h4.panel-title
|
26
|
-
= link_to "#message_#{message.id}_collapse", aria: { controls: "message_#{message.id}_collapse", expanded: 'true' }, data: { parent: '#accordion', toggle: 'collapse' }, role:
|
26
|
+
= link_to "#message_#{message.id}_collapse", aria: { controls: "message_#{message.id}_collapse", expanded: 'true' }, data: { parent: '#accordion', toggle: 'collapse' }, role: 'button' do
|
27
27
|
%span.caret
|
28
28
|
= :from_sender.l(sender: message.sender.display_name)
|
29
29
|
%small= message.updated_at
|
30
|
-
.panel-collapse.collapse.in{aria: { labelledby: "message_#{message.id}_heading" }, role:
|
30
|
+
.panel-collapse.collapse.in{aria: { labelledby: "message_#{message.id}_heading" }, role: 'tabpanel', id: "message_#{message.id}_collapse"}
|
31
31
|
.panel-body
|
32
32
|
%p= :to_recipient.l(recipient: message_recipients(message))
|
33
33
|
%p.lead= message.subject
|
@@ -1 +1 @@
|
|
1
|
-
= icon_link_to icon, '', message_train.box_path(@box.division, objects: { 'messages' => {message.id.to_s => message.id.to_s}}, mark_to_set: mark_to_set, format: :json), options
|
1
|
+
= icon_link_to icon, '', message_train.box_path(@box.division, objects: { 'messages' => {message.id.to_s => message.id.to_s}}, mark_to_set: mark_to_set, format: :json), options
|
@@ -2,4 +2,4 @@ json.id participant.id
|
|
2
2
|
json.model_name participant.class.name
|
3
3
|
json.slug box_participant_slug(participant)
|
4
4
|
json.name box_participant_name(participant)
|
5
|
-
json.path
|
5
|
+
json.path box_participant_path(participant)
|
@@ -1 +1 @@
|
|
1
|
-
json.participant render
|
1
|
+
json.participant render(@participant)
|
@@ -10,4 +10,4 @@
|
|
10
10
|
%p= :at_time_through_received_a_message.l(time: @receipt.created_at, through: @through_name, subject: @receipt.message.subject, path: message_train.collective_box_conversation_path(@through, :in, @receipt.message.conversation))
|
11
11
|
%p{ style: 'font-size: .8rem; color: #666' }
|
12
12
|
= :unsubscribe_from_option.l(from: @through_name)
|
13
|
-
= link_to :manage_your_email_notifications.l, message_train.unsubscribes_url
|
13
|
+
= link_to :manage_your_email_notifications.l, message_train.unsubscribes_url
|
@@ -9,4 +9,4 @@
|
|
9
9
|
= :at_time_through_received_a_message.l(time: @receipt.created_at, through: @through_name, subject: @receipt.message.subject, path: message_train.collective_box_conversation_path(@through, :in, @receipt.message.conversation))
|
10
10
|
|
11
11
|
= :unsubscribe_from_option.l(from: @through_name)
|
12
|
-
= message_train.unsubscribes_url
|
12
|
+
= message_train.unsubscribes_url
|
@@ -11,7 +11,7 @@
|
|
11
11
|
%td= subscription[:from_name]
|
12
12
|
- if subscription[:unsubscribe].nil?
|
13
13
|
%td= :subscribed.l
|
14
|
-
%td= button_to :disable_notifications.l, message_train.unsubscribes_path(unsubscribe: { from_type: subscription[:from_type], from_id: subscription[:from_id] }), class: 'btn btn-danger', id: "unsubscribe-#{subscription[:from_type].downcase}-#{subscription[:from_id]}"
|
14
|
+
%td= button_to :disable_notifications.l, message_train.unsubscribes_path(unsubscribe: { from_type: subscription[:from_type], from_id: subscription[:from_id] }), class: 'btn btn-danger', id: "unsubscribe-#{subscription[:from_type].downcase}-#{subscription[:from_id]}"
|
15
15
|
- else
|
16
16
|
%td= :unsubscribed.l
|
17
17
|
%td= button_to :enable_notifications.l, message_train.unsubscribe_path(subscription[:unsubscribe].id), method: :delete, class: 'btn btn-primary', id: "remove-unsubscribe-#{subscription[:unsubscribe].id}"
|
data/config/environment.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ActionMailer::Base.register_template_extension('haml')
|
1
|
+
ActionMailer::Base.register_template_extension('haml')
|
data/config/locales/en.yml
CHANGED
@@ -92,7 +92,7 @@ en:
|
|
92
92
|
untrashed: 'Untrashed'
|
93
93
|
update_successful: 'Update successful'
|
94
94
|
updated_at_time: "Updated at %{time}"
|
95
|
-
|
95
|
+
wrong_number_of_arguments_right_wrong: "Wrong number of arguments for %{thing} (expected %{right}, got %{wrong})"
|
96
96
|
you_are_not_in_that_collective_type: "You are not in that %{collective_type}"
|
97
97
|
you_have_chosen_not_to_be_emailed: 'You have chosen not to be emailed when new messages arrive.'
|
98
98
|
you_must_sign_in_or_sign_up_to_continue: 'You must sign in or sign up to continue.'
|