You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/08 21:00:43 UTC

[incubator-ponymail-foal] branch master updated: If no author name, default to the email address if present

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-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 44ae405  If no author name, default to the email address if present
44ae405 is described below

commit 44ae4057ae9dabd03f66a03dbea8c5365e5b90fa
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 23:00:29 2020 +0200

    If no author name, default to the email address if present
---
 webui/js/ponymail.js                 | 8 ++++++--
 webui/js/source/listview-flat.js     | 3 ++-
 webui/js/source/listview-threaded.js | 3 ++-
 webui/js/source/render-email.js      | 2 ++
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index 09fc113..2d380e2 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -1958,7 +1958,8 @@ function listview_flat_element(eml, idx) {
     
     // Add author
     let authorName = eml.from.replace(/\s*<.+>/, "").replace(/"/g, '');
-    if (authorName.length == 0) authorName = "(No author?)";
+    let authorEmail = eml.from.match(/\s*<(.+@.+)>\s*/);
+    if (authorName.length == 0) authorName = authorEmail ? authorEmail[1] : "(No author?)";
     let author = new HTML('span', { class: "listview_email_author"}, authorName);
     element.inject(author);
     
@@ -2354,7 +2355,8 @@ function listview_threaded_element(thread, idx) {
     
     // Add author
     let authorName = eml.from.replace(/\s*<.+>/, "").replace(/"/g, '');
-    if (authorName.length == 0) authorName = "(No author?)";
+    let authorEmail = eml.from.match(/\s*<(.+@.+)>\s*/);
+    if (authorName.length == 0) authorName = authorEmail ? authorEmail[1] : "(No author?)";
     let author = new HTML('span', { class: "listview_email_author"}, authorName);
     element.inject(author);
     
@@ -2824,6 +2826,8 @@ async function render_email_chatty(state, json) {
     let author_field = new HTML('div', {class: 'chatty_author'});
     let gravatar = new HTML('img', { class:"chatty_gravatar", src: "https://secure.gravatar.com/avatar/%s.jpg?s=96&r=g&d=mm".format(json.gravatar)});
     let author_name = json.from.replace(/\s*<.+>/, "").replace(/"/g, '');
+    let author_email = json.from.match(/\s*<(.+@.+)>\s*/);
+    if (author_name.length == 0) author_name = author_email ? author_email[1] : "(No author?)";
     let author_nametag = new HTML('div', {class: 'chatty_author_name'}, [
                                   new HTML('b', {}, author_name),
                                   " - %s".format(ldate)
diff --git a/webui/js/source/listview-flat.js b/webui/js/source/listview-flat.js
index eceb351..dfe9030 100644
--- a/webui/js/source/listview-flat.js
+++ b/webui/js/source/listview-flat.js
@@ -70,7 +70,8 @@ function listview_flat_element(eml, idx) {
     
     // Add author
     let authorName = eml.from.replace(/\s*<.+>/, "").replace(/"/g, '');
-    if (authorName.length == 0) authorName = "(No author?)";
+    let authorEmail = eml.from.match(/\s*<(.+@.+)>\s*/);
+    if (authorName.length == 0) authorName = authorEmail ? authorEmail[1] : "(No author?)";
     let author = new HTML('span', { class: "listview_email_author"}, authorName);
     element.inject(author);
     
diff --git a/webui/js/source/listview-threaded.js b/webui/js/source/listview-threaded.js
index 0306b2e..691d27f 100644
--- a/webui/js/source/listview-threaded.js
+++ b/webui/js/source/listview-threaded.js
@@ -114,7 +114,8 @@ function listview_threaded_element(thread, idx) {
     
     // Add author
     let authorName = eml.from.replace(/\s*<.+>/, "").replace(/"/g, '');
-    if (authorName.length == 0) authorName = "(No author?)";
+    let authorEmail = eml.from.match(/\s*<(.+@.+)>\s*/);
+    if (authorName.length == 0) authorName = authorEmail ? authorEmail[1] : "(No author?)";
     let author = new HTML('span', { class: "listview_email_author"}, authorName);
     element.inject(author);
     
diff --git a/webui/js/source/render-email.js b/webui/js/source/render-email.js
index b1b9c3f..17b39f6 100644
--- a/webui/js/source/render-email.js
+++ b/webui/js/source/render-email.js
@@ -115,6 +115,8 @@ async function render_email_chatty(state, json) {
     let author_field = new HTML('div', {class: 'chatty_author'});
     let gravatar = new HTML('img', { class:"chatty_gravatar", src: "https://secure.gravatar.com/avatar/%s.jpg?s=96&r=g&d=mm".format(json.gravatar)});
     let author_name = json.from.replace(/\s*<.+>/, "").replace(/"/g, '');
+    let author_email = json.from.match(/\s*<(.+@.+)>\s*/);
+    if (author_name.length == 0) author_name = author_email ? author_email[1] : "(No author?)";
     let author_nametag = new HTML('div', {class: 'chatty_author_name'}, [
                                   new HTML('b', {}, author_name),
                                   " - %s".format(ldate)