Skip to content

Commit 1c82df8

Browse files
authored
Update users.ts
1 parent 0a3f712 commit 1c82df8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

apps/meteor/app/api/server/v1/users.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,8 @@ const usersEndpoints = API.v1
897897
}>({
898898
type: 'object',
899899
properties: {
900-
status: { type: 'string' },
901-
message: { type: 'string' },
900+
status: { type: 'string', minLength: 1 },
901+
message: { type: 'string', minLength: 1 },
902902
userId: { type: 'string' },
903903
username: { type: 'string' },
904904
user: { type: 'string' },
@@ -949,7 +949,12 @@ const usersEndpoints = API.v1
949949
statusText = this.bodyParams.message;
950950
}
951951

952-
if (this.bodyParams.status) {
952+
if ('status' in this.bodyParams) {
953+
if (!this.bodyParams.status) {
954+
throw new Meteor.Error('error-invalid-status', 'Valid status types include online, away, offline, and busy.', {
955+
method: 'users.setStatus',
956+
});
957+
}
953958
const validStatus = ['online', 'away', 'offline', 'busy'];
954959
if (validStatus.includes(this.bodyParams.status)) {
955960
status = this.bodyParams.status as UserStatus;

0 commit comments

Comments
 (0)