Decrement WoT scores when you unfollow someone

This commit is contained in:
Mike Dilger 2024-09-21 09:51:30 +12:00
parent 5bbe1d5ab3
commit 0ff322b682

View File

@ -733,6 +733,18 @@ impl People {
// Don't remove from relay picker here. They might still be on other
// lists. Garbage collection will eventually clean it up.
// Update Web of Trust scores
if list == PersonList::Followed {
use crate::storage::{FollowingsTable, Table};
let mut txn = GLOBALS.db().get_write_txn()?;
if let Some(followings) = FollowingsTable::read_record(*pubkey, Some(&mut txn))? {
for followed in followings.followed.iter() {
GLOBALS.db().decr_wot(*followed, Some(&mut txn))?;
}
}
txn.commit()?;
}
}
GLOBALS.ui_people_to_invalidate.write().push(*pubkey);