Adrià Vilanova MartÃnez | 78dcfdf | 2024-02-26 02:02:22 +0100 | [diff] [blame] | 1 | import {CCApi} from '../../../../common/api.js'; |
| 2 | import {getAuthUser} from '../../../../common/communityConsoleUtils.js'; |
| 3 | |
| 4 | export default class AttributeRunner { |
| 5 | async execute(attributeAction, thread) { |
| 6 | if (!attributeAction) { |
| 7 | throw new Error( |
| 8 | 'The workflow is malformed. The attribute action is missing.'); |
| 9 | } |
| 10 | const action = attributeAction.getAttributeAction(); |
| 11 | |
| 12 | return await CCApi( |
| 13 | 'SetThreadAttribute', { |
| 14 | 1: thread.forumId, |
| 15 | 2: thread.threadId, |
| 16 | 3: action, |
| 17 | }, |
| 18 | /* authenticated = */ true, getAuthUser()); |
| 19 | } |
| 20 | } |