You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/12/06 02:31:36 UTC
incubator-ponymail git commit: Fix up indentation
Repository: incubator-ponymail
Updated Branches:
refs/heads/master 98cf3e627 -> 5f2c7d6ef
Fix up indentation
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/5f2c7d6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/5f2c7d6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/5f2c7d6e
Branch: refs/heads/master
Commit: 5f2c7d6ef239f3fc480acea6d6897a8647ac1771
Parents: 98cf3e6
Author: Sebb <se...@apache.org>
Authored: Tue Dec 6 02:31:21 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Tue Dec 6 02:31:21 2016 +0000
----------------------------------------------------------------------
site/api/atom.lua | 25 ++++++++++++-------------
site/api/pminfo.lua | 40 +++++++++++++++-------------------------
site/api/preferences.lua | 40 ++++++++++++++++++++--------------------
site/api/static.lua | 10 +++++-----
site/api/stats.lua | 24 ++++++++++++------------
5 files changed, 64 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5f2c7d6e/site/api/atom.lua
----------------------------------------------------------------------
diff --git a/site/api/atom.lua b/site/api/atom.lua
index bcba51b..56df8be 100644
--- a/site/api/atom.lua
+++ b/site/api/atom.lua
@@ -54,13 +54,13 @@ function handle(r)
local now = r:clock()
local tnow = now
local get = r:parseargs()
-
+
-- make sure we have a list or a thread to display results from
if not get.list and not get.mid then
r:puts("<>")
return cross.OK
end
-
+
-- default to any subject/body, 30 day view
-- but accept whatever the browser demands
local qs = "*"
@@ -70,18 +70,17 @@ function handle(r)
local rights = nil
local listid = r:escape_html(get.list or "")
local listraw = "<" .. listid:gsub("@", ".") .. ">"
-
+
-- search terms for ES
local sterm = {
term = {
list_raw = listraw
}
}
-
-
+
local emls = {}
emls_thrd = {}
-
+
-- Get threads from list ID?
if get.list then
local threads = {}
@@ -106,20 +105,20 @@ function handle(r)
}
}
}
- }}
+ }
+ }
},
-
sort = {
{
epoch = {
order = "desc"
}
- }
+ }
},
size = maxresults
}
local h = #doc.hits.hits
-
+
-- for each email found, check if we can access it and then digest it if so
for k = #doc.hits.hits, 1, -1 do
local v = doc.hits.hits[k]
@@ -152,7 +151,7 @@ function handle(r)
table.insert(emls, 1, email)
end
end
-
+
-- Or get a thread?
elseif get.mid then
-- get the parent email
@@ -160,7 +159,7 @@ function handle(r)
if doc then
-- make sure we have the real parent
local parent = findParent(r, doc, elastic)
-
+
-- we got the original email, now let's find and process all kids
if parent then
table.insert(emls_thrd, parent)
@@ -190,7 +189,7 @@ function handle(r)
end
end
end
-
+
-- Generate the XML
local scheme = "https"
if r.port == 80 then
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5f2c7d6e/site/api/pminfo.lua
----------------------------------------------------------------------
diff --git a/site/api/pminfo.lua b/site/api/pminfo.lua
index 425358e..ad0c3eb 100644
--- a/site/api/pminfo.lua
+++ b/site/api/pminfo.lua
@@ -53,16 +53,15 @@ function handle(r)
local daterange = {gt = "now-"..DD.."d", lt = "now+1d" }
local sterm = {
- wildcard = {
- list = "*." .. domain
- }
- }
+ wildcard = {
+ list = "*." .. domain
+ }
+ }
--[[ Get active lists ]]--
local doc = elastic.raw {
size = 0, -- we don't need the hits themselves
query = {
-
bool = {
must = {
{
@@ -75,9 +74,8 @@ function handle(r)
}
},
sterm
-
- }}
-
+ }
+ }
},
aggs = {
from = {
@@ -106,7 +104,6 @@ function handle(r)
local doc = elastic.raw {
size = 0,
query = {
-
bool = {
must = {
{
@@ -118,9 +115,8 @@ function handle(r)
private = false
}
},sterm
-
- }}
-
+ }
+ }
},
aggs = {
from = {
@@ -146,9 +142,7 @@ function handle(r)
}
}
},
-
query = {
-
bool = {
must = {
{
@@ -160,9 +154,8 @@ function handle(r)
private = false
}
},sterm
-
- }}
-
+ }
+ }
}
}
local activity = {}
@@ -181,9 +174,7 @@ function handle(r)
}
}
},
-
query = {
-
bool = {
must = {
{
@@ -195,9 +186,8 @@ function handle(r)
private = false
}
},sterm
-
- }}
-
+ }
+ }
}
}
local active_senders = {}
@@ -248,15 +238,15 @@ function handle(r)
private = false
}
},sterm
- }}
+ }
+ }
},
-
sort = {
{
date = {
order = "desc"
}
- }
+ }
},
size = MAXRESULTS
}
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5f2c7d6e/site/api/preferences.lua
----------------------------------------------------------------------
diff --git a/site/api/preferences.lua b/site/api/preferences.lua
index d14a9df..510170c 100644
--- a/site/api/preferences.lua
+++ b/site/api/preferences.lua
@@ -276,32 +276,32 @@ Pony Mail - Email for Ponies and People.
pdoc = JSON.decode(cache)
else
pdoc = elastic.raw {
- size = 0, -- we don't need the hits themselves
- aggs = {
- from = {
- terms = {
- field = "list_raw",
- size = 500000
+ size = 0, -- we don't need the hits themselves
+ aggs = {
+ from = {
+ terms = {
+ field = "list_raw",
+ size = 500000
+ }
}
- }
- },
- query = {
- bool = {
- must = {
- {
- range = {
- date = { gte = "now-20y" }
- },
- },
- {
- term = {
- private = true
+ },
+ query = {
+ bool = {
+ must = {
+ {
+ range = {
+ date = { gte = "now-20y" }
+ },
+ },
+ {
+ term = {
+ private = true
+ }
}
}
}
}
}
- }
r:ivm_set("pm_lists_cache_private_" ..r.hostname .."-" .. nowish, JSON.encode(pdoc))
end
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5f2c7d6e/site/api/static.lua
----------------------------------------------------------------------
diff --git a/site/api/static.lua b/site/api/static.lua
index 12316db..3a05d07 100644
--- a/site/api/static.lua
+++ b/site/api/static.lua
@@ -109,19 +109,19 @@ function handle(r)
}
},
{
- term = {
- list_raw = ("<%s>"):format(listid)
+ term = {
+ list_raw = ("<%s>"):format(listid)
+ }
}
}
- }}
+ }
},
-
sort = {
{
epoch = {
order = "desc"
}
- }
+ }
},
size = 1000
}
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5f2c7d6e/site/api/stats.lua
----------------------------------------------------------------------
diff --git a/site/api/stats.lua b/site/api/stats.lua
index 9d2d2cd..5202e22 100644
--- a/site/api/stats.lua
+++ b/site/api/stats.lua
@@ -235,25 +235,25 @@ function handle(r)
end
local wc = false
local sterm = {
- term = {
- list_raw = listraw
- }
- }
+ term = {
+ list_raw = listraw
+ }
+ }
if get.list == "*" then
wc = true
sterm = {
- wildcard = {
- list = "*." .. get.domain
- }
- }
+ wildcard = {
+ list = "*." .. get.domain
+ }
+ }
end
if get.domain == "*" then
wc = true
sterm = {
- wildcard = {
- list = "*"
- }
- }
+ wildcard = {
+ list = "*"
+ }
+ }
end
local top10 = {}