You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2019/03/24 23:03:59 UTC
[whimsy] branch master updated: Better handling of non-existent alt
emails
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 6454b1b Better handling of non-existent alt emails
6454b1b is described below
commit 6454b1b39064ad217fab1c02c05729a49ed9679e
Author: Sebb <se...@apache.org>
AuthorDate: Sun Mar 24 23:03:14 2019 +0000
Better handling of non-existent alt emails
---
www/roster/views/actions/email_alt.json.rb | 2 +-
www/roster/views/person/email_alt.js.rb | 12 +++++++++---
www/roster/views/person/main.js.rb | 11 ++++-------
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/www/roster/views/actions/email_alt.json.rb b/www/roster/views/actions/email_alt.json.rb
index dd957fa..37ca081 100644
--- a/www/roster/views/actions/email_alt.json.rb
+++ b/www/roster/views/actions/email_alt.json.rb
@@ -5,7 +5,7 @@
person = ASF::Person.find(@userid)
# report the previous value in the response
-_previous alt_email: person.attrs['asf-altEmail']
+_previous alt_email: person.alt_email # returns empty array if not defined
if @email_alt # must agree with email_alt.js.rb
diff --git a/www/roster/views/person/email_alt.js.rb b/www/roster/views/person/email_alt.js.rb
index b0613c7..f8f5d71 100644
--- a/www/roster/views/person/email_alt.js.rb
+++ b/www/roster/views/person/email_alt.js.rb
@@ -32,9 +32,15 @@ class PersonEmailAlt < Vue
else
- _ul committer.email_alt do |mail|
- _li do
- _a mail, href: 'mailto:' + mail
+ if committer.email_alt.length == 0
+ _ul do
+ _li '(none defined)'
+ end
+ else
+ _ul committer.email_alt do |mail|
+ _li do
+ _a mail, href: 'mailto:' + mail
+ end
end
end
end
diff --git a/www/roster/views/person/main.js.rb b/www/roster/views/person/main.js.rb
index 2cfc593..8ff2b4c 100644
--- a/www/roster/views/person/main.js.rb
+++ b/www/roster/views/person/main.js.rb
@@ -161,14 +161,11 @@ class Person < Vue
end
# Email addresses
- if @committer.email_forward # I expect this is always true
- _PersonEmailForwards person: self, edit: @edit
- end
+ # always present
+ _PersonEmailForwards person: self, edit: @edit
- if @committer.email_alt|| @auth
- @committer.email_alt ||= ['<none defined>']
- _PersonEmailAlt person: self, edit: @edit
- end
+ # always present (even if an empty array)
+ _PersonEmailAlt person: self, edit: @edit
if @committer.email_other
_PersonEmailOther person: self # not editable