Skip to content

Commit

Permalink
Add code comments to make sure Rust <> JS "reserved usernames" are mi…
Browse files Browse the repository at this point in the history
…rrored

Summary:
adding comments to help ensure the two lists stay in sync

Note that I could not add comments to the actual reserved_usernames.json file
since comments aren't allowed in JSON notation

Depends on D8481

Test Plan: N/A, just comments

Reviewers: ashoat, jon

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8482
  • Loading branch information
vdhanan committed Jul 12, 2023
1 parent 5aa3c5f commit 8aee89a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/utils/reserved-users.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow

// All entries in this list must be lowercase!!
// All entries in this list must be lowercase and must also be included in
// `services/identity/reserved_usernames.json`!!
const reservedUsernamesSet: $ReadOnlySet<string> = new Set([
// Additional Reserved Keywords
'comm',
Expand Down
2 changes: 2 additions & 0 deletions services/identity/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ fn get_server_setup_from_file<P: AsRef<path::Path>>(
}

fn get_reserved_usernames_set() -> Result<HashSet<String>, Error> {
// All entries in `reserved_usernames.json` must be lowercase and must also be
// included in `lib/utils/reserved-users.js`!!
let contents = include_str!("../reserved_usernames.json");
let reserved_usernames: Vec<String> = serde_json::from_str(contents)?;

Expand Down

0 comments on commit 8aee89a

Please sign in to comment.