show own content in follows

This commit is contained in:
Martti Malmi 2021-07-13 15:12:46 +03:00
parent d7611611e8
commit 501c95f0ab
2 changed files with 12 additions and 3 deletions

View File

@ -50,6 +50,15 @@ function getExtendedFollows(callback, k, maxDepth = 3, currentDepth = 1) {
callback(k, follows[k]);
}
function removeFollow(k, followDistance, follower) {
if (follows[k]) {
follows[k].followers.delete(follower);
if (followDistance === 1) {
State.local.get('groups').get('follows').get(k).put(false);
}
}
}
addFollow(k, currentDepth - 1);
State.public.user(k).get('follow').map().on((isFollowing, followedKey) => { // TODO: unfollow
@ -59,6 +68,8 @@ function getExtendedFollows(callback, k, maxDepth = 3, currentDepth = 1) {
if (currentDepth < maxDepth) {
getExtendedFollows(callback, followedKey, maxDepth, currentDepth + 1);
}
} else {
removeFollow(followedKey, currentDepth, k);
}
});

View File

@ -36,9 +36,7 @@ class MessageFeed extends Component {
if (this.props.node) {
this.props.node.map().on((...args) => this.handleMessage(...args));
} else if (this.props.group && this.props.path) { // TODO: make group use the same basic gun api
const group = this.props.group === 'follows' ?
State.public.user().get('follow') :
State.local.get('groups').get(this.props.group);
const group = State.local.get('groups').get(this.props.group);
State.group(group).map(this.props.path, (...args) => this.handleMessage(...args));
}
}