customer_service_im 0.5.0 → 0.6.0

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: b1159035b88fea5b356d2331f6a8ea28f703599bd2018e11f9daccde396095ac
4
- data.tar.gz: a8cdc0d5b2bbc65d595b882ecfde3321b6d862179ab487b5bde983ee74d376ee
3
+ metadata.gz: 51614b5350dfdda2b865dde53f6781b7d0e01a61fd4d9a52f807bacd0d4c1535
4
+ data.tar.gz: 546af3c9b523ce2ea30292fae46fc542ebe0b8c1bed3576192193bfd5b29dba6
5
5
  SHA512:
6
- metadata.gz: 6c4993873b7ec3882da885ecfa2473853f5a81066130123de8596180f1141365e13441adb5780a8c1b484c8a674dddd2e5cd4fded54b3bea1483465bdb828540
7
- data.tar.gz: 02e4ed7d1ecaef3e70abaf09571f45bb1a501200bb0eddcf7c897327aceff83738364ab625c7d474bc797bd4865dd247a092f2aca9cd70ceecefd37c5d4f7256
6
+ metadata.gz: a76f3ff1b5673fd1ba393d123d95cb79408ac402a6fba35b35146513102dc0ecca49e2cf8b89709baec5fa31d2ce8df867832fd60950758d33a91b7aec083de5
7
+ data.tar.gz: 1a0ab5cd159159668367664ea402c7d0c9b82cfd1e9753e36c226237430c01c249875cb2323126a8e9a78ceebf63b4abe3922eda53444f5c173bb48cd995f602
@@ -11,7 +11,7 @@ module CustomerServiceIm
11
11
 
12
12
  open_id = result.data[:openid]
13
13
 
14
- user = User.find_by!(open_id: open_id)
14
+ user = User.find_or_create_mp_user(open_id: open_id)
15
15
 
16
16
  render_200 user.as_json.merge({ token: token_user(user), conversation_id: user.conversation_ids.first })
17
17
  end
@@ -71,5 +71,14 @@ module CustomerServiceIm::Concerns::Customer
71
71
  def online_customer_list_in_redis
72
72
  redis.smembers online_customers_redis_key
73
73
  end
74
+
75
+ def find_or_create_mp_user(open_id)
76
+ return if open_id.blank?
77
+
78
+ User.create_with(
79
+ email: "#{SecureRandom.uuid}@mp.com",
80
+ password: Digest::MD5.hexdigest(open_id)
81
+ ).find_or_create_by(open_id: open_id)
82
+ end
74
83
  end
75
84
  end
@@ -1,3 +1,3 @@
1
1
  module CustomerServiceIm
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: customer_service_im
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ian