Adrià Vilanova MartÃnez | 6c4739a | 2022-11-07 00:11:53 +0100 | [diff] [blame] | 1 | import {CCApi} from '../../../../common/api.js'; |
| 2 | import {getAuthUser} from '../../../../common/communityConsoleUtils.js'; |
| 3 | |
| 4 | export default class ReadStateRunner { |
| 5 | execute(readState, thread) { |
| 6 | // Although this should in theory be the last message ID, it seems like |
| 7 | // setting 0 marks the entire thread as read anyways. |
| 8 | const lastMessageId = readState ? '0' : '-1'; |
| 9 | |
| 10 | return CCApi( |
| 11 | 'SetUserReadStateBulk', { |
| 12 | // bulkItem: |
| 13 | 1: [{ |
| 14 | 1: thread.forumId, |
| 15 | 2: thread.threadId, |
| 16 | 3: lastMessageId, |
| 17 | }], |
| 18 | }, |
| 19 | /* authenticated = */ true, getAuthUser()); |
| 20 | } |
| 21 | } |