loco-rails 6.2.0 → 7.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f19b00ff36ec7132b45de85129912e7d2172ae9149e3b21120f76ce492336b71
4
- data.tar.gz: 2e0392a0b88a6718909bd6b4e080b5879ac7d0eb8a0800651490cae374dfd58b
3
+ metadata.gz: 91fa43946b21c98653c94fb289209737014410626b912cd81a02d646a4fd1ca3
4
+ data.tar.gz: f05761f0f25b0a3a554e05c0530add2c1c7a17a0445a8934cf0da12772f13595
5
5
  SHA512:
6
- metadata.gz: 679524b086a06791d153905990346b7db8ba2500ed7d237ddbc76d5ec3d5ca738012f0ab51028b623b4d3de6bce6cda4c3e992f7b32e8ccee0cd5e26ceb7bcfe
7
- data.tar.gz: edd79606b2751690384a226cfa32e64f938e5dd8a2af80aba260f75ba1872567c0b24dd18421bc0575b6e908efb06ceb7622ed6129c8956cd739dbf4a17ff456
6
+ metadata.gz: bc352f8f3ca53406196967df78b1f8ef428beeb7b7a61c1005a0cb7ed99dba3ffc571431c6869676f688c2d4e069a8d7ef5faa2f7a12d579e8d500cb361ed149
7
+ data.tar.gz: 6ee7da804147b2ac32cb8ef11558b604ea2a6822fd946f8a91b242d113f55a0ab7b7070956f2e54851f0159a512e86c9474dea1d6245bbc728a2d10e53d265cb
@@ -33,7 +33,7 @@ module Loco
33
33
  protected
34
34
 
35
35
  def update_connections
36
- PermissionsPresenter.indexed(loco_permissions, except: :uuid).each do |_, resource|
36
+ PermissionsPresenter.indexed(loco_permissions, except: :uuid).each_value do |resource|
37
37
  WsConnectionManager.new(resource).update(@uuid)
38
38
  end
39
39
  end
@@ -22,7 +22,7 @@ module Loco
22
22
  return
23
23
  end
24
24
  fetcher = Notification::Fetcher.new({ synced_at: params[:synced_at],
25
- permissions: permissions,
25
+ permissions:,
26
26
  recipient_token: params[:token] })
27
27
  render json: [fetcher.formatted_notifications, fetcher.next_sync_time.iso8601(6)]
28
28
  end
@@ -7,7 +7,7 @@ module Loco
7
7
 
8
8
  attr_reader :obj
9
9
 
10
- serialize :data, JSON
10
+ serialize :data, coder: JSON if ActiveRecord::Base.connection.adapter_name != 'PostgreSQL'
11
11
 
12
12
  validates :obj_class, presence: true
13
13
  validates :event, presence: true
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateLocoNotifications < ActiveRecord::Migration[5.0]
3
+ class CreateLocoNotifications < ActiveRecord::Migration[6.1]
4
4
  def change
5
- create_table :loco_notifications do |t|
5
+ create_table :loco_notifications, id: false do |t|
6
6
  t.string :obj_class
7
- t.integer :obj_id
7
+ t.bigint :obj_id
8
8
  t.string :event
