mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 22:14:42 +01:00
Prevent GC posts from notifications
This commit is contained in:
parent
6e3494488a
commit
90df455d6e
1 changed files with 6 additions and 2 deletions
|
@ -85,12 +85,16 @@ window.__STATES_STATS__ = () => {
|
||||||
// Only posts for now
|
// Only posts for now
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (!window.__IDLE__) return;
|
if (!window.__IDLE__) return;
|
||||||
const { statuses, unfurledLinks } = states;
|
const { statuses, unfurledLinks, notifications } = states;
|
||||||
let keysCount = 0;
|
let keysCount = 0;
|
||||||
|
const { instance } = api();
|
||||||
for (const key in statuses) {
|
for (const key in statuses) {
|
||||||
try {
|
try {
|
||||||
const $post = document.querySelector(`[data-state-post-id~="${key}"]`);
|
const $post = document.querySelector(`[data-state-post-id~="${key}"]`);
|
||||||
if (!$post) {
|
const postInNotifications = notifications.some(
|
||||||
|
(n) => key === statusKey(n.status?.id, instance),
|
||||||
|
);
|
||||||
|
if (!$post && !postInNotifications) {
|
||||||
delete states.statuses[key];
|
delete states.statuses[key];
|
||||||
delete states.statusQuotes[key];
|
delete states.statusQuotes[key];
|
||||||
for (const link in unfurledLinks) {
|
for (const link in unfurledLinks) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue