Fix renderManageFriends null error, silence steps listener permission noise

This commit is contained in:
Sterling Archer committed 2026-06-20 23:17:27 -07:00
1 parent 25fc0d45ec
commit f4005b927b
1 file changed
+6 -5
+6 -5
View File
@@ -929,7 +929,7 @@ function loadFriendsRealtime() {
renderMySteps(); renderMySteps();
checkSetupReminder(); checkSetupReminder();
renderLeaderboard(); renderLeaderboard();
}); }, err => console.warn('Steps listener error:', err.code));
unsubscribers.push(unsubMySteps); unsubscribers.push(unsubMySteps);
} }
@@ -1005,6 +1005,8 @@ window.showMoreLb = function() { lbVisibleCount += 10; renderLeaderboard(); }
// MANAGE FRIENDS // MANAGE FRIENDS
function renderManageFriends() { function renderManageFriends() {
const fml = document.getElementById('friends-manage-list');
if (!fml) return;
const pendingUids = getPendingFriendUids(); const pendingUids = getPendingFriendUids();
const prSection = document.getElementById('pending-received-section'); const prSection = document.getElementById('pending-received-section');
const prList = document.getElementById('pending-received-list'); const prList = document.getElementById('pending-received-list');
@@ -1135,6 +1137,7 @@ window.denyFriend = async function(uid) {
// FRIEND PROFILE // FRIEND PROFILE
window.openFriendProfile = async function(uid) { window.openFriendProfile = async function(uid) {
if (!uid) return;
currentFriendUid = uid; currentFriendUid = uid;
const profile = friendProfiles[uid] || {}; const profile = friendProfiles[uid] || {};
const nick = friendsData[uid]?.nickname || ''; const nick = friendsData[uid]?.nickname || '';
@@ -1146,10 +1149,8 @@ window.openFriendProfile = async function(uid) {
document.getElementById('fp-name-text').textContent = nick || displayName; document.getElementById('fp-name-text').textContent = nick || displayName;
const userSnap = await getDoc(doc(db, 'users', uid)); const addedAt = friendsData[uid]?.addedAt?.toDate?.();
const userData = userSnap.exists() ? userSnap.data() : {}; document.getElementById('fp-joined').textContent = addedAt ? addedAt.toLocaleDateString('en-US', {month:'long', day:'numeric', year:'numeric'}) : '—';
const joined = userData.createdAt?.toDate?.();
document.getElementById('fp-joined').textContent = joined ? joined.toLocaleDateString('en-US', {month:'long', day:'numeric', year:'numeric'}) : '—';
showScreen('friend-profile'); showScreen('friend-profile');
} }