[BUG] POST /api/v1/custom-user-status.update silently overwrites statusType with empty string when omitted
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- mongodb, node.js, typescript
調査の方向性
Start with apps/meteor/server/api/v1/custom-user-status.ts and trace how omitted statusType reaches insertOrUpdateUserStatus.ts; inspect the update tests around this endpoint. Done means updating only the name preserves the existing presence indicator, with a regression test covering an omitted statusType.
索引モデルが issue の本文から書いたものです。
説明
Description:
When updating a custom user status using the REST API endpoint POST /api/v1/custom-user-status.update without providing statusType (which is optional according to the endpoint schema isCustomUserStatusUpdateProps), the endpoint silently sets statusType to an empty string "" in MongoDB, permanently erasing the user status presence indicator.
Steps to reproduce:
- Create a custom user status with a presence indicator (e.g.
name: "Supriyo",statusType: "busy"). - Confirm the presence indicator shows as
busyin the UI table (/admin/user-status). - Send a
POSTrequest to/api/v1/custom-user-status.updateto update only the name, omittingstatusType:{ "_id": "6aef44df9bb283fd2954335f", "name": "Supriyo" } - Query
/api/v1/custom-user-status.listor view the Administration -> User status page.
Expected behavior:
The existing statusType ("busy") should be preserved when statusType is not provided in the update payload.
Actual behavior:
statusType is overwritten with "" (empty string) in MongoDB, causing permanent data loss. The presence indicator badge disappears completely from the UI table.
Visual Evidence:
1. Before Update (UI Table shows "busy"):
2. API Request (omitting statusType):
3. Server Response (statusType is wiped to empty string):
4. After Update (UI Table presence is completely wiped):
Server Setup Information:
- Version of Rocket.Chat Server: 8.9.1 / 9.1.0-develop
- License Type: Community
- Number of Users: 1
- Operating System: Windows / Linux
- Deployment Method: docker / source
- Number of Running Instances: 1
- DB Replicaset Oplog: Enabled
- NodeJS Version: 24.x
- MongoDB Version: 8.0
Client Setup Information
- Desktop App or Browser Version: Chrome
- Operating System: Windows 11
Additional context
Root Cause:
In apps/meteor/server/api/v1/custom-user-status.ts (line 233):
const userStatusData = {
_id: this.bodyParams._id,
name: this.bodyParams.name,
statusType: this.bodyParams.statusType || '', // <-- Defaults undefined to ''
};
Because this.bodyParams.statusType is undefined, it evaluates to ''. Then in insertOrUpdateUserStatus.ts (line 83):
if (userStatusData.statusType !== userStatusData.previousStatusType) {
await CustomUserStatus.setStatusType(userStatusData._id, userStatusData.statusType);
}
userStatusData.previousStatusType is never passed from the endpoint (undefined), so '' !== undefined evaluates to true, and MongoDB writes statusType: '' over the existing record.
I have a fix ready with automated end-to-end test cases and would love to open a PR for this.
- 主要言語
- TypeScript
- スター
- 46.5k
- フォーク
- 14.1k
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 381
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RocketChat/Rocket.Chat のほかの issue
-
Mark the empty state busy while a new search loads, like the table */}対応中かも @aditya25bcy10173-a11y が 2 日前に担当しました。 オープンtodo type: feature
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
RocketChat/Rocket.Chat#43699 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Timestamp with a time but no timezone shows as 1 January 1970対応中かも @Sarthak-agrawal-tech が 4 日前に担当しました。 オープンtype: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
RocketChat/Rocket.Chat#43637 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
-
Move this mapping from useQuery's old `select` into a usePaginatedQuery `combine`対応中かも @aditya25bcy10173-a11y が 3 日前に担当しました。 オープンtodo type: feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
RocketChat/Rocket.Chat#43609 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
evaluate switching to the other tab when the selected tab's permission is revoked mid-session対応中かも @schizophrenicmaniac が 4 日前に担当しました。 オープンtodo type: feature
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
RocketChat/Rocket.Chat#43579 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Docs say packages can be installed with `npm` but use unsupported `patch:` URL対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンtype: bug
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
RocketChat/Rocket.Chat#43554 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
RocketChat/Rocket.Chat の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
langchain-ai/langchainjs#12239 ·
メンテナーはふだん 1 日以内に返信
-
Board view: the Monitoring column is always empty because compact issue rows drop displayStatusオープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
paperclipai/paperclip#21837 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
code-yeongyu/senpi#6813 ·
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 93/100
lingdojo/kana-dojo#34169 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100