ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject incubator-ponymail git commit: No need to encode the JSON here; the elastic module does it
Date Tue, 17 Jan 2017 15:06:19 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 993e6b61c -> c5a83ecc0


No need to encode the JSON here; the elastic module does it

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/c5a83ecc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/c5a83ecc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/c5a83ecc

Branch: refs/heads/master
Commit: c5a83ecc0959a7456c0c76534f2affc5d32d7d81
Parents: 993e6b6
Author: Sebb <sebb@apache.org>
Authored: Tue Jan 17 15:05:51 2017 +0000
Committer: Sebb <sebb@apache.org>
Committed: Tue Jan 17 15:05:51 2017 +0000

----------------------------------------------------------------------
 site/api/lib/user.lua | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/c5a83ecc/site/api/lib/user.lua
----------------------------------------------------------------------
diff --git a/site/api/lib/user.lua b/site/api/lib/user.lua
index 2f2d4c2..9208003 100644
--- a/site/api/lib/user.lua
+++ b/site/api/lib/user.lua
@@ -14,7 +14,7 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 ]]--
-local JSON = require 'cjson'
+
 local elastic = require 'lib/elastic'
 
 -- Get user data from DB
@@ -62,7 +62,7 @@ local function updateUser(r, cid, data)
         prefs = oaccount.preferences
         favs = oaccount.favorites
     end
-    elastic.index(r:sha1(cid), 'account', JSON.encode{
+    elastic.index(r:sha1(cid), 'account', {
         credentials = {
             uid = data.uid,
             email = data.email,
@@ -92,7 +92,7 @@ local function logoutUser(r, usr)
     if usr and usr.cid then
         local js = elastic.get('account', r:sha1(usr.cid))
         js.internal.cookie = 'nil'
-        elastic.index(r:sha1(usr.cid), 'account', JSON.encode(js))
+        elastic.index(r:sha1(usr.cid), 'account', js)
     end
     r:setcookie{
         key = "ponymail",
@@ -110,7 +110,7 @@ local function savePreferences(r, usr, alts)
         if alts then
             js.credentials.altemail = usr.credentials.altemail
         end
-        elastic.index(r:sha1(usr.cid), 'account', JSON.encode(js))
+        elastic.index(r:sha1(usr.cid), 'account', js)
     end
 end
 
@@ -119,7 +119,7 @@ local function saveFavorites(r, usr)
     if usr and usr.cid then
         local js = elastic.get('account', r:sha1(usr.cid))
         js.favorites = usr.favorites
-        elastic.index(r:sha1(usr.cid), 'account', JSON.encode(js))
+        elastic.index(r:sha1(usr.cid), 'account', js)
     end
 end
 


Mime
View raw message