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 <[email protected]>
Committer: Brett Porter <[email protected]>
Pusher: brett <[email protected]>

------------------------------------------------------------
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

Reply via email to