blob: bec25114363ba1931146c3e97d05923264063fa5 [file] [log] [blame]
Adrià Vilanova Martínez78dcfdf2024-02-26 02:02:22 +01001import {CCApi} from '../../../../common/api.js';
2import {getAuthUser} from '../../../../common/communityConsoleUtils.js';
3
4export 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}