polylingo_chat 0.4.1 → 0.5.0
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/README.md +46 -0
- data/lib/generators/polylingo_chat/install/install_generator.rb +1 -0
- data/lib/generators/polylingo_chat/install/templates/create_message_read_receipts.rb +14 -0
- data/lib/generators/polylingo_chat/read_receipts/read_receipts_generator.rb +48 -0
- data/lib/polylingo_chat/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d943177494bfb641a85ca0d44e89bd074f8a320de8843141dc379166e0f4b3c
|
|
4
|
+
data.tar.gz: 2017bbbeffb249811257755c877d39be524e622dd38c0ea5b4fca71e9617ecf9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a431e3c3fb1f011f4fbb76e8e903390f8cb79e874ecd1a37b88bb7b0baddf5ebd9d414a7c89650977a24f30cc924db95f847f93143c37444bb854f6f0f9776c
|
|
7
|
+
data.tar.gz: 6324703732e85dd3d244f6bc54d70c5d6b5e8e75ace9ee131524884dc755e4120a0790d637d1e733a47216c062073e0b5c066f615cc4ba973f9ac58b9da318a4
|
data/README.md
CHANGED
|
@@ -15,6 +15,7 @@ Perfect for marketplaces, SaaS apps, CRMs, support systems, or global communitie
|
|
|
15
15
|
- 🧩 **Rails Engine** — mounts directly inside your app
|
|
16
16
|
- 📱 **API-only mode** — works with Rails API applications (auto-detected)
|
|
17
17
|
- 👥 **Polymorphic associations** — supports multiple participant types (User, Vendor, Customer, etc.)
|
|
18
|
+
- 📬 **Read receipts** — per-participant read/unread tracking with visual indicators (✓ sent, ✓✓ read)
|
|
18
19
|
- 🔌 **Works with any ActiveJob backend** (Sidekiq, Solid Queue, Delayed Job, etc.)
|
|
19
20
|
- 🔐 **Secure & scoped** ActionCable channels
|
|
20
21
|
- 🧱 **Extendable architecture** (custom UI, custom providers, custom storage)
|
|
@@ -151,6 +152,51 @@ bundle exec sidekiq # or bin/rails solid_queue:start, or bin/rails jobs:work
|
|
|
151
152
|
|
|
152
153
|
---
|
|
153
154
|
|
|
155
|
+
## 🔄 Upgrading Existing Installations
|
|
156
|
+
|
|
157
|
+
### Adding Read Receipts to Existing Installations
|
|
158
|
+
|
|
159
|
+
If you're upgrading from a previous version and want to add message read receipts:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
bin/rails generate polylingo_chat:read_receipts
|
|
163
|
+
bin/rails db:migrate
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
This adds:
|
|
167
|
+
- ✅ `polylingo_chat_message_read_receipts` table migration
|
|
168
|
+
- ✅ Per-participant read/unread message tracking
|
|
169
|
+
- ✅ Read receipt indicators in UI (✓ sent, ✓✓ read)
|
|
170
|
+
- ✅ Unread message counts on conversation list
|
|
171
|
+
- ✅ API endpoints for read receipt management
|
|
172
|
+
- ✅ Automatic read tracking when viewing messages
|
|
173
|
+
|
|
174
|
+
**New API Methods:**
|
|
175
|
+
```ruby
|
|
176
|
+
# Message methods
|
|
177
|
+
message.mark_as_read_by(user)
|
|
178
|
+
message.read_by?(user)
|
|
179
|
+
message.unread_by?(user)
|
|
180
|
+
message.read_at_by(user)
|
|
181
|
+
|
|
182
|
+
# Conversation methods
|
|
183
|
+
conversation.unread_messages_count_for(user)
|
|
184
|
+
conversation.has_unread_messages_for?(user)
|
|
185
|
+
|
|
186
|
+
# Query scopes
|
|
187
|
+
Message.unread_by(user)
|
|
188
|
+
Message.read_by(user)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**New API Endpoints:**
|
|
192
|
+
- `POST /conversations/:conversation_id/messages/:id/mark_as_read` - Mark individual message as read
|
|
193
|
+
- `POST /conversations/:id/mark_all_read` - Mark all messages as read
|
|
194
|
+
- `GET /conversations/:id/unread_count` - Get unread count
|
|
195
|
+
|
|
196
|
+
See `API_READ_RECEIPTS.md` for complete API documentation.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
154
200
|
## 🛠️ Advanced Installation
|
|
155
201
|
|
|
156
202
|
### API-Only Mode
|
|
@@ -28,6 +28,7 @@ module PolylingoChat
|
|
|
28
28
|
migration_template "create_participants.rb", "db/migrate/create_polylingo_chat_participants.rb"
|
|
29
29
|
migration_template "create_messages.rb", "db/migrate/create_polylingo_chat_messages.rb"
|
|
30
30
|
migration_template "create_message_translations.rb", "db/migrate/create_polylingo_chat_message_translations.rb"
|
|
31
|
+
migration_template "create_message_read_receipts.rb", "db/migrate/create_polylingo_chat_message_read_receipts.rb"
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
def create_channels
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class CreatePolylingoChatMessageReadReceipts < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :polylingo_chat_message_read_receipts do |t|
|
|
4
|
+
t.references :message, null: false, foreign_key: { to_table: :polylingo_chat_messages }
|
|
5
|
+
t.references :reader, polymorphic: true, null: false
|
|
6
|
+
t.datetime :read_at, null: false
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
add_index :polylingo_chat_message_read_receipts, [:message_id, :reader_type, :reader_id], unique: true, name: 'idx_read_receipts_unique'
|
|
12
|
+
add_index :polylingo_chat_message_read_receipts, [:reader_type, :reader_id]
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'rails/generators/migration'
|
|
3
|
+
|
|
4
|
+
module PolylingoChat
|
|
5
|
+
module Generators
|
|
6
|
+
class ReadReceiptsGenerator < Rails::Generators::Base
|
|
7
|
+
include Rails::Generators::Migration
|
|
8
|
+
|
|
9
|
+
source_root File.expand_path('../install/templates', __dir__)
|
|
10
|
+
|
|
11
|
+
desc "Adds message read receipts migration to existing PolylingoChat installation"
|
|
12
|
+
|
|
13
|
+
def self.next_migration_number(dirname)
|
|
14
|
+
next_migration_number = current_migration_number(dirname) + 1
|
|
15
|
+
ActiveRecord::Migration.next_migration_number(next_migration_number)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def copy_migration
|
|
19
|
+
migration_template "create_message_read_receipts.rb",
|
|
20
|
+
"db/migrate/create_polylingo_chat_message_read_receipts.rb"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def show_instructions
|
|
24
|
+
say "\n" + "=" * 80, :green
|
|
25
|
+
say "Read receipts migration has been created!", :green
|
|
26
|
+
say "=" * 80, :green
|
|
27
|
+
say "\nNext steps:", :yellow
|
|
28
|
+
say " 1. Run: rails db:migrate"
|
|
29
|
+
say " 2. Messages will now automatically track read/unread status per participant"
|
|
30
|
+
say "\nNew features available:", :cyan
|
|
31
|
+
say " - Message model:"
|
|
32
|
+
say " • message.mark_as_read_by(user)"
|
|
33
|
+
say " • message.read_by?(user)"
|
|
34
|
+
say " • message.unread_by?(user)"
|
|
35
|
+
say " • message.read_at_by(user)"
|
|
36
|
+
say " • Message.unread_by(user)"
|
|
37
|
+
say " • Message.read_by(user)"
|
|
38
|
+
say "\n - Conversation model:"
|
|
39
|
+
say " • conversation.unread_messages_count_for(user)"
|
|
40
|
+
say " • conversation.has_unread_messages_for?(user)"
|
|
41
|
+
say "\n - Views automatically show:"
|
|
42
|
+
say " • Read receipts (✓✓) on sent messages"
|
|
43
|
+
say " • Unread message counts on conversation list"
|
|
44
|
+
say "\n"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: polylingo_chat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shoaib Malik
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -75,6 +75,7 @@ files:
|
|
|
75
75
|
- lib/generators/polylingo_chat/install/templates/controllers/polylingo_chat/conversations_controller.rb
|
|
76
76
|
- lib/generators/polylingo_chat/install/templates/controllers/polylingo_chat/messages_controller.rb
|
|
77
77
|
- lib/generators/polylingo_chat/install/templates/create_conversations.rb
|
|
78
|
+
- lib/generators/polylingo_chat/install/templates/create_message_read_receipts.rb
|
|
78
79
|
- lib/generators/polylingo_chat/install/templates/create_message_translations.rb
|
|
79
80
|
- lib/generators/polylingo_chat/install/templates/create_messages.rb
|
|
80
81
|
- lib/generators/polylingo_chat/install/templates/create_participants.rb
|
|
@@ -88,6 +89,7 @@ files:
|
|
|
88
89
|
- lib/generators/polylingo_chat/install/templates/models/participant.rb
|
|
89
90
|
- lib/generators/polylingo_chat/install/templates/views/polylingo_chat/conversations/index.html.erb
|
|
90
91
|
- lib/generators/polylingo_chat/install/templates/views/polylingo_chat/conversations/show.html.erb
|
|
92
|
+
- lib/generators/polylingo_chat/read_receipts/read_receipts_generator.rb
|
|
91
93
|
- lib/polylingo_chat.rb
|
|
92
94
|
- lib/polylingo_chat/config.rb
|
|
93
95
|
- lib/polylingo_chat/engine.rb
|