whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Better error handling for missing token or data file
Date Fri, 06 Jul 2018 17:35:45 GMT
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 2d7927e  Better error handling for missing token or data file
2d7927e is described below

commit 2d7927e48ee5ccc7674c9d56c406cab946c6185b
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Jul 6 18:35:43 2018 +0100

    Better error handling for missing token or data file
---
 www/project/icla/views/pages/discuss.js.rb | 34 ++++++++++++++++++------------
 www/project/icla/views/pages/vote.js.rb    | 18 +++++++++++-----
 2 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/www/project/icla/views/pages/discuss.js.rb b/www/project/icla/views/pages/discuss.js.rb
index 9ed81fb..b7c60a8 100644
--- a/www/project/icla/views/pages/discuss.js.rb
+++ b/www/project/icla/views/pages/discuss.js.rb
@@ -6,28 +6,36 @@ class Discuss < Vue
 
     # initialize form fields
     @member = Server.data.member
+    @token = Server.data.token
+    @debug = Server.data.debug
     console.log('discuss')
-    console.log('token: ' + Server.data.token)
+    console.log('token: ' + @token)
     console.log('member: ' + @member)
     @progress = Server.data.progress
     console.log('progress: ' + @progress.inspect)
-    @phase = @progress[:phase]
+    if @progress
+      @phase = @progress[:phase]
+    else
+      @phase = 'unknown' # flag
+    end
     console.log('phase: ' + @phase)
-    if @phase == 'error'
+    if not @token
+      @alert = "Token is required for this page"
+    elsif @phase == 'unknown'
+      @alert = "Cannot determine phase: could not read token file"
+    elsif @phase == 'error'
       @alert = @progress[:errorMessage]
     elsif @phase != 'discuss'
       @alert = "Wrong phase: " + @phase + "; should be discuss"
     else
-    @pmc = @progress[:project]
-    @proposer = @progress[:proposer]
-    @contributor = @progress[:contributor]
-    @iclaname = @contributor[:name]
-    @iclaemail = @contributor[:email]
-    @token = Server.data.token
-    @comments = @progress[:comments]
-    @discussBody = ''
-    @subject = @progress[:subject]
-    @debug = Server.data.debug
+      @pmc = @progress[:project]
+      @proposer = @progress[:proposer]
+      @contributor = @progress[:contributor]
+      @iclaname = @contributor[:name]
+      @iclaemail = @contributor[:email]
+      @comments = @progress[:comments]
+      @discussBody = ''
+      @subject = @progress[:subject]
     end
 
   end
diff --git a/www/project/icla/views/pages/vote.js.rb b/www/project/icla/views/pages/vote.js.rb
index c9b643e..50c86cf 100644
--- a/www/project/icla/views/pages/vote.js.rb
+++ b/www/project/icla/views/pages/vote.js.rb
@@ -4,15 +4,25 @@ class Vote < Vue
     @alert = nil
 
     # initialize form fields
+    @token = Server.data.token
     @member = Server.data.member
+    @debug = Server.data.debug
     console.log('vote')
-    console.log('token: ' + Server.data.token)
+    console.log('token: ' + @token)
     console.log('member: ' + @member)
     @progress = Server.data.progress
     console.log('progress: ' + @progress.inspect)
-    @phase = @progress[:phase]
+    if @progress
+      @phase = @progress[:phase]
+    else
+      @phase = 'unknown' # flag
+    end
     console.log('phase: ' + @phase)
-    if @phase == 'error'
+    if not @token
+      @alert = "Token is required for this page"
+    elsif @phase == 'unknown'
+      @alert = "Cannot determine phase: could not read token file"
+    elsif @phase == 'error'
       @alert = @progress[:errorMessage]
     elsif @phase != 'vote'
       @alert = "Wrong phase: " + @phase + "; should be vote"
@@ -23,7 +33,6 @@ class Vote < Vue
       @contributor = @progress[:contributor]
       @iclaname = @contributor[:name]
       @iclaemail = @contributor[:email]
-      @token = Server.data.token
       @comments = @progress[:comments]
       @votes = @progress[:votes]
       @vote = ''
@@ -31,7 +40,6 @@ class Vote < Vue
       @commentBody = ''
       @subject = @progress[:subject]
       @showComment = false;
-      @debug = Server.data.debug
     end
   end
 


Mime
View raw message