Skip to content

Commit 88622e4

Browse files
Merge #1536
1536: Rename documentation blacklist to blocklist r=sgrif a=carols10cents Co-authored-by: Carol (Nichols || Goulding) <[email protected]>
2 parents 1a504fd + 67ae866 commit 88622e4

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/models/krate.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ use views::{EncodableCrate, EncodableCrateLinks};
1919
use models::helpers::with_count::*;
2020
use schema::*;
2121

22-
/// Hosts in this blacklist are known to not be hosting documentation,
22+
/// Hosts in this list are known to not be hosting documentation,
2323
/// and are possibly of malicious intent e.g. ad tracking networks, etc.
24-
const DOCUMENTATION_BLACKLIST: [&str; 1] = ["rust-ci.org"];
24+
const DOCUMENTATION_BLOCKLIST: [&str; 1] = ["rust-ci.org"];
2525

2626
#[derive(Debug, Insertable, Queryable, Identifiable, Associations, AsChangeset, Clone, Copy)]
2727
#[belongs_to(Crate)]
@@ -330,7 +330,7 @@ impl Crate {
330330
let keyword_ids = keywords.map(|kws| kws.iter().map(|kw| kw.keyword.clone()).collect());
331331
let category_ids = categories.map(|cats| cats.iter().map(|cat| cat.slug.clone()).collect());
332332
let badges = badges.map(|bs| bs.into_iter().map(|b| b.encodable()).collect());
333-
let documentation = Crate::remove_blacklisted_documentation_urls(documentation);
333+
let documentation = Crate::remove_blocked_documentation_urls(documentation);
334334

335335
EncodableCrate {
336336
id: name.clone(),
@@ -360,8 +360,8 @@ impl Crate {
360360
}
361361
}
362362

363-
/// Return `None` if the documentation URL host matches a blacklisted host
364-
fn remove_blacklisted_documentation_urls(url: Option<String>) -> Option<String> {
363+
/// Return `None` if the documentation URL host matches a blocked host
364+
fn remove_blocked_documentation_urls(url: Option<String>) -> Option<String> {
365365
// Handles if documentation URL is None
366366
let url = match url {
367367
Some(url) => url,
@@ -380,8 +380,8 @@ impl Crate {
380380
None => return None,
381381
};
382382

383-
// Match documentation URL host against blacklisted host array elements
384-
if DOCUMENTATION_BLACKLIST.contains(&url_host) {
383+
// Match documentation URL host against blocked host array elements
384+
if DOCUMENTATION_BLOCKLIST.contains(&url_host) {
385385
None
386386
} else {
387387
Some(url)
@@ -520,32 +520,32 @@ mod tests {
520520
use models::Crate;
521521

522522
#[test]
523-
fn documentation_blacklist_no_url_provided() {
524-
assert_eq!(Crate::remove_blacklisted_documentation_urls(None), None);
523+
fn documentation_blocked_no_url_provided() {
524+
assert_eq!(Crate::remove_blocked_documentation_urls(None), None);
525525
}
526526

527527
#[test]
528-
fn documentation_blacklist_invalid_url() {
528+
fn documentation_blocked_invalid_url() {
529529
assert_eq!(
530-
Crate::remove_blacklisted_documentation_urls(Some(String::from("not a url"))),
530+
Crate::remove_blocked_documentation_urls(Some(String::from("not a url"))),
531531
None
532532
);
533533
}
534534

535535
#[test]
536-
fn documentation_blacklist_url_contains_partial_match() {
536+
fn documentation_blocked_url_contains_partial_match() {
537537
assert_eq!(
538-
Crate::remove_blacklisted_documentation_urls(Some(String::from(
538+
Crate::remove_blocked_documentation_urls(Some(String::from(
539539
"http://rust-ci.organists.com"
540540
)),),
541541
Some(String::from("http://rust-ci.organists.com"))
542542
);
543543
}
544544

545545
#[test]
546-
fn documentation_blacklist_blacklisted_url() {
546+
fn documentation_blocked_url() {
547547
assert_eq!(
548-
Crate::remove_blacklisted_documentation_urls(Some(String::from(
548+
Crate::remove_blocked_documentation_urls(Some(String::from(
549549
"http://rust-ci.org/crate/crate-0.1/doc/crate-0.1",
550550
),),),
551551
None

src/tests/krate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ fn test_default_sort_recent() {
22612261
}
22622262

22632263
#[test]
2264-
fn block_blacklisted_documentation_url() {
2264+
fn block_bad_documentation_url() {
22652265
let (_b, app, middle) = app();
22662266

22672267
let _ = {

0 commit comments

Comments
 (0)