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