You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Brett Porter <br...@apache.org> on 2016/03/21 21:32:15 UTC

[whimsy.git] [1/1] Commit c061fed: retain other markers in proxy form

Commit c061fed7fb2bc3b0df122115363da9b494160a82:
    retain other markers in proxy form
    Instead of building the list from files, then attempting to add back text,
    retain the original text but add any files that were not found based on the
    user ID


Branch: refs/heads/proxy-form
Author: Brett Porter <br...@safetyculture.io>
Committer: Brett Porter <br...@safetyculture.io>
Pusher: brett <br...@apache.org>

------------------------------------------------------------
www/members/proxy.cgi                                        | ++++++ --
------------------------------------------------------------
8 changes: 6 additions, 2 deletions.
------------------------------------------------------------


diff --git a/www/members/proxy.cgi b/www/members/proxy.cgi
index 82440e1..29644d3 100755
--- a/www/members/proxy.cgi
+++ b/www/members/proxy.cgi
@@ -161,9 +161,13 @@ _html do
 
             # update proxies file
             proxies = IO.read('proxies')
-            list += proxies.scan(/   \S.*\(\S+\)$/).
-              select {|line| nontext.include? line[/\((\S+)\)$/, 1]}
+            existing = proxies.scan(/   \S.*\(\S+\).*$/)
+            existing_ids = existing.map {|line| line[/\((\S+)\)/, 1] }
+            added = list.
+              reject {|line| existing_ids.include? line[/\((\S+)\)$/, 1]}
+            list = added + existing
             proxies[/.*-\n(.*)/m, 1] = list.flatten.sort.join("\n") + "\n"
+
             IO.write('proxies', proxies)
 
             # commit