simple_chat 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3fa5a120911616d3139fa0da969eef52af9f61bb44d30509c261be204ea4d97
4
- data.tar.gz: d22d02acf74b58304075280710421b5912125f9395e5725305436ae793b5e5d9
3
+ metadata.gz: 69050c9a69a4a8afccdf6cf1426a9dd0eb917353adf5964267b6eed1720d5706
4
+ data.tar.gz: 727b556b8d143dca7049baad442943d3f04d7f3151903d3338c67336938fdfff
5
5
  SHA512:
6
- metadata.gz: 831c8b3dc9b0da1e60e0a6fb3897552642ea52a38be3fadb1062b62ed1a713a7919cb9036e950891e3c12aed0f624f7a6a7cedd29655e005a3ff5b53fab93c9e
7
- data.tar.gz: e076aa779fc16a29002822713e949368edced4fcb9a0271090d3df1d83e76dc4f506da6b6cc8a3ef781ce1bef5b72252ae09a815169108c92b4a905a5043c503
6
+ metadata.gz: 95d652be9867dc055977ce8cbf2ab92af3933a8eff0887fb306487758268e1899a2c08133a26fd98bf056bf6bb2b6cd046d1d6add63e56dbcdf7ccf4f2faf04f
7
+ data.tar.gz: 34bba944f9299ec4764d0ce8d6a670d82dcf4182dc99d9bc6c1510d39ba5ecde8a8b7a1a6a96325dd7c03d540c3f3e51ad3930c333ac5098239fb158e336a9ff
@@ -1,6 +1,8 @@
1
1
  <%# Using local variable message instead of calling helper to avoid issues in background jobs %>
2
- <% current_user = local_assigns[:current_user] || (respond_to?(:simple_chat_current_user) ? simple_chat_current_user : nil) %>
3
- <li id="<%= dom_id message %>" class="relative flex gap-x-4">
2
+ <% current_user_id = local_assigns[:current_user_id] || (respond_to?(:simple_chat_current_user) ? simple_chat_current_user&.id : nil) %>
3
+ <li id="<%= dom_id message %>"
4
+ data-sender-id="<%= message.user_id %>"
5
+ class="relative flex gap-x-4">
4
6
  <div class="absolute top-0 -bottom-6 left-0 flex w-6 justify-center">
5
7
  <div class="w-px bg-gray-200"></div>
6
8
  </div>
@@ -9,13 +11,11 @@
9
11
  <span class="text-[10px] font-bold text-gray-500"><%= message.user.respond_to?(:name) ? message.user.name[0].upcase : message.user_id %></span>
10
12
  </div>
11
13
 
12
- <div class="flex-auto rounded-md p-3 ring-1 ring-gray-200 ring-inset <%= message.user == current_user ? 'bg-blue-50/50 ring-blue-100' : 'bg-white' %>">
14
+ <div class="flex-auto rounded-md p-3 ring-1 ring-gray-200 ring-inset bg-white [[data-sender-id='<%= current_user_id %>']&]:bg-blue-50/50 [[data-sender-id='<%= current_user_id %>']&]:ring-blue-100">
13
15
  <div class="flex justify-between gap-x-4">
14
16
  <div class="py-0.5 text-xs/5 text-gray-500">
15
17
  <span class="font-medium text-gray-900"><%= message.user.respond_to?(:name) ? message.user.name : "User ##{message.user_id}" %></span>
16
- <% if message.user == current_user %>
17
- <span class="ml-1 text-[10px] text-blue-500 font-semibold">(You)</span>
18
- <% end %>
18
+ <span class="ml-1 text-[10px] text-blue-500 font-semibold hidden [[data-sender-id='<%= current_user_id %>']_&]:inline">(You)</span>
19
19
  </div>
20
20
  <time datetime="<%= message.created_at.iso8601 %>" class="flex-none py-0.5 text-xs/5 text-gray-400">
21
21
  <%= time_ago_in_words(message.created_at) %> ago
@@ -1,6 +1,14 @@
1
1
  class AddChannelHashToSolidCableMessages < ActiveRecord::Migration[8.1]
2
2
  def change
3
- add_column :solid_cable_messages, :channel_hash, :integer, limit: 8, null: false
3
+ create_table :solid_cable_messages do |t|
4
+ t.binary :channel, null: false, limit: 1024
5
+ t.binary :payload, null: false, limit: 536870912
6
+ t.integer :solid_cable_messages, :channel_hash, limit: 8, null: false
7
+ t.datetime :created_at, null: false
8
+
9
+ t.index :channel
10
+ t.index :created_at
11
+ end
4
12
  add_index :solid_cable_messages, :channel_hash
5
13
  end
6
14
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleChat
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YiSheng, Lee