From commits-return-1153-archive-asf-public=cust-asf.ponee.io@ponymail.incubator.apache.org Sun Mar 3 16:51:13 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6520D18067C for ; Sun, 3 Mar 2019 17:51:13 +0100 (CET) Received: (qmail 13286 invoked by uid 500); 3 Mar 2019 16:51:12 -0000 Mailing-List: contact commits-help@ponymail.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ponymail.incubator.apache.org Delivered-To: mailing list commits@ponymail.incubator.apache.org Received: (qmail 13266 invoked by uid 99); 3 Mar 2019 16:51:12 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Mar 2019 16:51:12 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 0468387754; Sun, 3 Mar 2019 16:51:12 +0000 (UTC) Date: Sun, 03 Mar 2019 16:51:12 +0000 To: "commits@ponymail.apache.org" Subject: [incubator-ponymail] 01/02: assign to a constant instead of hardcoding inline, find a better func name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: humbedooh@apache.org In-Reply-To: <155163187194.11391.8454303520167119994@gitbox.apache.org> References: <155163187194.11391.8454303520167119994@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-ponymail X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: d1b35b10a02c976ec1389d230aa573f9a040de48 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20190303165112.0468387754@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. humbedooh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git commit d1b35b10a02c976ec1389d230aa573f9a040de48 Author: Daniel Gruno AuthorDate: Sun Mar 3 17:50:46 2019 +0100 assign to a constant instead of hardcoding inline, find a better func name --- site/js/dev/ponymail_assign_vars.js | 1 + site/js/dev/ponymail_helperfuncs.js | 4 ++-- site/js/dev/ponymail_pagebuilder.js | 6 +++--- site/js/dev/ponymail_trends.js | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/site/js/dev/ponymail_assign_vars.js b/site/js/dev/ponymail_assign_vars.js index ef2df5e..1d03dcc 100644 --- a/site/js/dev/ponymail_assign_vars.js +++ b/site/js/dev/ponymail_assign_vars.js @@ -60,6 +60,7 @@ var pending_urls = {} // URL list for GetAsync's support functions (such as the var pb_refresh = 0 var treeview_guard = {} var mbox_month = null +var INVALID_MAGIC_MARKER = "$INVALID" var URL_BASE = pm_config.URLBase ? pm_config.URLBase.replace(/\/+/g, "/") : "" diff --git a/site/js/dev/ponymail_helperfuncs.js b/site/js/dev/ponymail_helperfuncs.js index b6ad259..7f38d44 100644 --- a/site/js/dev/ponymail_helperfuncs.js +++ b/site/js/dev/ponymail_helperfuncs.js @@ -177,9 +177,9 @@ function isArray(obj) { // ML address: only accept valid mailing list IDs -function sanitize_address(val) { +function validate_address(val) { var m = val.match(/^[-@A-Za-z.0-9]+$/); - return m ? m[0] : "INVALID"; + return m ? m[0] : INVALID_MAGIC_STRING; } // Check for slow URLs every 0.1 seconds window.setInterval(checkForSlows, 100) diff --git a/site/js/dev/ponymail_pagebuilder.js b/site/js/dev/ponymail_pagebuilder.js index cda67ca..9a1d4bb 100644 --- a/site/js/dev/ponymail_pagebuilder.js +++ b/site/js/dev/ponymail_pagebuilder.js @@ -393,11 +393,11 @@ function getListInfo(list, xdomain, nopush) { xdomain = list.replace(/^.*?@/, "") } - if (list) list = sanitize_address(list); - if (xdomain) xdomain = sanitize_address(xdomain); + if (list) list = validate_address(list); + if (xdomain) xdomain = validate_address(xdomain); // If invalid address passed, complain and exit - no need to attempt fetching stats - if (list == 'INVALID' || xdomain == 'INVALID') { + if (list == INVALID_MAGIC_STRING || xdomain == INVALID_MAGIC_STRING) { alert("Invalid mailing list address supplied!"); return } diff --git a/site/js/dev/ponymail_trends.js b/site/js/dev/ponymail_trends.js index eeec976..7de7668 100644 --- a/site/js/dev/ponymail_trends.js +++ b/site/js/dev/ponymail_trends.js @@ -287,8 +287,8 @@ function gatherTrends() { var dspan = a_arr[1] var query = a_arr[2] - list = sanitize_address(list); - if (list == 'INVALID') { + list = validate_address(list); + if (list == INVALID_MAGIC_STRING) { alert("Invalid mailing list address supplied!"); return }