whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject [whimsy.git] [1/1] Commit c061fed: retain other markers in proxy form
Date Mon, 21 Mar 2016 20:32:15 GMT
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 <brett.porter@safetyculture.io>
Committer: Brett Porter <brett.porter@safetyculture.io>
Pusher: brett <brett@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

Mime
View raw message