Fix "everyone" option for OnPlayerJoinedBlocked, remove generated invite message

This commit is contained in:
Natsumi
2024-04-11 12:19:14 +12:00
parent 53d2a70b0d
commit 708cc1ff37
2 changed files with 30 additions and 22 deletions

View File

@@ -1356,6 +1356,7 @@ speechSynthesis.getVoices();
isFriend: json.isFriend,
last_activity: json.last_activity,
last_login: json.last_login,
last_mobile: json.last_mobile,
last_platform: json.last_platform,
// location - missing from currentUser
// note - missing from currentUser
@@ -1681,6 +1682,7 @@ speechSynthesis.getVoices();
isFriend: false,
last_activity: '',
last_login: '',
last_mobile: null,
last_platform: '',
obfuscatedEmail: '',
obfuscatedPendingEmail: '',
@@ -1834,6 +1836,7 @@ speechSynthesis.getVoices();
isFriend: false,
last_activity: '',
last_login: '',
last_mobile: null,
last_platform: '',
location: '',
note: '',
@@ -4859,8 +4862,6 @@ speechSynthesis.getVoices();
break;
case 'friend-update':
// is this used anymore?
console.error('friend-update', content);
this.$emit('USER', {
json: content.user,
params: {
@@ -5883,18 +5884,25 @@ speechSynthesis.getVoices();
}
// BlockedOnPlayerJoined, BlockedOnPlayerLeft, MutedOnPlayerJoined, MutedOnPlayerLeft
if (ctx.type === 'OnPlayerJoined' || ctx.type === 'OnPlayerLeft') {
for (var ref of this.playerModerationTable.data) {
if (ref.targetDisplayName === ctx.displayName) {
if (ref.type === 'block') {
var type = `Blocked${ctx.type}`;
} else if (ref.type === 'mute') {
var type = `Muted${ctx.type}`;
} else {
continue;
}
var entry = {
created_at: ctx.created_at,
type,
for (var ref of API.cachedPlayerModerations.values()) {
if (
ref.targetDisplayName !== ctx.displayName &&
ref.sourceUserId !== ctx.userId
) {
continue;
}
if (ref.type === 'block') {
var type = `Blocked${ctx.type}`;
} else if (ref.type === 'mute') {
var type = `Muted${ctx.type}`;
} else {
continue;
}
var entry = {
created_at: ctx.created_at,
type,
displayName: ref.targetDisplayName,
userId: ref.targetUserId,
isFriend,
@@ -5908,8 +5916,7 @@ speechSynthesis.getVoices();
) {
wristArr.unshift(entry);
}
this.queueFeedNoty(entry);
}
this.queueFeedNoty(entry);
}
}
// when too many user joins happen at once when switching instances
@@ -6075,7 +6082,8 @@ speechSynthesis.getVoices();
var notyFilter = this.sharedFeedFilters.noty;
if (
notyFilter[noty.type] &&
(notyFilter[noty.type] === 'Friends' ||
(notyFilter[noty.type] === 'Everyone' ||
(notyFilter[noty.type] === 'Friends' && noty.isFriend) ||
(notyFilter[noty.type] === 'VIP' && noty.isFavorite))
) {
this.playNoty(noty);
@@ -6298,13 +6306,14 @@ speechSynthesis.getVoices();
}
if (displayName) {
// don't play noty twice
var notyId = `${noty.type},${displayName}`;
if (
this.notyMap[displayName] &&
this.notyMap[displayName] >= noty.created_at
this.notyMap[notyId] &&
this.notyMap[notyId] >= noty.created_at
) {
return;
}
this.notyMap[displayName] = noty.created_at;
this.notyMap[notyId] = noty.created_at;
}
var bias = new Date(Date.now() - 60000).toJSON();
if (noty.created_at < bias) {

View File

@@ -46,9 +46,8 @@ mixin notificationsTab()
span.x-link(v-if="scope.row.type === 'invite'" @click="showWorldDialog(scope.row.details.worldId)")
location(v-if="scope.row.details" :location="scope.row.details.worldId" :hint="scope.row.details.worldName" :grouphint="scope.row.details.groupName" :link="false")
br
span(v-if="scope.row.message" v-text="scope.row.message")
span(v-if="scope.row.message && scope.row.message !== `This is a generated invite to ${scope.row.details?.worldName}`" v-text="scope.row.message")
span(v-else-if="scope.row.title") {{ scope.row.title }}, {{ scope.row.message }}
span(v-else-if="scope.row.message" v-text="scope.row.message")
span(v-else-if='scope.row.details && scope.row.details.inviteMessage' v-text="scope.row.details.inviteMessage")
span(v-else-if='scope.row.details && scope.row.details.requestMessage' v-text="scope.row.details.requestMessage")
span(v-else-if='scope.row.details && scope.row.details.responseMessage' v-text="scope.row.details.responseMessage")