this repo has no description

Only show followed hashtags for non-followings

+29 -2
+5 -1
src/pages/following.jsx
··· 31 31 const results = await homeIterator.current.next(); 32 32 let { value } = results; 33 33 if (value?.length) { 34 + let latestItemChanged = false; 34 35 if (firstLoad) { 36 + if (value[0].id !== latestItem.current) { 37 + latestItemChanged = true; 38 + } 35 39 latestItem.current = value[0].id; 36 40 console.log('First load', latestItem.current); 37 41 } ··· 41 45 saveStatus(item, instance); 42 46 }); 43 47 value = dedupeBoosts(value, instance); 44 - if (firstLoad) clearFollowedTagsState(); 48 + if (firstLoad && latestItemChanged) clearFollowedTagsState(); 45 49 assignFollowedTags(value, instance); 46 50 47 51 // ENFORCE sort by datetime (Latest first)
+1
src/utils/relationships.js
··· 19 19 } 20 20 return acc; 21 21 }, []); 22 + if (!uniqueAccountIds.length) return null; 22 23 23 24 try { 24 25 const relationships = await masto.v1.accounts.relationships.fetch({
+23 -1
src/utils/timeline-utils.jsx
··· 1 1 import { extractTagsFromStatus, getFollowedTags } from './followed-tags'; 2 + import { fetchRelationships } from './relationships'; 2 3 import states, { statusKey } from './states'; 3 4 import store from './store'; 4 5 ··· 182 183 const followedTags = await getFollowedTags(); // [{name: 'tag'}, {...}] 183 184 if (!followedTags.length) return; 184 185 const { statusFollowedTags } = states; 186 + console.log('statusFollowedTags', statusFollowedTags); 187 + const statusWithFollowedTags = []; 185 188 items.forEach((item) => { 186 189 if (item.reblog) return; 187 190 const { id, content, tags = [] } = item; ··· 199 202 return acc; 200 203 }, []); 201 204 if (itemFollowedTags.length) { 202 - statusFollowedTags[sKey] = itemFollowedTags; 205 + // statusFollowedTags[sKey] = itemFollowedTags; 206 + statusWithFollowedTags.push({ 207 + item, 208 + sKey, 209 + followedTags: itemFollowedTags, 210 + }); 203 211 } 204 212 }); 213 + 214 + if (statusWithFollowedTags.length) { 215 + const accounts = statusWithFollowedTags.map((s) => s.item.account); 216 + const relationships = await fetchRelationships(accounts); 217 + if (!relationships) return; 218 + 219 + statusWithFollowedTags.forEach((s) => { 220 + const { item, sKey, followedTags } = s; 221 + const r = relationships[item.account.id]; 222 + if (!r.following) { 223 + statusFollowedTags[sKey] = followedTags; 224 + } 225 + }); 226 + } 205 227 } 206 228 207 229 export function clearFollowedTagsState() {