Check for null in friends mapping
This commit is contained in:
parent
1855ca5649
commit
d4901a8ebf
|
@ -184,14 +184,14 @@ const getFriends = async (ssbServer, profile) => {
|
||||||
|
|
||||||
let connections = {};
|
let connections = {};
|
||||||
for (let key in graph) {
|
for (let key in graph) {
|
||||||
let isFollowing = graph[profile.id][key] > 0;
|
let isFollowing = graph[profile.id] && graph[profile.id][key] > 0;
|
||||||
let isFollowingBack = graph[key] && graph[key][profile.id] > 0;
|
let isFollowingBack = graph[key] && graph[key][profile.id] > 0;
|
||||||
if (isFollowing && isFollowingBack) {
|
if (isFollowing && isFollowingBack) {
|
||||||
connections[key] = "friends";
|
connections[key] = "friends";
|
||||||
} else if (isFollowing && !isFollowingBack) {
|
} else if (isFollowing && !isFollowingBack) {
|
||||||
connections[key] = "requestsSent";
|
connections[key] = "requestsSent";
|
||||||
} else if (!isFollowing && isFollowingBack) {
|
} else if (!isFollowing && isFollowingBack) {
|
||||||
if (graph[profile.id][key] === undefined)
|
if (!graph[profile.id] || graph[profile.id][key] === undefined)
|
||||||
connections[key] = "requestsReceived";
|
connections[key] = "requestsReceived";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue