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/07/19 21:02:28 UTC

[whimsy] branch master updated: WHIMSY-278 - detect stale workspace data

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 a7760c5  WHIMSY-278 - detect stale workspace data
a7760c5 is described below

commit a7760c5aefdb45e9b8b4ab5d08633fed25f192fe
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jul 19 22:02:24 2019 +0100

    WHIMSY-278 - detect stale workspace data
---
 www/roster/views/actions/memstat.json.rb | 4 +++-
 www/roster/views/actions/memtext.json.rb | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/www/roster/views/actions/memstat.json.rb b/www/roster/views/actions/memstat.json.rb
index 297ce1a..ccb57e6 100644
--- a/www/roster/views/actions/memstat.json.rb
+++ b/www/roster/views/actions/memstat.json.rb
@@ -11,7 +11,9 @@ message = "Move #{ASF::Person.find(@userid).member_name} to #{@action}"
 # update members.txt
 _svn.update members_txt, message: message do |dir, text|
   # remove user's entry
-  text.sub! entry, ''
+  unless text.sub! entry, '' # e.g. if the workspace was out of date
+    raise Exception.new("Failed to remove existing entry -- try refreshing")
+  end
 
   # determine where to put the entry
   if @action == 'emeritus'
diff --git a/www/roster/views/actions/memtext.json.rb b/www/roster/views/actions/memtext.json.rb
index 37374a5..fcacefd 100644
--- a/www/roster/views/actions/memtext.json.rb
+++ b/www/roster/views/actions/memtext.json.rb
@@ -11,7 +11,9 @@ message = "Update entry for #{ASF::Person.find(@userid).member_name}"
 # update members.txt
 _svn.update members_txt, message: message do |dir, text|
   # replace entry
-  text.sub! entry, " *) #{@entry.strip}\n\n"
+  unless text.sub! entry, " *) #{@entry.strip}\n\n" # e.g. if the workspace was out of date
+    raise Exception.new("Failed to replace existing entry -- try refreshing")
+  end
 
   # save the updated text
   ASF::Member.text = text