livechat 0.6.6 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/app/controllers/livechat/application_controller.rb +4 -0
- data/app/controllers/livechat/conversations_controller.rb +1 -1
- data/app/models/livechat/conversation.rb +17 -0
- data/app/models/livechat/message.rb +1 -1
- data/lib/generators/livechat/install/templates/initializer.rb +4 -0
- data/lib/livechat/configuration.rb +5 -0
- data/lib/livechat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2ad48b9206502c979af98f3733631b26075e08efe04c9044e0e5969d21bc7f3
|
|
4
|
+
data.tar.gz: b40e4efc2e6a014c34104abd860bafc41a330eebd863ad6f8e4663a41bc280fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 19c4dc8d3f683af308f34df8341d5e8221d434bad217e0291a34a1da799afe8029e1e423dbf549d48c341cf7114c7fb14336fef47c7049cd087992d9d0492138
|
|
7
|
+
data.tar.gz: 4459c416ea3a0ed27422847f41bbef950f11420d448c44ac5b02af0e5cca257eae0ec42e33d7cb5e7cd5f9d6c2d84ba35c6b94b92eb18c68f90cc132375da258
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.8
|
|
4
|
+
|
|
5
|
+
- Fixed Rails 7.1 compatibility for attachment configuration by avoiding the
|
|
6
|
+
dynamic Active Storage `service:` lambda on versions that only accept a
|
|
7
|
+
concrete service name.
|
|
8
|
+
|
|
9
|
+
## 0.6.7
|
|
10
|
+
|
|
11
|
+
- Added `config.agent_layout`, letting host apps render the Livechat inbox
|
|
12
|
+
inside their own admin layout while keeping the standalone gem layout as the
|
|
13
|
+
default.
|
|
14
|
+
|
|
3
15
|
## 0.6.6
|
|
4
16
|
|
|
5
17
|
- Expanded the desktop visitor widget into a taller, wider panel with equal
|
|
@@ -124,9 +124,26 @@ module Livechat
|
|
|
124
124
|
return unless Livechat.attachments_enabled?
|
|
125
125
|
|
|
126
126
|
uploads = Array(files).select { |file| file.respond_to?(:read) }
|
|
127
|
+
uploads = uploads.map { |file| attachment_upload(file) } if Livechat.config.storage_service
|
|
127
128
|
message.files.attach(uploads) if uploads.any?
|
|
128
129
|
end
|
|
129
130
|
|
|
131
|
+
def attachment_upload(file)
|
|
132
|
+
{
|
|
133
|
+
io: file,
|
|
134
|
+
filename: upload_filename(file),
|
|
135
|
+
content_type: (file.content_type if file.respond_to?(:content_type)),
|
|
136
|
+
service_name: Livechat.config.storage_service
|
|
137
|
+
}.compact
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def upload_filename(file)
|
|
141
|
+
return file.original_filename if file.respond_to?(:original_filename)
|
|
142
|
+
return File.basename(file.path) if file.respond_to?(:path) && file.path
|
|
143
|
+
|
|
144
|
+
'attachment'
|
|
145
|
+
end
|
|
146
|
+
|
|
130
147
|
# Every conversation belongs to someone — a signed-in user or at least a
|
|
131
148
|
# guest cookie. An unattributable thread could never be shown to its
|
|
132
149
|
# visitor again.
|
|
@@ -17,7 +17,7 @@ module Livechat
|
|
|
17
17
|
def self.attachments_supported? = ATTACHMENTS_SUPPORTED
|
|
18
18
|
|
|
19
19
|
belongs_to :conversation
|
|
20
|
-
has_many_attached :files
|
|
20
|
+
has_many_attached :files if ATTACHMENTS_SUPPORTED
|
|
21
21
|
|
|
22
22
|
validates :author_type, inclusion: { in: AUTHOR_TYPES }
|
|
23
23
|
validates :body, length: { maximum: MAX_BODY_LENGTH }, allow_blank: true
|
|
@@ -12,6 +12,10 @@ Livechat.configure do |config|
|
|
|
12
12
|
# Who can answer at the mount path. Defaults to development only — override
|
|
13
13
|
# before deploying.
|
|
14
14
|
# config.authorize_agent = ->(request) { request.env["warden"]&.user&.admin? }
|
|
15
|
+
#
|
|
16
|
+
# Render the inbox inside your app's admin layout. Default: the gem's
|
|
17
|
+
# standalone inbox layout.
|
|
18
|
+
# config.agent_layout = "admin/application"
|
|
15
19
|
|
|
16
20
|
# Resolve the current user (optional). Return an object responding to #id,
|
|
17
21
|
# or nil. Signed-in visitors keep one conversation across devices; guests
|
|
@@ -18,6 +18,10 @@ module Livechat
|
|
|
18
18
|
# so your team can answer from production even where the widget is off.
|
|
19
19
|
attr_accessor :authorize_agent
|
|
20
20
|
|
|
21
|
+
# Layout used by the built-in inbox. Override this to render Livechat
|
|
22
|
+
# inside your app's admin shell, e.g. "admin/application".
|
|
23
|
+
attr_accessor :agent_layout
|
|
24
|
+
|
|
21
25
|
# Resolve the current user (optional). Return an object responding to
|
|
22
26
|
# #id, or nil. Receives the request. Signed-in users keep one conversation
|
|
23
27
|
# across devices; guests are tracked with a cookie.
|
|
@@ -100,6 +104,7 @@ module Livechat
|
|
|
100
104
|
@app_name = nil
|
|
101
105
|
@enabled = ->(_request) { true }
|
|
102
106
|
@authorize_agent = ->(_request) { Rails.env.development? }
|
|
107
|
+
@agent_layout = 'livechat/application'
|
|
103
108
|
@current_user = ->(_request) {}
|
|
104
109
|
@visitor_label = ->(user) { user.try(:name).presence || user.try(:email).presence || user.to_s }
|
|
105
110
|
@agent_label = ->(user) { user.try(:name).presence || user.try(:email).presence || user.to_s }
|
data/lib/livechat/version.rb
CHANGED