Skip to content

Commit

Permalink
Fix updating status message with same visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphiiko committed Jun 23, 2024
1 parent 03b848d commit 95b7e36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Exposed HMD activity level over MQTT as "HMD On Head" (Experimental).

### Added
- Issue where the status message wasn't updated when the visibility remained the same

## [1.13.1]

### Fixed
Expand Down
14 changes: 6 additions & 8 deletions src-ui/app/services/vrchat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class VRChatService {
info(`[VRChat] Logged in: ${this._user.value?.displayName}`);
}

async setStatus(status: UserStatus | null, statusMessage: string | null): Promise<void> {
async setStatus(status: UserStatus | null, statusMessage: string | null): Promise<boolean> {
// Throw if we don't have a current user
const userId = this._user.value?.id;
if (!userId) {
Expand All @@ -247,21 +247,19 @@ export class VRChatService {
// Sanitize status message if needed
statusMessage =
statusMessage === null ? null : statusMessage.replace(/\s+/g, ' ').trim().slice(0, 32);
// Don't do anything if the status is not changing
if (status && this._user.value?.status === status) return;
// Don't do anything if the status message is not changing
if (statusMessage && this._user.value?.statusDescription === statusMessage) return;
const statusChange = status && this._user.value?.status !== status;
const statusMessageChange =
statusMessage && this._user.value?.statusDescription !== statusMessage;
// Don't do anything if there would be no changes
if (!statusChange && !statusMessageChange) return false;
// Log status change
if (status && statusMessage) {
info(`[VRChat] Changing status to '${statusMessage}' ('${status}')`);
} else if (status) {
info(`[VRChat] Changing status to '${status}'`);
} else if (statusMessage) {
info(`[VRChat] Changing status message to '${statusMessage}'`);
} else {
return;
}

// Send status change request
try {
const body: Record<string, string> = {};
Expand Down

0 comments on commit 95b7e36

Please sign in to comment.