ibrain-core 0.5.13 → 0.5.15

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: 600b958b07961ac273d90d3983dcc092468e9863daabf7c79dfd1243318bb76f
4
- data.tar.gz: 6ae2ccaba1c837721b9d0003379af3cd8a5bd5854b03d0abb6e6826b250b252f
3
+ metadata.gz: dcf708b989ce13166536ff15242a512355288a92efa79f547f73916f0815e63b
4
+ data.tar.gz: 8d440692e7c930935a416d8d9df2b8648b01e6f915f07cf1abf9d51d91083fb2
5
5
  SHA512:
6
- metadata.gz: e5a5f8b61ced5d7adfea0e6944c8ebd3d2aeaa6d637d50b2361bd194bc10c5b02efc745b4664770a0792b5408644324dd44d68d44b199e4d08d1b818335743f1
7
- data.tar.gz: c118b9650c409c848e6c8822a795e011d22c6c1eeb2dba9c70f240f8509b65bd3b5571446730ca5e68e2f72397ce92c6b57315e834300296d39546129b3bd498
6
+ metadata.gz: e2b6ce0ddb2621a374cd3904273eb4229a0e31ca6f1cfcda2b06b07053fc289ed50404f6f44abdfee641be163fc341e5d2680a7726510eb7f853fd931c6f0d18
7
+ data.tar.gz: a541dd57fba71cbdb986655c8f471d29f920231725fb9276411ee8a178ebcf177726040650f723e6e063231b86587d14da207259bb767e90afa12b3443f98b1d
@@ -4,7 +4,10 @@ module Ibrain
4
4
  module Extentions
5
5
  class SessionRequired < GraphQL::Schema::FieldExtension
6
6
  def resolve(object:, arguments:, **rest)
7
- raise ActionController::InvalidAuthenticityToken, I18n.t('ibrain.errors.session.invalid_session') if is_invalid_session(object)
7
+ if is_invalid_session(object)
8
+ remove_device_token(object)
9
+ raise ActionController::InvalidAuthenticityToken, I18n.t('ibrain.errors.session.invalid_session')
10
+ end
8
11
 
9
12
  # yield the current time as `memo`
10
13
  yield(object, arguments, rest)
@@ -15,6 +18,11 @@ module Ibrain
15
18
  def is_invalid_session(object)
16
19
  object.try(:context).try(:fetch, :current_user, nil).blank? && options.try(:fetch, :session_required, false)
17
20
  end
21
+
22
+ def remove_device_token(object)
23
+ request = object.try(:context).try(:fetch, :request, nil)
24
+ Ibrain.user_class.try(:remove_device_token, request) if request
25
+ end
18
26
  end
19
27
  end
20
28
  end
@@ -9,7 +9,7 @@ module Ibrain
9
9
  field :aggregate, Ibrain::Types::AggregateType, null: false, camelize: false
10
10
 
11
11
  def aggregate
12
- Ibrain::Aggregate.new(object.items.size)
12
+ Ibrain::Aggregate.new(object.items.to_a.size)
13
13
  end
14
14
  end
15
15
  end
@@ -9,7 +9,7 @@ module Ibrain
9
9
  field :aggregate, Ibrain::Types::AggregateType, null: false, camelize: false
10
10
 
11
11
  def aggregate
12
- Ibrain::Aggregate.new(object.items.size)
12
+ Ibrain::Aggregate.new(object.items.to_a.size)
13
13
  end
14
14
  end
15
15
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ibrain
4
- VERSION = "0.5.13"
4
+ VERSION = "0.5.15"
5
5
 
6
6
  def self.ibrain_version
7
7
  VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibrain-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.5.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tai Nguyen Van
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-03 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-session_store