Small changes

This commit is contained in:
Natsumi
2024-04-30 13:30:43 +12:00
parent 3acba7566f
commit b4a95bb248
3 changed files with 82 additions and 52 deletions
+77 -47
View File
@@ -5010,13 +5010,13 @@ speechSynthesis.getVoices();
break; break;
case 'group-joined': case 'group-joined':
var groupId = content.groupId; // var groupId = content.groupId;
$app.onGroupJoined(groupId); // $app.onGroupJoined(groupId);
break; break;
case 'group-left': case 'group-left':
var groupId = content.groupId; // var groupId = content.groupId;
$app.onGroupLeft(groupId); // $app.onGroupLeft(groupId);
break; break;
case 'group-role-updated': case 'group-role-updated':
@@ -5047,7 +5047,6 @@ speechSynthesis.getVoices();
) { ) {
$app.getGroupDialogGroup(groupId); $app.getGroupDialogGroup(groupId);
} }
$app.onGroupJoined(groupId);
this.$emit('GROUP:MEMBER', { this.$emit('GROUP:MEMBER', {
json: content.member, json: content.member,
params: { params: {
@@ -5110,7 +5109,12 @@ speechSynthesis.getVoices();
message: 'Instance Closed', message: 'Instance Closed',
created_at: new Date().toJSON() created_at: new Date().toJSON()
}; };
$app.notifyMenu('notification'); if (
$app.notificationTable.filters[0].value.length === 0 ||
$app.notificationTable.filters[0].value.includes(noty.type)
) {
$app.notifyMenu('notification');
}
$app.queueNotificationNoty(noty); $app.queueNotificationNoty(noty);
$app.notificationTable.data.push(noty); $app.notificationTable.data.push(noty);
$app.updateSharedFeed(true); $app.updateSharedFeed(true);
@@ -9973,12 +9977,10 @@ speechSynthesis.getVoices();
// eslint-disable-next-line require-atomic-updates // eslint-disable-next-line require-atomic-updates
$app.notificationTable.data = await database.getNotifications(); $app.notificationTable.data = await database.getNotifications();
await this.refreshNotifications(); await this.refreshNotifications();
if (typeof args.json.presence?.groups !== 'undefined') { await $app.loadCurrentUserGroups(
await $app.loadCurrentUserGroups( args.json.id,
args.json.id, args.json?.presence?.groups
args.json.presence.groups );
);
}
await $app.getCurrentUserGroups(); await $app.getCurrentUserGroups();
try { try {
if ( if (
@@ -14710,7 +14712,12 @@ speechSynthesis.getVoices();
database.addNotificationToDatabase(ref); database.addNotificationToDatabase(ref);
} }
if ($app.friendLogInitStatus) { if ($app.friendLogInitStatus) {
$app.notifyMenu('notification'); if (
$app.notificationTable.filters[0].value.length === 0 ||
$app.notificationTable.filters[0].value.includes(ref.type)
) {
$app.notifyMenu('notification');
}
$app.unseenNotifications.push(ref.id); $app.unseenNotifications.push(ref.id);
$app.queueNotificationNoty(ref); $app.queueNotificationNoty(ref);
} }
@@ -19699,6 +19706,24 @@ speechSynthesis.getVoices();
$app.inviteDialog.visible = false; $app.inviteDialog.visible = false;
}); });
$app.methods.addFriendsInInstanceToInvite = function () {
var D = this.inviteDialog;
for (var friend of D.friendsInInstance) {
if (!D.userIds.includes(friend.id)) {
D.userIds.push(friend.id);
}
}
};
$app.methods.addFavoriteFriendsToInvite = function () {
var D = this.inviteDialog;
for (var friend of this.friendsGroup0) {
if (!D.userIds.includes(friend.id)) {
D.userIds.push(friend.id);
}
}
};
$app.methods.sendInvite = function () { $app.methods.sendInvite = function () {
this.$confirm('Continue? Invite', 'Confirm', { this.$confirm('Continue? Invite', 'Confirm', {
confirmButtonText: 'Confirm', confirmButtonText: 'Confirm',
@@ -27853,7 +27878,12 @@ speechSynthesis.getVoices();
groupName, groupName,
worldName worldName
}; };
this.notifyMenu('notification'); if (
this.notificationTable.filters[0].value.length === 0 ||
this.notificationTable.filters[0].value.includes(noty.type)
) {
this.notifyMenu('notification');
}
this.queueNotificationNoty(noty); this.queueNotificationNoty(noty);
this.notificationTable.data.push(noty); this.notificationTable.data.push(noty);
this.updateSharedFeed(true); this.updateSharedFeed(true);
@@ -28062,9 +28092,6 @@ speechSynthesis.getVoices();
$app.groupDialog.inGroup = json.membershipStatus === 'member'; $app.groupDialog.inGroup = json.membershipStatus === 'member';
$app.getGroupDialogGroup(groupId); $app.getGroupDialogGroup(groupId);
} }
if (json.membershipStatus === 'member') {
$app.onGroupJoined(groupId);
}
}); });
/** /**
@@ -28097,7 +28124,6 @@ speechSynthesis.getVoices();
) { ) {
$app.getCurrentUserRepresentedGroup(); $app.getCurrentUserRepresentedGroup();
} }
$app.onGroupLeft(groupId);
}); });
/** /**
@@ -29444,34 +29470,7 @@ speechSynthesis.getVoices();
}; };
$app.methods.loadCurrentUserGroups = async function (userId, groups) { $app.methods.loadCurrentUserGroups = async function (userId, groups) {
if ( var savedGroups = JSON.parse(
!(await configRepository.getBool(
`VRCX_currentUserGroupsInit_${userId}`
))
) {
// fetch every group with roles for storing and comparing later
for (var i = 0; i < groups.length; i++) {
var groupId = groups[i];
try {
var args = await API.getGroup({
groupId,
includeRoles: true
});
var ref = API.applyGroup(args.json);
API.currentUserGroups.set(groupId, ref);
} catch (err) {
console.error(err);
}
}
this.saveCurrentUserGroups();
this.currentUserGroupsInit = true;
configRepository.setBool(
`VRCX_currentUserGroupsInit_${userId}`,
true
);
return;
}
var groups = JSON.parse(
await configRepository.getString( await configRepository.getString(
`VRCX_currentUserGroups_${userId}`, `VRCX_currentUserGroups_${userId}`,
'[]' '[]'
@@ -29479,7 +29478,7 @@ speechSynthesis.getVoices();
); );
API.cachedGroups.clear(); API.cachedGroups.clear();
API.currentUserGroups.clear(); API.currentUserGroups.clear();
for (var group of groups) { for (var group of savedGroups) {
var ref = { var ref = {
id: group.id, id: group.id,
name: group.name, name: group.name,
@@ -29493,7 +29492,38 @@ speechSynthesis.getVoices();
API.cachedGroups.set(group.id, ref); API.cachedGroups.set(group.id, ref);
API.currentUserGroups.set(group.id, ref); API.currentUserGroups.set(group.id, ref);
} }
var fetchedRoles = false;
if (groups) {
for (var i = 0; i < groups.length; i++) {
var groupId = groups[i];
var groupRef = API.cachedGroups.get(groupId);
if (
typeof groupRef !== 'undefined' &&
groupRef.myMember?.roleIds?.length > 0
) {
continue;
}
try {
var args = await API.getGroup({
groupId,
includeRoles: true
});
var ref = API.applyGroup(args.json);
API.currentUserGroups.set(groupId, ref);
fetchedRoles = true;
console.log(`Fetched group ${ref.name}`);
} catch (err) {
console.error(err);
}
}
}
this.currentUserGroupsInit = true; this.currentUserGroupsInit = true;
if (fetchedRoles) {
this.saveCurrentUserGroups();
}
}; };
API.applyGroupMember = function (json) { API.applyGroupMember = function (json) {
+3 -5
View File
@@ -1290,6 +1290,8 @@ html
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="inviteDialog" :visible.sync="inviteDialog.visible" :title="$t('dialog.invite.header')" width="450px") el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="inviteDialog" :visible.sync="inviteDialog.visible" :title="$t('dialog.invite.header')" width="450px")
div(v-if="inviteDialog.visible" v-loading="inviteDialog.loading") div(v-if="inviteDialog.visible" v-loading="inviteDialog.loading")
location(:location="inviteDialog.worldId" :link="false") location(:location="inviteDialog.worldId" :link="false")
el-button(size="mini" v-text="$t('dialog.invite.add_friends_in_instance')" @click="addFriendsInInstanceToInvite" style="margin-top:10px")
el-button(size="mini" v-text="$t('dialog.invite.add_favorite_friends')" @click="addFavoriteFriendsToInvite" style="margin-top:10px")
el-select(v-model="inviteDialog.userIds" multiple clearable :placeholder="$t('dialog.invite.select_placeholder')" filterable :disabled="inviteDialog.loading" style="width:100%;margin-top:15px") el-select(v-model="inviteDialog.userIds" multiple clearable :placeholder="$t('dialog.invite.select_placeholder')" filterable :disabled="inviteDialog.loading" style="width:100%;margin-top:15px")
el-option-group(v-if="API.currentUser" :label="$t('side_panel.me')") el-option-group(v-if="API.currentUser" :label="$t('side_panel.me')")
el-option.x-friend-item(:label="API.currentUser.displayName" :value="API.currentUser.id" style="height:auto") el-option.x-friend-item(:label="API.currentUser.displayName" :value="API.currentUser.id" style="height:auto")
@@ -2528,11 +2530,7 @@ html
span 💚 span 💚
el-table-column(:label="$t('table.previous_instances.display_name')" prop="displayName" sortable) el-table-column(:label="$t('table.previous_instances.display_name')" prop="displayName" sortable)
template(v-once #default="scope") template(v-once #default="scope")
span.x-link( span.x-link(v-text="scope.row.displayName" @click="lookupUser(scope.row)")
v-text="scope.row.displayName"
@click="lookupUser(scope.row)"
:class="{ 'x-tag-friend': gameLogIsFriend(scope.row) }"
)
el-table-column(:label="$t('table.previous_instances.time')" prop="time" width="90" sortable) el-table-column(:label="$t('table.previous_instances.time')" prop="time" width="90" sortable)
template(v-once #default="scope") template(v-once #default="scope")
span(v-text="scope.row.timer") span(v-text="scope.row.timer")
+2
View File
@@ -899,6 +899,8 @@
"invite": { "invite": {
"header": "Invite", "header": "Invite",
"select_placeholder": "Choose Friends", "select_placeholder": "Choose Friends",
"add_friends_in_instance": "Add Friends In Instance",
"add_favorite_friends": "Add Favorite Friends",
"invite_with_message": "Invite With Message", "invite_with_message": "Invite With Message",
"invite": "Invite", "invite": "Invite",
"friends_in_instance": "Friends In Instance" "friends_in_instance": "Friends In Instance"