Commit d583ef5ed5cbc8964961ef642e4c4952999d850d
- Date: Thu Apr 17 18:46:05 +0000 2008
- Committer: Johan Sørensen (johan@johansorensen.com)
- Author: Johan Sørensen (johan@johansorensen.com)
- Commit SHA1: d583ef5ed5cbc8964961ef642e4c4952999d850d
- Tree SHA1: 0a265e5e0492209ff0bc49a1bec059bc1dfb9f39
Don't prepend http:// to empty project urls
Commit diff
| |   |
| 1 | 1 | (in no particular order) |
| 2 | 2 | |
| 3 | two from Yurii: |
| 4 | 1) show commits actually merged for merge request after actual merge (I see them on open request, but do not on merged one) |
| 5 | 2) provide clone url on every repo browsing page, so I can get url to pull from even if I am reading a commit |
| 6 | |
| 3 | 7 | * tree browser: deal better with funny characters: http://gitorious.org/projects/avara/repos/mainline/trees/master |
| 4 | 8 | * if you comment on a specific commit, you should get redirected back there |
| 5 | 9 | * graphs should show username (if we have it) for avoiding confusion and for consistency |
| toggle raw diff |
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,5 +1,9 @@
(in no particular order)
+two from Yurii:
+1) show commits actually merged for merge request after actual merge (I see them on open request, but do not on merged one)
+2) provide clone url on every repo browsing page, so I can get url to pull from even if I am reading a commit
+
* tree browser: deal better with funny characters: http://gitorious.org/projects/avara/repos/mainline/trees/master
* if you comment on a specific commit, you should get redirected back there
* graphs should show username (if we have it) for avoiding confusion and for consistency |
| |   |
| 144 | 144 | |
| 145 | 145 | # Try our best to guess the url |
| 146 | 146 | def clean_url(url) |
| 147 | return if url.blank? |
| 147 | 148 | begin |
| 148 | 149 | url = "http://#{url}" if URI.parse(url).class == URI::Generic |
| 149 | 150 | rescue |
| toggle raw diff |
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -144,6 +144,7 @@ class Project < ActiveRecord::Base
# Try our best to guess the url
def clean_url(url)
+ return if url.blank?
begin
url = "http://#{url}" if URI.parse(url).class == URI::Generic
rescue |
| |   |
| 103 | 103 | project.send(attr).should == 'http://blah.com' |
| 104 | 104 | end |
| 105 | 105 | end |
| 106 | |
| 107 | it "should not prepend http:// to empty urls" do |
| 108 | project = projects(:johans) |
| 109 | [ :home_url, :mailinglist_url, :bugtracker_url ].each do |attr| |
| 110 | project.send("#{attr}=", '') |
| 111 | project.send(attr).should be_blank |
| 112 | project.send("#{attr}=", nil) |
| 113 | project.send(attr).should be_blank |
| 114 | end |
| 115 | end |
| 106 | 116 | |
| 107 | 117 | end |
| toggle raw diff |
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -103,5 +103,15 @@ describe Project do
project.send(attr).should == 'http://blah.com'
end
end
+
+ it "should not prepend http:// to empty urls" do
+ project = projects(:johans)
+ [ :home_url, :mailinglist_url, :bugtracker_url ].each do |attr|
+ project.send("#{attr}=", '')
+ project.send(attr).should be_blank
+ project.send("#{attr}=", nil)
+ project.send(attr).should be_blank
+ end
+ end
end |