9
- t.string :data
9
+ t.column :data, (ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' ? :jsonb : :text)
10
10
  t.string :recipient_class
11
- t.integer :recipient_id
11
+ t.bigint :recipient_id
12
12
  t.string :recipient_token
13
13
 
14
14
  t.timestamps null: false, limit: 6
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddIndexesToLocoNotifications < ActiveRecord::Migration[6.1]
4
+ def change
5
+ add_index :loco_notifications, %i[created_at recipient_class recipient_id],
6
+ name: 'index_loco_notifications_on_created_at_and_recipient'
7
+
8
+ add_index :loco_notifications, %i[created_at recipient_token],
9
+ name: 'index_loco_notifications_on_created_at_and_recipient_token'
10
+ end
11
+ end
@@ -7,7 +7,6 @@ module Loco
7
7
  def install
8
8
  generate 'loco:initializer'
9
9
  generate 'loco:file_injector'
10
- generate 'loco:core:file_injector'
11
10
  generate 'loco:notification_center'
12
11
  rake 'loco:install:migrations'
13
12
  end
@@ -22,9 +22,9 @@ module Loco
22
22
  def send_notifications(obj, event, recipients, payload)
23
23
  recipients.each do |recipient|
24
24
  notification = Notification.create!(
25
- obj: obj,
26
- event: event,
27
- recipient: recipient,
25
+ obj:,
26
+ event:,
27
+ recipient:,
28
28
  data: payload
29
29
  )
30
30
  sync_time = notification.created_at.iso8601(6)
@@ -43,10 +43,10 @@ module Loco
43
43
  def send_notification(recipient, notification, sync_time)
44
44
  if notification.recipient_id
45
45
  Sender.(recipient, loco: { notification: notification.compact })
46
- Sender.(recipient, loco: { sync_time: sync_time })
46
+ Sender.(recipient, loco: { sync_time: })
47
47
  else
48
48
  SenderJob.perform_later(recipient, loco: { notification: notification.compact })
49
- SenderJob.perform_later(recipient, loco: { sync_time: sync_time })
49
+ SenderJob.perform_later(recipient, loco: { sync_time: })
50
50
  end
51
51
  end
52
52
  end
data/lib/loco/hub.rb CHANGED
@@ -58,7 +58,7 @@ module Loco
58
58
  def members
59
59
  raw_members.map do |serialized|
60
60
  klass, id = serialized.split(':')
61
- klass.classify.constantize.find_by(id: id)
61
+ klass.classify.constantize.find_by(id:)
62
62
  end
63
63
  end
64
64
  end
data/lib/loco/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Loco
4
- VERSION = '6.2.0'
4
+ VERSION = '7.0.0.pre'
5
5
  end
@@ -59,8 +59,8 @@ module Loco
59
59
  end
60
60
  end
61
61
 
62
- def scan_hash(key, &block)
63
- storage.hscan_each(proper_key("h:#{key}"), &block)
62
+ def scan_hash(key, &)
63
+ storage.hscan_each(proper_key("h:#{key}"), &)
64
64
  end
65
65
 
66
66
  def hlen(key)
data/lib/loco-rails.rb CHANGED
@@ -1,12 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'loco-rails-core'
4
-
5
3
  require 'loco/broadcaster'
6
4
  require 'loco/config'
7
5
  require 'loco/emitter'
8
6
  require 'loco/rails/engine'
9
- require 'loco/helpers'
10
7
  require 'loco/hub'
11
8
  require 'loco/permissions_presenter'
12
9
  require 'loco/sender'
metadata CHANGED
@@ -1,253 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loco-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 7.0.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zbigniew Humeniuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-30 00:00:00.000000000 Z
11
+ date: 2024-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: loco-rails-core
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 0.2.1
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 0.2.1
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rails
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '5.0'
19
+ version: '6.1'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '5.0'
41
- - !ruby/object:Gem::Dependency
42
- name: bcrypt
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 3.1.18
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 3.1.18
55
- - !ruby/object:Gem::Dependency
56
- name: capybara
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 3.38.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 3.38.0
69
- - !ruby/object:Gem::Dependency
70
- name: database_cleaner
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 2.0.1
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 2.0.1
83
- - !ruby/object:Gem::Dependency
84
- name: jbuilder
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 2.11.5
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 2.11.5
97
- - !ruby/object:Gem::Dependency
98
- name: listen
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 3.8.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 3.8.0
111
- - !ruby/object:Gem::Dependency
112
- name: mysql2
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.5.5
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.5.5
125
- - !ruby/object:Gem::Dependency
126
- name: puma
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 6.1.1
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 6.1.1
139
- - !ruby/object:Gem::Dependency
140
- name: redis
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: 5.0.6
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: 5.0.6
153
- - !ruby/object:Gem::Dependency
154
- name: rspec-expectations
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: 3.12.2
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: 3.12.2
167
- - !ruby/object:Gem::Dependency
168
- name: rspec-mocks
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: 3.12.3
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: 3.12.3
181
- - !ruby/object:Gem::Dependency
182
- name: rubocop
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - "~>"
186
- - !ruby/object:Gem::Version
187
- version: '1.48'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - "~>"
193
- - !ruby/object:Gem::Version
194
- version: '1.48'
195
- - !ruby/object:Gem::Dependency
196
- name: rubocop-rails
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: 2.18.0
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: 2.18.0
209
- - !ruby/object:Gem::Dependency
210
- name: selenium-webdriver
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - "~>"
214
- - !ruby/object:Gem::Version
215
- version: 4.8.1
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - "~>"
221
- - !ruby/object:Gem::Version
222
- version: 4.8.1
223
- - !ruby/object:Gem::Dependency
224
- name: sprockets-rails
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - "~>"
228
- - !ruby/object:Gem::Version
229
- version: 3.4.2
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - "~>"
235
- - !ruby/object:Gem::Version
236
- version: 3.4.2
237
- - !ruby/object:Gem::Dependency
238
- name: will_paginate
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - "~>"
242
- - !ruby/object:Gem::Version
243
- version: 3.3.1
244
- type: :development
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - "~>"
249
- - !ruby/object:Gem::Version
250
- version: 3.3.1
26
+ version: '6.1'
251
27
  description: Rails is awesome, but modern web needs Loco-motive.
252
28
  email:
253
29
  - hello@artofcode.co
@@ -265,6 +41,7 @@ files:
265
41
  - app/services/loco/notification/fetcher.rb
266
42
  - config/routes.rb
267
43
  - db/migrate/20150927133812_create_loco_notifications.rb
44
+ - db/migrate/20240211210452_add_indexes_to_loco_notifications.rb
268
45
  - lib/generators/loco/file_injector/USAGE
269
46
  - lib/generators/loco/file_injector/file_injector_generator.rb
270
47
  - lib/generators/loco/file_injector/templates/application_controller.rb
@@ -281,7 +58,6 @@ files:
281
58
  - lib/loco/broadcaster.rb
282
59
  - lib/loco/config.rb
283
60
  - lib/loco/emitter.rb
284
- - lib/loco/helpers.rb
285
61
  - lib/loco/hub.rb
286
62
  - lib/loco/permissions_presenter.rb
287
63
  - lib/loco/rails/engine.rb
@@ -305,14 +81,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
305
81
  requirements:
306
82
  - - ">="
307
83
  - !ruby/object:Gem::Version
308
- version: 3.0.0
84
+ version: 3.1.0
309
85
  required_rubygems_version: !ruby/object:Gem::Requirement
310
86
  requirements:
311
87
  - - ">="
312
88
  - !ruby/object:Gem::Version
313
89
  version: '0'
314
90
  requirements: []
315
- rubygems_version: 3.4.6
91
+ rubygems_version: 3.5.6
316
92
  signing_key:
317
93
  specification_version: 4
318
94
  summary: Framework on top of Rails.
data/lib/loco/helpers.rb DELETED
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Loco
4
- module Helpers
5
- include Loco::Core::Helpers
6
- end
7
- end