diff --git a/keyserver/src/fetchers/user-fetchers.js b/keyserver/src/fetchers/user-fetchers.js --- a/keyserver/src/fetchers/user-fetchers.js +++ b/keyserver/src/fetchers/user-fetchers.js @@ -31,7 +31,7 @@ } const query = SQL` - SELECT id, username, avatar, FROM users WHERE id IN (${userIDs}) + SELECT id, username FROM users WHERE id IN (${userIDs}) `; const [result] = await dbQuery(query); @@ -41,7 +41,6 @@ userInfos[id] = { id, username: row.username, - avatar: row.avatar, }; } for (const userID of userIDs) { @@ -49,7 +48,6 @@ userInfos[userID] = { id: userID, username: null, - avatar: null, }; } } @@ -69,9 +67,8 @@ } const query = SQL` - SELECT ru.user1, ru.user2, u.username, u.avatar, - ru.status AS undirected_status, rd1.status AS user1_directed_status, - rd2.status AS user2_directed_status + SELECT ru.user1, ru.user2, u.username, ru.status AS undirected_status, + rd1.status AS user1_directed_status, rd2.status AS user2_directed_status FROM relationships_undirected ru LEFT JOIN relationships_directed rd1 ON rd1.user1 = ru.user1 AND rd1.user2 = ru.user2 @@ -91,7 +88,7 @@ `); } query.append(SQL` - UNION SELECT id AS user1, NULL AS user2, username, avatar, + UNION SELECT id AS user1, NULL AS user2, username, CAST(NULL AS UNSIGNED) AS undirected_status, CAST(NULL AS UNSIGNED) AS user1_directed_status, CAST(NULL AS UNSIGNED) AS user2_directed_status @@ -108,7 +105,6 @@ const userInfo = { id, username: row.username, - avatar: row.avatar, }; if (!user2) { diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js --- a/keyserver/src/push/send.js +++ b/keyserver/src/push/send.js @@ -140,7 +140,6 @@ const updateBadge = threadInfo.currentUser.subscription.home; const displayBanner = threadInfo.currentUser.subscription.pushNotifs; const username = userInfos[userID] && userInfos[userID].username; - const avatar = userInfos[userID] && userInfos[userID].avatar; const userWasMentioned = username && threadInfo.currentUser.role && @@ -160,7 +159,7 @@ } const badgeOnly = !displayBanner && !userWasMentioned; - const notifTargetUserInfo = { id: userID, username, avatar }; + const notifTargetUserInfo = { id: userID, username }; const notifTexts = await notifTextsForMessageInfo( allMessageInfos, threadInfo, diff --git a/keyserver/src/search/users.js b/keyserver/src/search/users.js --- a/keyserver/src/search/users.js +++ b/keyserver/src/search/users.js @@ -8,7 +8,7 @@ async function searchForUsers( query: UserSearchRequest, ): Promise { - const sqlQuery = SQL`SELECT id, username, avatar FROM users `; + const sqlQuery = SQL`SELECT id, username FROM users `; const prefix = query.prefix; if (prefix) { sqlQuery.append(SQL`WHERE LOWER(username) LIKE LOWER(${prefix + '%'}) `); @@ -22,7 +22,6 @@ userInfos.push({ id: row.id.toString(), username: row.username, - avatar: row.avatar, }); } return userInfos; diff --git a/keyserver/src/socket/session-utils.js b/keyserver/src/socket/session-utils.js --- a/keyserver/src/socket/session-utils.js +++ b/keyserver/src/socket/session-utils.js @@ -571,8 +571,8 @@ for (const userID in fetchedUserInfos) { const userInfo = fetchedUserInfos[userID]; if (userInfo && userInfo.username) { - const { id, username, avatar } = userInfo; - userInfos.push({ id, username, avatar }); + const { id, username } = userInfo; + userInfos.push({ id, username }); } } } diff --git a/lib/selectors/relationship-selectors.js b/lib/selectors/relationship-selectors.js --- a/lib/selectors/relationship-selectors.js +++ b/lib/selectors/relationship-selectors.js @@ -19,7 +19,7 @@ const blocked = []; for (const userID in userInfos) { const userInfo = userInfos[userID]; - const { id, username, avatar, relationshipStatus } = userInfo; + const { id, username, relationshipStatus } = userInfo; if (!username) { continue; } @@ -27,19 +27,14 @@ relationshipStatus === userRelationshipStatus.REQUEST_RECEIVED || relationshipStatus === userRelationshipStatus.REQUEST_SENT ) { - unorderedFriendRequests.push({ - id, - username, - avatar, - relationshipStatus, - }); + unorderedFriendRequests.push({ id, username, relationshipStatus }); } else if (relationshipStatus === userRelationshipStatus.FRIEND) { - unorderedFriends.push({ id, username, avatar, relationshipStatus }); + unorderedFriends.push({ id, username, relationshipStatus }); } else if ( relationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER || relationshipStatus === userRelationshipStatus.BOTH_BLOCKED ) { - blocked.push({ id, username, avatar, relationshipStatus }); + blocked.push({ id, username, relationshipStatus }); } } const friendRequests = _orderBy('relationshipStatus')('desc')( diff --git a/lib/selectors/user-selectors.js b/lib/selectors/user-selectors.js --- a/lib/selectors/user-selectors.js +++ b/lib/selectors/user-selectors.js @@ -31,20 +31,16 @@ const relativeUserInfos = []; for (const userID of userIDs) { const username = userInfos[userID] ? userInfos[userID].username : null; - const avatar = userInfos[userID].avatar ? userInfos[userID].avatar : null; - if (userID === viewerID) { relativeUserInfos.unshift({ id: userID, username, - avatar, isViewer: true, }); } else { relativeUserInfos.push({ id: userID, username, - avatar, isViewer: false, }); } @@ -72,17 +68,12 @@ const username = userInfos[memberInfo.id] ? userInfos[memberInfo.id].username : null; - const avatar = userInfos[memberInfo.id] - ? userInfos[memberInfo.id].avatar - : null; - if (memberInfo.id === currentUserID) { relativeMemberInfos.unshift({ id: memberInfo.id, role: memberInfo.role, permissions: memberInfo.permissions, username, - avatar, isViewer: true, isSender: memberInfo.isSender, }); @@ -92,7 +83,6 @@ role: memberInfo.role, permissions: memberInfo.permissions, username, - avatar, isViewer: false, isSender: memberInfo.isSender, }); @@ -135,7 +125,7 @@ const availableUsers: { [id: string]: AccountUserInfo } = {}; for (const id in userInfos) { - const { username, avatar, relationshipStatus } = userInfos[id]; + const { username, relationshipStatus } = userInfos[id]; if (id === currentUserID || !username) { continue; } @@ -143,7 +133,7 @@ relationshipStatus !== userRelationshipStatus.BLOCKED_VIEWER && relationshipStatus !== userRelationshipStatus.BOTH_BLOCKED ) { - availableUsers[id] = { id, username, avatar, relationshipStatus }; + availableUsers[id] = { id, username, relationshipStatus }; } } return availableUsers; diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js --- a/lib/shared/message-utils.js +++ b/lib/shared/message-utils.js @@ -84,7 +84,6 @@ id: rawMessageInfo.creatorID, username: creatorInfo ? creatorInfo.username : 'anonymous', isViewer: rawMessageInfo.creatorID === viewerID, - avatar: creatorInfo.avatar ? creatorInfo.avatar : null, }; const createRelativeUserInfos = (userIDs: $ReadOnlyArray) => diff --git a/lib/shared/reaction-utils.test.js b/lib/shared/reaction-utils.test.js --- a/lib/shared/reaction-utils.test.js +++ b/lib/shared/reaction-utils.test.js @@ -9,9 +9,9 @@ ' including the viewer', () => { const messageLikesUsers = [ - { id: '83810', isViewer: true, username: 'ginsu', avatar: null }, - { id: '86622', isViewer: false, username: 'ashoat', avatar: null }, - { id: '83889', isViewer: false, username: 'atul', avatar: null }, + { id: '83810', isViewer: true, username: 'ginsu' }, + { id: '86622', isViewer: false, username: 'ashoat' }, + { id: '83889', isViewer: false, username: 'atul' }, ]; const messageLikesInfo = { users: messageLikesUsers, @@ -31,9 +31,9 @@ ' not including the viewer', () => { const messageLikesUsers = [ - { id: '83810', isViewer: false, username: 'ginsu', avatar: null }, - { id: '86622', isViewer: false, username: 'ashoat', avatar: null }, - { id: '83889', isViewer: false, username: 'atul', avatar: null }, + { id: '83810', isViewer: false, username: 'ginsu' }, + { id: '86622', isViewer: false, username: 'ashoat' }, + { id: '83889', isViewer: false, username: 'atul' }, ]; const messageLikesInfo = { users: messageLikesUsers, @@ -53,7 +53,7 @@ ' including the viewer', () => { const messageLikesUsers = [ - { id: '83810', isViewer: false, username: 'ginsu', avatar: null }, + { id: '83810', isViewer: false, username: 'ginsu' }, ]; const messageLikesInfo = { users: messageLikesUsers, @@ -73,7 +73,7 @@ ' not including the viewer', () => { const messageLikesUsers = [ - { id: '83810', isViewer: false, username: 'ashoat', avatar: null }, + { id: '83810', isViewer: false, username: 'ashoat' }, ]; const messageLikesInfo = { users: messageLikesUsers, @@ -99,7 +99,7 @@ ' the viewer and three laugh reactions including the viewer', () => { const messageLikesUsers = [ - { id: '83810', isViewer: false, username: 'varun', avatar: null }, + { id: '83810', isViewer: false, username: 'varun' }, ]; const messageLikesInfo = { users: messageLikesUsers, @@ -107,9 +107,9 @@ }; const messageLaughsUsers = [ - { id: '12345', isViewer: true, username: 'ginsu', avatar: null }, - { id: '67890', isViewer: false, username: 'ashoat', avatar: null }, - { id: '83889', isViewer: false, username: 'atul', avatar: null }, + { id: '12345', isViewer: true, username: 'ginsu' }, + { id: '67890', isViewer: false, username: 'ashoat' }, + { id: '83889', isViewer: false, username: 'atul' }, ]; const messageLaughsInfo = { users: messageLaughsUsers, @@ -130,18 +130,18 @@ ' not including the viewer', () => { const messageLikesUsers = [ - { id: '86622', isViewer: false, username: 'ginsu', avatar: null }, - { id: '12345', isViewer: false, username: 'ashoat', avatar: null }, - { id: '67890', isViewer: false, username: 'atul', avatar: null }, - { id: '83889', isViewer: false, username: 'varun', avatar: null }, - { id: '49203', isViewer: false, username: 'tomek', avatar: null }, - { id: '83029', isViewer: false, username: 'max', avatar: null }, - { id: '72902', isViewer: false, username: 'jon', avatar: null }, - { id: '49022', isViewer: false, username: 'mark', avatar: null }, - { id: '48902', isViewer: false, username: 'kamil', avatar: null }, - { id: '80922', isViewer: false, username: 'marcin', avatar: null }, - { id: '12890', isViewer: false, username: 'inka', avatar: null }, - { id: '67891', isViewer: false, username: 'przemek', avatar: null }, + { id: '86622', isViewer: false, username: 'ginsu' }, + { id: '12345', isViewer: false, username: 'ashoat' }, + { id: '67890', isViewer: false, username: 'atul' }, + { id: '83889', isViewer: false, username: 'varun' }, + { id: '49203', isViewer: false, username: 'tomek' }, + { id: '83029', isViewer: false, username: 'max' }, + { id: '72902', isViewer: false, username: 'jon' }, + { id: '49022', isViewer: false, username: 'mark' }, + { id: '48902', isViewer: false, username: 'kamil' }, + { id: '80922', isViewer: false, username: 'marcin' }, + { id: '12890', isViewer: false, username: 'inka' }, + { id: '67891', isViewer: false, username: 'przemek' }, ]; const messageLikesInfo = { users: messageLikesUsers, diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -441,7 +441,6 @@ pendingPersonalThreadUserInfo: { id: user.id, username: user.username, - avatar: null, }, }; } @@ -452,11 +451,11 @@ ): Map { const memberMap = new Map(); for (const member of members) { - const { id, role, username, avatar } = member; + const { id, role, username } = member; if (!role || !username) { continue; } - memberMap.set(username.toLowerCase(), { id, username, avatar }); + memberMap.set(username.toLowerCase(), { id, username }); } return memberMap; } diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -173,7 +173,6 @@ export type RelativeMemberInfo = { ...MemberInfo, +username: ?string, - +avatar?: ?ClientAvatar, +isViewer: boolean, }; diff --git a/native/profile/relationship-list-item.react.js b/native/profile/relationship-list-item.react.js --- a/native/profile/relationship-list-item.react.js +++ b/native/profile/relationship-list-item.react.js @@ -193,8 +193,8 @@ } onSelect = () => { - const { id, username, avatar } = this.props.userInfo; - this.props.onSelect({ id, username, avatar }); + const { id, username } = this.props.userInfo; + this.props.onSelect({ id, username }); }; visibleEntryIDs() { diff --git a/native/profile/relationship-list.react.js b/native/profile/relationship-list.react.js --- a/native/profile/relationship-list.react.js +++ b/native/profile/relationship-list.react.js @@ -336,9 +336,9 @@ mergedUserInfos[userInfo.id] = userInfo; } for (const id of userStoreSearchResults) { - const { username, avatar, relationshipStatus } = userInfos[id]; + const { username, relationshipStatus } = userInfos[id]; if (username) { - mergedUserInfos[id] = { id, username, avatar, relationshipStatus }; + mergedUserInfos[id] = { id, username, relationshipStatus }; } } diff --git a/web/modals/threads/create/steps/subchannel-members-list.react.js b/web/modals/threads/create/steps/subchannel-members-list.react.js --- a/web/modals/threads/create/steps/subchannel-members-list.react.js +++ b/web/modals/threads/create/steps/subchannel-members-list.react.js @@ -49,11 +49,7 @@ user.id !== currentUserId && (searchResult.has(user.id) || searchText.length === 0), ) - .map(user => ({ - id: user.id, - username: stringForUser(user), - avatar: user.avatar, - })), + .map(user => ({ id: user.id, username: stringForUser(user) })), [parentMembers, currentUserId, searchResult, searchText], ); @@ -70,11 +66,7 @@ user.id !== currentUserId && (searchResult.has(user.id) || searchText.length === 0), ) - .map(user => ({ - id: user.id, - username: stringForUser(user), - avatar: user.avatar, - })), + .map(user => ({ id: user.id, username: stringForUser(user) })), [ communityMembers, parentMembersSet, diff --git a/web/settings/relationship/add-users-list.react.js b/web/settings/relationship/add-users-list.react.js --- a/web/settings/relationship/add-users-list.react.js +++ b/web/settings/relationship/add-users-list.react.js @@ -90,9 +90,9 @@ ? userStoreSearchResults : Object.keys(userInfos); for (const id of userStoreUserIDs) { - const { username, avatar, relationshipStatus } = userInfos[id]; + const { username, relationshipStatus } = userInfos[id]; if (username) { - mergedInfos[id] = { id, username, avatar, relationshipStatus }; + mergedInfos[id] = { id, username, relationshipStatus }; } } @@ -124,7 +124,6 @@ (userID: string) => { setPendingUsersToAdd(pendingUsers => { const username = mergedUserInfos[userID]?.username; - const avatar = mergedUserInfos[userID]?.avatar; if (!username || pendingUsers.some(user => user.id === userID)) { return pendingUsers; } @@ -132,7 +131,6 @@ const newPendingUser = { id: userID, username, - avatar, }; let targetIndex = 0; while ( diff --git a/web/settings/relationship/user-list.react.js b/web/settings/relationship/user-list.react.js --- a/web/settings/relationship/user-list.react.js +++ b/web/settings/relationship/user-list.react.js @@ -42,14 +42,13 @@ const userIDs = searchText ? searchResult : Object.keys(userInfos); const unfilteredUserInfos = []; for (const id of userIDs) { - const { username, avatar, relationshipStatus } = userInfos[id]; + const { username, relationshipStatus } = userInfos[id]; if (!username) { continue; } unfilteredUserInfos.push({ id, username, - avatar, relationshipStatus, }); }