fix: Enforce lowercase usernames for profile queries
This commit is contained in:
committed by
mrugesh mohapatra
parent
92208f7c23
commit
c8f5b20b71
@ -25,10 +25,10 @@ const propTypes = {
|
|||||||
showLoading: PropTypes.bool
|
showLoading: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
const createRequestedUserSelector = () => (state, { maybeUser }) =>
|
const createRequestedUserSelector = () => (state, { maybeUser = '' }) =>
|
||||||
userByNameSelector(maybeUser)(state);
|
userByNameSelector(maybeUser.toLowerCase())(state);
|
||||||
const createIsSessionUserSelector = () => (state, { maybeUser }) =>
|
const createIsSessionUserSelector = () => (state, { maybeUser = '' }) =>
|
||||||
maybeUser === usernameSelector(state);
|
maybeUser.toLowerCase() === usernameSelector(state);
|
||||||
|
|
||||||
const makeMapStateToProps = () => (state, props) => {
|
const makeMapStateToProps = () => (state, props) => {
|
||||||
const requestedUserSelector = createRequestedUserSelector();
|
const requestedUserSelector = createRequestedUserSelector();
|
||||||
|
@ -27,9 +27,10 @@ function* fetchSessionUser() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function* fetchOtherUser({ payload: maybeUser }) {
|
function* fetchOtherUser({ payload: maybeUser = '' }) {
|
||||||
try {
|
try {
|
||||||
const { data } = yield call(getUserProfile, maybeUser);
|
const maybeUserLC = maybeUser.toLowerCase();
|
||||||
|
const { data } = yield call(getUserProfile, maybeUserLC);
|
||||||
|
|
||||||
const { entities: { user = {} } = {}, result = '' } = data;
|
const { entities: { user = {} } = {}, result = '' } = data;
|
||||||
const otherUser = user[result] || {};
|
const otherUser = user[result] || {};
|
||||||
|
@ -44,7 +44,7 @@ MongoClient.connect(MONGOHQ_URL, { useNewUrlParser: true }, function(
|
|||||||
progressTimestamps: [],
|
progressTimestamps: [],
|
||||||
isBanned: false,
|
isBanned: false,
|
||||||
isCheater: false,
|
isCheater: false,
|
||||||
username: 'DevelopmentUser',
|
username: 'developmentuser',
|
||||||
about: '',
|
about: '',
|
||||||
name: 'Development User',
|
name: 'Development User',
|
||||||
location: '',
|
location: '',
|
||||||
|
Reference in New Issue
Block a user