mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Verify friend/unfriends
This commit is contained in:
+21
-10
@@ -10467,28 +10467,25 @@ speechSynthesis.getVoices();
|
||||
if (!this.friendLogInitStatus || this.friendLog.has(id)) {
|
||||
return;
|
||||
}
|
||||
var ctx = {
|
||||
id,
|
||||
displayName: null,
|
||||
trustLevel: null
|
||||
};
|
||||
var ref = API.cachedUsers.get(id);
|
||||
if (typeof ref !== 'undefined') {
|
||||
ctx.displayName = ref.displayName;
|
||||
ctx.trustLevel = ref.$trustLevel;
|
||||
API.getFriendStatus({
|
||||
userId: id
|
||||
}).then((args) => {
|
||||
if (args.json.isFriend) {
|
||||
var friendLogHistory = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Friend',
|
||||
userId: id,
|
||||
displayName: ctx.displayName
|
||||
displayName: ref.displayName
|
||||
};
|
||||
this.friendLogTable.data.push(friendLogHistory);
|
||||
database.addFriendLogHistory(friendLogHistory);
|
||||
this.queueFriendLogNoty(friendLogHistory);
|
||||
var friendLogCurrent = {
|
||||
userId: id,
|
||||
displayName: ctx.displayName,
|
||||
trustLevel: ctx.trustLevel
|
||||
displayName: ref.displayName,
|
||||
trustLevel: ref.$trustLevel
|
||||
};
|
||||
this.friendLog.set(id, friendLogCurrent);
|
||||
database.setFriendLogCurrent(friendLogCurrent);
|
||||
@@ -10496,6 +10493,8 @@ speechSynthesis.getVoices();
|
||||
this.deleteFriendRequest(id);
|
||||
this.updateSharedFeed(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$app.methods.deleteFriendRequest = function (userId) {
|
||||
@@ -10516,6 +10515,10 @@ speechSynthesis.getVoices();
|
||||
if (typeof ctx === 'undefined') {
|
||||
return;
|
||||
}
|
||||
API.getFriendStatus({
|
||||
userId: id
|
||||
}).then((args) => {
|
||||
if (!args.json.isFriend) {
|
||||
var friendLogHistory = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Unfriend',
|
||||
@@ -10529,6 +10532,8 @@ speechSynthesis.getVoices();
|
||||
database.deleteFriendLogCurrent(id);
|
||||
this.notifyMenu('friendLog');
|
||||
this.updateSharedFeed(true);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.updateFriendships = function (ref) {
|
||||
@@ -10553,6 +10558,10 @@ speechSynthesis.getVoices();
|
||||
return;
|
||||
}
|
||||
if (ctx.displayName !== ref.displayName) {
|
||||
API.getFriendStatus({
|
||||
userId: ref.id
|
||||
}).then((args) => {
|
||||
if (args.json.isFriend) {
|
||||
if (ctx.displayName) {
|
||||
var friendLogHistory = {
|
||||
created_at: new Date().toJSON(),
|
||||
@@ -10583,6 +10592,8 @@ speechSynthesis.getVoices();
|
||||
this.notifyMenu('friendLog');
|
||||
this.updateSharedFeed(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (
|
||||
ref.$trustLevel &&
|
||||
ctx.trustLevel &&
|
||||
|
||||
Reference in New Issue
Block a user