Merge pull request #134 from ooni/fix/1183
Always include the country code and drop include_probe_cc setting
This commit is contained in:
		
						commit
						203b8fcda6
					
				@ -28,9 +28,8 @@ func TestParseConfig(t *testing.T) {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Error(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if config.Sharing.IncludeCountry == false {
 | 
			
		||||
		t.Error("country should be included")
 | 
			
		||||
	if config.Sharing.IncludeASN == false {
 | 
			
		||||
		t.Error("network should be included")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -61,7 +60,6 @@ func TestUpdateConfig(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
	origIncludeIP := config.Sharing.IncludeIP
 | 
			
		||||
	origIncludeASN := config.Sharing.IncludeASN
 | 
			
		||||
	origIncludeCountry := config.Sharing.IncludeCountry
 | 
			
		||||
	origUploadResults := config.Sharing.UploadResults
 | 
			
		||||
	origInformedConsent := config.InformedConsent
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@ -87,9 +85,6 @@ func TestUpdateConfig(t *testing.T) {
 | 
			
		||||
	if newConfig.Sharing.IncludeASN != origIncludeASN {
 | 
			
		||||
		t.Error("includeASN differs")
 | 
			
		||||
	}
 | 
			
		||||
	if newConfig.Sharing.IncludeCountry != origIncludeCountry {
 | 
			
		||||
		t.Error("includeCountry differs")
 | 
			
		||||
	}
 | 
			
		||||
	if newConfig.Sharing.UploadResults != origUploadResults {
 | 
			
		||||
		t.Error("UploadResults differs")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,6 @@ var websiteCategories = []string{
 | 
			
		||||
type Sharing struct {
 | 
			
		||||
	IncludeIP      bool `json:"include_ip"`
 | 
			
		||||
	IncludeASN     bool `json:"include_asn"`
 | 
			
		||||
	IncludeCountry bool `json:"include_country"`
 | 
			
		||||
	UploadResults  bool `json:"upload_results"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -76,13 +76,11 @@ func Onboarding(config *config.Config) error {
 | 
			
		||||
	settings := struct {
 | 
			
		||||
		IncludeIP        bool
 | 
			
		||||
		IncludeNetwork   bool
 | 
			
		||||
		IncludeCountry   bool
 | 
			
		||||
		UploadResults    bool
 | 
			
		||||
		SendCrashReports bool
 | 
			
		||||
	}{}
 | 
			
		||||
	settings.IncludeIP = false
 | 
			
		||||
	settings.IncludeNetwork = true
 | 
			
		||||
	settings.IncludeCountry = true
 | 
			
		||||
	settings.UploadResults = true
 | 
			
		||||
	settings.SendCrashReports = true
 | 
			
		||||
 | 
			
		||||
@ -99,13 +97,6 @@ func Onboarding(config *config.Config) error {
 | 
			
		||||
					Default: true,
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				Name: "IncludeCountry",
 | 
			
		||||
				Prompt: &survey.Confirm{
 | 
			
		||||
					Message: "Can we include your country name?",
 | 
			
		||||
					Default: true,
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				Name: "UploadResults",
 | 
			
		||||
				Prompt: &survey.Confirm{
 | 
			
		||||
@ -131,7 +122,6 @@ func Onboarding(config *config.Config) error {
 | 
			
		||||
 | 
			
		||||
	config.Lock()
 | 
			
		||||
	config.InformedConsent = true
 | 
			
		||||
	config.Sharing.IncludeCountry = settings.IncludeCountry
 | 
			
		||||
	config.Advanced.SendCrashReports = settings.SendCrashReports
 | 
			
		||||
	config.Sharing.IncludeIP = settings.IncludeIP
 | 
			
		||||
	config.Sharing.IncludeASN = settings.IncludeNetwork
 | 
			
		||||
 | 
			
		||||
@ -116,7 +116,8 @@ func init() {
 | 
			
		||||
		// Make sure we share what the user wants us to share.
 | 
			
		||||
		ctx.Session.SetIncludeProbeIP(ctx.Config.Sharing.IncludeIP)
 | 
			
		||||
		ctx.Session.SetIncludeProbeASN(ctx.Config.Sharing.IncludeASN)
 | 
			
		||||
		ctx.Session.SetIncludeProbeCC(ctx.Config.Sharing.IncludeCountry)
 | 
			
		||||
		// Always include probe_cc
 | 
			
		||||
		ctx.Session.SetIncludeProbeCC(true)
 | 
			
		||||
		return nil
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user