chats 0.1.1 → 0.6.2
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 +1037 -0
- data/README.md +621 -40
- data/app/assets/stylesheets/chats.css +906 -2
- data/app/controllers/chats/application_controller.rb +45 -4
- data/app/controllers/chats/conversations_controller.rb +396 -86
- data/app/controllers/chats/messages_controller.rb +35 -13
- data/app/controllers/chats/reactions_controller.rb +14 -0
- data/app/helpers/chats/engine_helper.rb +230 -7
- data/app/javascript/chats/composer_controller.js +14 -1
- data/app/javascript/chats/dock_controller.js +1120 -0
- data/app/javascript/chats/recovery.js +539 -0
- data/app/javascript/chats/refresh_inbox_controller.js +76 -0
- data/app/javascript/chats/split_controller.js +131 -0
- data/app/javascript/chats/thread_controller.js +322 -60
- data/app/javascript/chats/unread_badge_controller.js +24 -0
- data/app/views/chats/conversations/_conversation_pane.html.erb +53 -0
- data/app/views/chats/conversations/_conversation_row.html.erb +37 -4
- data/app/views/chats/conversations/_empty_pane.html.erb +23 -0
- data/app/views/chats/conversations/_group.html.erb +61 -0
- data/app/views/chats/conversations/_history.html.erb +54 -0
- data/app/views/chats/conversations/_locked_composer.html.erb +20 -0
- data/app/views/chats/conversations/_thread.html.erb +147 -0
- data/app/views/chats/conversations/_thread_header.html.erb +83 -0
- data/app/views/chats/conversations/badge.turbo_stream.erb +6 -0
- data/app/views/chats/conversations/dock.html.erb +40 -0
- data/app/views/chats/conversations/index.html.erb +142 -15
- data/app/views/chats/conversations/pane.html.erb +14 -0
- data/app/views/chats/conversations/refresh.turbo_stream.erb +24 -4
- data/app/views/chats/conversations/show.html.erb +18 -134
- data/app/views/chats/conversations/window.html.erb +26 -0
- data/app/views/chats/dock/_badge.html.erb +12 -0
- data/app/views/chats/dock/_dock.html.erb +139 -0
- data/app/views/chats/dock/_signal.html.erb +26 -0
- data/app/views/chats/dock/_update.turbo_stream.erb +10 -0
- data/app/views/chats/dock/_window.html.erb +23 -0
- data/app/views/chats/dock/_window_header.html.erb +75 -0
- data/app/views/chats/dock/_window_shell.html.erb +17 -0
- data/app/views/chats/messages/_action.html.erb +15 -0
- data/app/views/chats/messages/_composer.html.erb +84 -56
- data/app/views/chats/messages/_message.html.erb +43 -15
- data/app/views/chats/messages/locked.turbo_stream.erb +6 -0
- data/app/views/chats/shared/_unread_badge.html.erb +4 -1
- data/app/views/chats/shared/_verified_badge.html.erb +32 -0
- data/config/importmap.rb +10 -1
- data/config/locales/en.yml +40 -0
- data/config/locales/es.yml +40 -0
- data/config/routes.rb +8 -0
- data/context7.json +4 -0
- data/docs/PRD.md +1 -1
- data/docs/campfire_review.md +1 -1
- data/docs/screenshots/composer-actions.png +0 -0
- data/docs/screenshots/dock-bar.png +0 -0
- data/docs/screenshots/dock-desktop.png +0 -0
- data/docs/screenshots/dock-phone-button.png +0 -0
- data/docs/screenshots/dock-phone-panel.png +0 -0
- data/docs/screenshots/dock-phone-window.png +0 -0
- data/docs/screenshots/inbox.png +0 -0
- data/docs/screenshots/split-inbox-empty.png +0 -0
- data/docs/screenshots/split-inbox-phone-list.png +0 -0
- data/docs/screenshots/split-inbox-phone-thread.png +0 -0
- data/docs/screenshots/split-inbox.png +0 -0
- data/docs/screenshots/system-note-action.png +0 -0
- data/docs/screenshots/thread-actions-phone.png +0 -0
- data/gemfiles/rails_7.1.gemfile +3 -0
- data/gemfiles/rails_7.2.gemfile +3 -0
- data/gemfiles/rails_8.1.gemfile +3 -0
- data/lib/chats/action.rb +85 -0
- data/lib/chats/broadcasts.rb +178 -17
- data/lib/chats/configuration.rb +115 -1
- data/lib/chats/engine.rb +29 -7
- data/lib/chats/errors.rb +16 -0
- data/lib/chats/inbox.rb +363 -0
- data/lib/chats/inbox_group.rb +75 -0
- data/lib/chats/inbox_refresh_job.rb +14 -0
- data/lib/chats/macros.rb +33 -1
- data/lib/chats/models/concerns/chat_subject.rb +23 -0
- data/lib/chats/models/concerns/messager.rb +122 -6
- data/lib/chats/models/conversation.rb +153 -19
- data/lib/chats/models/message.rb +292 -21
- data/lib/chats/models/participant.rb +67 -0
- data/lib/chats/models/reaction.rb +18 -0
- data/lib/chats/send_rate_limited.rb +30 -0
- data/lib/chats/subscribers.rb +156 -0
- data/lib/chats/version.rb +1 -1
- data/lib/chats.rb +123 -15
- data/lib/generators/chats/templates/add_action_to_chats_messages.rb.erb +37 -0
- data/lib/generators/chats/templates/add_author_to_chats_messages.rb.erb +44 -0
- data/lib/generators/chats/templates/create_chats_tables.rb.erb +22 -2
- data/lib/generators/chats/templates/initializer.rb +125 -14
- data/lib/generators/chats/upgrade_generator.rb +79 -0
- data/lib/generators/chats/views_generator.rb +3 -2
- metadata +51 -2
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators/base"
|
|
4
|
+
require "rails/generators/active_record"
|
|
5
|
+
|
|
6
|
+
module Chats
|
|
7
|
+
module Generators
|
|
8
|
+
# `rails generate chats:upgrade` — copy the migrations a version bump
|
|
9
|
+
# needs into an EXISTING install. Nothing else: the initializer, the
|
|
10
|
+
# views and the routes you already own stay untouched.
|
|
11
|
+
#
|
|
12
|
+
# Writes every migration since 0.1.x — 0.2.0's message authorship and
|
|
13
|
+
# 0.4.0's message action — in that order. Each is written guarded, so
|
|
14
|
+
# running this against an install that already has some of the columns
|
|
15
|
+
# (a fresh 0.2.0 install has the author ones) is a no-op for those
|
|
16
|
+
# rather than an error, and re-running it skips files already copied.
|
|
17
|
+
# The action migration is not written at all where the column exists.
|
|
18
|
+
class UpgradeGenerator < Rails::Generators::Base
|
|
19
|
+
include ActiveRecord::Generators::Migration
|
|
20
|
+
|
|
21
|
+
source_root File.expand_path("templates", __dir__)
|
|
22
|
+
desc "Add the migrations a chats version bump needs (0.2.0: message authorship; 0.4.0: message actions)"
|
|
23
|
+
|
|
24
|
+
def self.next_migration_number(dir)
|
|
25
|
+
ActiveRecord::Generators::Base.next_migration_number(dir)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def create_author_migration
|
|
29
|
+
migration_template "add_author_to_chats_messages.rb.erb",
|
|
30
|
+
File.join(db_migrate_path, "add_author_to_chats_messages.rb")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Not written when the schema already HAS the column — a fresh 0.4.0
|
|
34
|
+
# install, whose create migration owns it. A second migration for a
|
|
35
|
+
# column it didn't add is one nobody can safely roll back. Without a
|
|
36
|
+
# database to ask, it is written anyway; its `up` is guarded, and its
|
|
37
|
+
# `down` never drops the column.
|
|
38
|
+
def create_action_migration
|
|
39
|
+
if action_column_present?
|
|
40
|
+
say_status :skip, "chats_messages.action already exists — no migration needed", :yellow
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
migration_template "add_action_to_chats_messages.rb.erb",
|
|
45
|
+
File.join(db_migrate_path, "add_action_to_chats_messages.rb")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def display_post_upgrade_message
|
|
49
|
+
say "\n💬 chats upgrade migrations copied.", :green
|
|
50
|
+
say "\n 1. Run 'rails db:migrate'."
|
|
51
|
+
say " 2. New in 0.4.0 — a message can carry one button (the `action` column):"
|
|
52
|
+
say " alice.message!(bob, \"Let's play!\", action: { label: \"Join my room\", url: room_path(room) })"
|
|
53
|
+
say " app/views/chats/slots/_composer_actions.html.erb # your own buttons by the composer"
|
|
54
|
+
say " 3. New in 0.2.0 — all opt-in, nothing changes until you ask:"
|
|
55
|
+
say " acts_as_messager notifications: false, blockable: false, inbox: :grouped"
|
|
56
|
+
say " Chats.on(:message_created) { |message| … } # replaces config.notifier"
|
|
57
|
+
say " config.messager_url / config.message_signature / config.inbox_scope"
|
|
58
|
+
say " chat_locked? / chat_locked_notice on your chat subjects"
|
|
59
|
+
say " 4. See the CHANGELOG for the full list.\n", :green
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def action_column_present?
|
|
65
|
+
ActiveRecord::Base.connection_pool.with_connection do |connection|
|
|
66
|
+
connection.column_exists?(:chats_messages, :action)
|
|
67
|
+
end
|
|
68
|
+
rescue ActiveRecord::ActiveRecordError
|
|
69
|
+
# No database configured, not created yet, or no chats tables: there
|
|
70
|
+
# is nothing to ask, so write the (guarded) migration.
|
|
71
|
+
false
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def migration_version
|
|
75
|
+
"[#{ActiveRecord::VERSION::STRING.to_f}]"
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -24,13 +24,14 @@ module Chats
|
|
|
24
24
|
# Which groups to eject. Default copies everything renderable.
|
|
25
25
|
class_option :views,
|
|
26
26
|
type: :array,
|
|
27
|
-
default: %w[conversations messages shared],
|
|
28
|
-
desc: "Which view groups to copy (conversations, messages, shared)"
|
|
27
|
+
default: %w[conversations messages shared dock],
|
|
28
|
+
desc: "Which view groups to copy (conversations, messages, shared, dock)"
|
|
29
29
|
|
|
30
30
|
def copy_views
|
|
31
31
|
directory "chats/conversations", "app/views/chats/conversations" if include?("conversations")
|
|
32
32
|
directory "chats/messages", "app/views/chats/messages" if include?("messages")
|
|
33
33
|
directory "chats/shared", "app/views/chats/shared" if include?("shared")
|
|
34
|
+
directory "chats/dock", "app/views/chats/dock" if include?("dock")
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def show_styling_tip
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chats
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- rameerez
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-10-19 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activerecord
|
|
@@ -135,32 +135,76 @@ files:
|
|
|
135
135
|
- app/helpers/chats/engine_helper.rb
|
|
136
136
|
- app/javascript/chats/composer_controller.js
|
|
137
137
|
- app/javascript/chats/debounced_submit_controller.js
|
|
138
|
+
- app/javascript/chats/dock_controller.js
|
|
139
|
+
- app/javascript/chats/recovery.js
|
|
140
|
+
- app/javascript/chats/refresh_inbox_controller.js
|
|
141
|
+
- app/javascript/chats/split_controller.js
|
|
138
142
|
- app/javascript/chats/thread_controller.js
|
|
143
|
+
- app/javascript/chats/unread_badge_controller.js
|
|
144
|
+
- app/views/chats/conversations/_conversation_pane.html.erb
|
|
139
145
|
- app/views/chats/conversations/_conversation_row.html.erb
|
|
146
|
+
- app/views/chats/conversations/_empty_pane.html.erb
|
|
147
|
+
- app/views/chats/conversations/_group.html.erb
|
|
148
|
+
- app/views/chats/conversations/_history.html.erb
|
|
149
|
+
- app/views/chats/conversations/_locked_composer.html.erb
|
|
140
150
|
- app/views/chats/conversations/_messages_page.html.erb
|
|
141
151
|
- app/views/chats/conversations/_read_state.html.erb
|
|
152
|
+
- app/views/chats/conversations/_thread.html.erb
|
|
153
|
+
- app/views/chats/conversations/_thread_header.html.erb
|
|
154
|
+
- app/views/chats/conversations/badge.turbo_stream.erb
|
|
155
|
+
- app/views/chats/conversations/dock.html.erb
|
|
142
156
|
- app/views/chats/conversations/index.html.erb
|
|
157
|
+
- app/views/chats/conversations/pane.html.erb
|
|
143
158
|
- app/views/chats/conversations/refresh.turbo_stream.erb
|
|
144
159
|
- app/views/chats/conversations/show.html.erb
|
|
160
|
+
- app/views/chats/conversations/window.html.erb
|
|
161
|
+
- app/views/chats/dock/_badge.html.erb
|
|
162
|
+
- app/views/chats/dock/_dock.html.erb
|
|
163
|
+
- app/views/chats/dock/_signal.html.erb
|
|
164
|
+
- app/views/chats/dock/_update.turbo_stream.erb
|
|
165
|
+
- app/views/chats/dock/_window.html.erb
|
|
166
|
+
- app/views/chats/dock/_window_header.html.erb
|
|
167
|
+
- app/views/chats/dock/_window_shell.html.erb
|
|
168
|
+
- app/views/chats/messages/_action.html.erb
|
|
145
169
|
- app/views/chats/messages/_composer.html.erb
|
|
146
170
|
- app/views/chats/messages/_message.html.erb
|
|
147
171
|
- app/views/chats/messages/create.turbo_stream.erb
|
|
148
172
|
- app/views/chats/messages/errors.turbo_stream.erb
|
|
173
|
+
- app/views/chats/messages/locked.turbo_stream.erb
|
|
149
174
|
- app/views/chats/shared/_unread_badge.html.erb
|
|
175
|
+
- app/views/chats/shared/_verified_badge.html.erb
|
|
150
176
|
- config/importmap.rb
|
|
151
177
|
- config/locales/en.yml
|
|
152
178
|
- config/locales/es.yml
|
|
153
179
|
- config/routes.rb
|
|
180
|
+
- context7.json
|
|
154
181
|
- docs/PRD.md
|
|
155
182
|
- docs/campfire_review.md
|
|
183
|
+
- docs/screenshots/composer-actions.png
|
|
184
|
+
- docs/screenshots/dock-bar.png
|
|
185
|
+
- docs/screenshots/dock-desktop.png
|
|
186
|
+
- docs/screenshots/dock-phone-button.png
|
|
187
|
+
- docs/screenshots/dock-phone-panel.png
|
|
188
|
+
- docs/screenshots/dock-phone-window.png
|
|
189
|
+
- docs/screenshots/inbox.png
|
|
190
|
+
- docs/screenshots/split-inbox-empty.png
|
|
191
|
+
- docs/screenshots/split-inbox-phone-list.png
|
|
192
|
+
- docs/screenshots/split-inbox-phone-thread.png
|
|
193
|
+
- docs/screenshots/split-inbox.png
|
|
194
|
+
- docs/screenshots/system-note-action.png
|
|
195
|
+
- docs/screenshots/thread-actions-phone.png
|
|
156
196
|
- gemfiles/rails_7.1.gemfile
|
|
157
197
|
- gemfiles/rails_7.2.gemfile
|
|
158
198
|
- gemfiles/rails_8.1.gemfile
|
|
159
199
|
- lib/chats.rb
|
|
200
|
+
- lib/chats/action.rb
|
|
160
201
|
- lib/chats/broadcasts.rb
|
|
161
202
|
- lib/chats/configuration.rb
|
|
162
203
|
- lib/chats/engine.rb
|
|
163
204
|
- lib/chats/errors.rb
|
|
205
|
+
- lib/chats/inbox.rb
|
|
206
|
+
- lib/chats/inbox_group.rb
|
|
207
|
+
- lib/chats/inbox_refresh_job.rb
|
|
164
208
|
- lib/chats/macros.rb
|
|
165
209
|
- lib/chats/models/application_record.rb
|
|
166
210
|
- lib/chats/models/concerns/chat_subject.rb
|
|
@@ -169,10 +213,15 @@ files:
|
|
|
169
213
|
- lib/chats/models/message.rb
|
|
170
214
|
- lib/chats/models/participant.rb
|
|
171
215
|
- lib/chats/models/reaction.rb
|
|
216
|
+
- lib/chats/send_rate_limited.rb
|
|
217
|
+
- lib/chats/subscribers.rb
|
|
172
218
|
- lib/chats/version.rb
|
|
173
219
|
- lib/generators/chats/install_generator.rb
|
|
220
|
+
- lib/generators/chats/templates/add_action_to_chats_messages.rb.erb
|
|
221
|
+
- lib/generators/chats/templates/add_author_to_chats_messages.rb.erb
|
|
174
222
|
- lib/generators/chats/templates/create_chats_tables.rb.erb
|
|
175
223
|
- lib/generators/chats/templates/initializer.rb
|
|
224
|
+
- lib/generators/chats/upgrade_generator.rb
|
|
176
225
|
- lib/generators/chats/views_generator.rb
|
|
177
226
|
homepage: https://github.com/rameerez/chats
|
|
178
227
|
licenses:
|