Skip to content

Commit b260ca0

Browse files
lmjabreuclaude
andcommitted
fix: use empty string to clear away status
The Twist API accepts an empty string (not null) to clear the away_mode field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ef61f71 commit b260ca0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/__tests__/away.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@ describe('away', () => {
145145
})
146146

147147
describe('clear', () => {
148-
it('calls users.update with null awayMode', async () => {
148+
it('calls users.update with empty string awayMode to clear', async () => {
149149
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
150150
const program = createProgram()
151151

152152
await program.parseAsync(['node', 'tw', 'away', 'clear'])
153153

154-
expect(apiMocks.updateUser).toHaveBeenCalledWith({ awayMode: null })
154+
expect(apiMocks.updateUser).toHaveBeenCalledWith({ awayMode: '' })
155155
expect(logSpy).toHaveBeenCalledWith('Away status cleared.')
156156
logSpy.mockRestore()
157157
})

src/commands/away.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async function clearAway(options: MutationOptions & ViewOptions): Promise<void>
9292
}
9393

9494
const client = await getTwistClient()
95-
const user = await client.users.update({ awayMode: null as never })
95+
const user = await client.users.update({ awayMode: '' as never })
9696

9797
if (options.json) {
9898
console.log(formatJson(user, 'user', options.full))

0 commit comments

Comments
 (0)