Fix ImplicitRelationships & RelationshipNotifier (#3539)
This commit is contained in:
parent
1142cab05c
commit
310d8e6140
3 changed files with 4 additions and 5 deletions
|
|
@ -125,12 +125,11 @@ export default definePlugin({
|
|||
// Implicit relationships are defined as users that you:
|
||||
// 1. Have an affinity for
|
||||
// 2. Do not have a relationship with
|
||||
await this.refreshUserAffinities();
|
||||
const userAffinities: Record<string, any>[] = UserAffinitiesStore.getUserAffinities();
|
||||
const relationships = RelationshipStore.getMutableRelationships();
|
||||
const nonFriendAffinities = userAffinities.filter(a => !RelationshipStore.getRelationshipType(a.otherUserId));
|
||||
nonFriendAffinities.forEach(a => {
|
||||
relationships[a.otherUserId] = 5;
|
||||
relationships.set(a.otherUserId, 5);
|
||||
});
|
||||
RelationshipStore.emitChange();
|
||||
|
||||
|
|
|
|||
|
|
@ -173,8 +173,8 @@ export async function syncFriends() {
|
|||
friends.requests = [];
|
||||
|
||||
const relationShips = RelationshipStore.getMutableRelationships();
|
||||
for (const id in relationShips) {
|
||||
switch (relationShips[id]) {
|
||||
for (const [id, type] of relationShips) {
|
||||
switch (type) {
|
||||
case RelationshipType.FRIEND:
|
||||
friends.friends.push(id);
|
||||
break;
|
||||
|
|
|
|||
2
src/webpack/common/types/stores.d.ts
vendored
2
src/webpack/common/types/stores.d.ts
vendored
|
|
@ -255,5 +255,5 @@ export class RelationshipStore extends FluxStore {
|
|||
getSince(userId: string): string;
|
||||
|
||||
/** @returns Format: [userId: Enum value from constants.RelationshipTypes] */
|
||||
getMutableRelationships(): Record<number, number>;
|
||||
getMutableRelationships(): Map<string, number>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue