decord/source/actions/ChannelPinActionCreators.tsx

307 lines
11 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 11222
// Function ID: 11223
// Dependencies: [5, 11223, 676, 7368, 530, 4278, 1236, 4744, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 11222
2026-08-24 06:08:38 +00:00
import dispatcherDefault from "dispatcher" /* 709 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "handleChannelDelete" /* 11223 */;
import { FetchState } from "handleChannelDelete" /* 11223 */;
2026-08-24 06:08:38 +00:00
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
({ AbortCodes: closure_6, Endpoints: error, MAX_PINS_PER_CHANNEL: closure_8 } = ME);
2026-07-23 10:11:24 +00:00
let obj = {
2026-07-29 08:29:29 +00:00
pinMessage(id, id2) {
2026-08-24 06:08:38 +00:00
closure_0 = id;
closure_1 = id2;
2026-07-29 08:29:29 +00:00
return callback(function*() {
if (c3 === 2) {
c3 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp5 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
2026-08-24 06:08:38 +00:00
obj = { value: null, done: true };
2026-07-29 08:29:29 +00:00
obj[0] = arg1;
return obj;
} else {
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === dependencyMap) {
if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c1 = tmp2;
c0 = tmp3;
c0 = undefined;
c1 = undefined;
2026-08-24 06:08:38 +00:00
({ id: c0, name: c1 } = closure_1_0);
2026-08-25 06:04:03 +00:00
obj1 = closure_1_1(7368);
2026-07-29 08:29:29 +00:00
dependencyMap = 1;
c3 = 1;
obj1 = { value: null, done: false };
2026-08-24 06:08:38 +00:00
obj1[0] = obj1.unarchiveThreadIfNecessary(closure_1_0.id);
2026-07-29 08:29:29 +00:00
return obj1;
}
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
const HTTP = closure_1_0(530).HTTP;
2026-07-29 08:29:29 +00:00
const obj2 = { url: null, rejectWithError: true };
2026-08-24 06:08:38 +00:00
obj2[0] = closure_1_7.PIN(c0, c1);
2026-07-29 08:29:29 +00:00
HTTP.put(obj2).catch((arg0) => {
2026-08-25 06:04:03 +00:00
const aPIError = new closure_2_0(4278).APIError(arg0);
2026-07-29 08:29:29 +00:00
const code = aPIError.code;
2026-08-24 06:08:38 +00:00
const intl = closure_2_0(1236).intl;
const intl2 = closure_2_0(1236).intl;
let stringResult1 = intl2.string(closure_2_0(1236).t.fEptJP);
let stringResult3 = intl.string(closure_2_0(1236).t.j2d6Km);
2026-07-29 08:29:29 +00:00
if (null != code) {
2026-08-24 06:08:38 +00:00
if (closure_2_6.TOO_MANY_PINS_IN_CHANNEL === code) {
2026-07-29 08:29:29 +00:00
const intl15 = tmp(1236).intl;
const stringResult2 = intl15.string(tmp(1236).t.HI88Q3);
const intl16 = tmp(1236).intl;
const formatToPlainString = intl16.formatToPlainString;
let t = tmp(1236).t;
if (isPrivateResult) {
t = { maxPins: null };
2026-08-24 06:08:38 +00:00
t[0] = closure_2_8;
2026-07-29 08:29:29 +00:00
let formatToPlainStringResult = formatToPlainString(t.Q89oQU, t);
} else {
2026-08-24 06:08:38 +00:00
obj = { maxPins: null, channelName: null };
obj[0] = closure_2_8;
2026-07-29 08:29:29 +00:00
obj[1] = c1;
formatToPlainStringResult = formatToPlainString(t.NnO1S5, obj);
}
isPrivateResult = _undefined.isPrivate();
} else if (tmp18.INVALID_ACCESS === code) {
const intl13 = tmp(1236).intl;
stringResult3 = intl13.string(tmp(1236).t["25gfQX"]);
const intl14 = tmp(1236).intl;
stringResult1 = intl14.string(tmp(1236).t.QNnTwN);
} else if (tmp18.INVALID_PIN_MESSAGE_CHANNEL === code) {
const intl11 = tmp(1236).intl;
stringResult3 = intl11.string(tmp(1236).t["Q5G6+m"]);
const intl12 = tmp(1236).intl;
stringResult1 = intl12.string(tmp(1236).t["5hgPfC"]);
} else if (tmp18.INVALID_THREAD_ARCHIVE_STATE === code) {
const intl9 = tmp(1236).intl;
stringResult3 = intl9.string(tmp(1236).t.fu6Lbl);
const intl10 = tmp(1236).intl;
stringResult1 = intl10.string(tmp(1236).t.FmrcZM);
} else if (tmp18.INVALID_ACTION_SYSTEM_MESSAGE === code) {
const intl7 = tmp(1236).intl;
stringResult3 = intl7.string(tmp(1236).t["zV0/FC"]);
const intl8 = tmp(1236).intl;
stringResult1 = intl8.string(tmp(1236).t.C4a7xI);
} else if (tmp18.UNKNOWN_MESSAGE === code) {
const intl5 = tmp(1236).intl;
stringResult3 = intl5.string(tmp(1236).t.fkqPro);
const intl6 = tmp(1236).intl;
stringResult1 = intl6.string(tmp(1236).t.H6fRIg);
} else {
const intl3 = tmp(1236).intl;
let anyErrorMessage = aPIError.getAnyErrorMessage();
if (anyErrorMessage == null) {
const intl4 = tmp(1236).intl;
anyErrorMessage = intl4.string(tmp(1236).t.fEptJP);
}
stringResult1 = anyErrorMessage;
stringResult3 = intl3.string(tmp(1236).t.HI88Q3);
const stringResult4 = intl3.string(tmp(1236).t.HI88Q3);
}
}
2026-08-24 06:08:38 +00:00
const stringResult = intl.string(closure_2_0(1236).t.j2d6Km);
2026-07-29 08:29:29 +00:00
obj = { title: stringResult3, body: stringResult1, confirmText: null };
const intl17 = tmp(1236).intl;
2026-08-24 06:08:38 +00:00
obj[2] = intl17.string(closure_2_0(1236).t.BddRzS);
2026-08-25 06:04:03 +00:00
closure_2_1(4744).show(obj);
2026-07-29 08:29:29 +00:00
});
c3 = 3;
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} catch (tmp10) {
c3 = tmp;
throw tmp10;
}
}
})();
2026-07-20 16:05:17 +00:00
},
2026-07-29 08:29:29 +00:00
unpinMessage(id, id2) {
2026-08-24 06:08:38 +00:00
closure_0 = id;
closure_1 = id2;
2026-07-29 08:29:29 +00:00
return callback(function*() {
if (c3 === 2) {
c3 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
2026-08-24 06:08:38 +00:00
obj = { value: null, done: true };
2026-07-29 08:29:29 +00:00
obj[0] = arg1;
return obj;
} else {
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === dependencyMap) {
if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp4;
id = tmp4;
2026-08-25 06:04:03 +00:00
obj1 = closure_1_1(7368);
2026-07-29 08:29:29 +00:00
dependencyMap = 1;
c3 = 1;
obj1 = { value: null, done: false };
2026-08-24 06:08:38 +00:00
obj1[0] = obj1.unarchiveThreadIfNecessary(closure_1_0.id);
2026-07-29 08:29:29 +00:00
return obj1;
}
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
const HTTP = closure_1_0(530).HTTP;
2026-07-29 08:29:29 +00:00
const obj2 = { url: null, oldFormErrors: true, rejectWithError: true };
2026-08-24 06:08:38 +00:00
obj2[0] = closure_1_7.PIN(id.id, closure_1);
2026-07-29 08:29:29 +00:00
HTTP.del(obj2).catch(() => {
2026-08-25 06:04:03 +00:00
obj = callback2(4744);
2026-07-29 08:29:29 +00:00
obj = { title: null, body: null, confirmText: null, cancelText: null, onConfirm: null };
2026-08-24 06:08:38 +00:00
const intl = callback(1236).intl;
obj[0] = intl.string(callback(1236).t.xFjByk);
const intl2 = callback(1236).intl;
obj[1] = intl2.string(callback(1236).t["0R/Toc"]);
const intl3 = callback(1236).intl;
obj[2] = intl3.string(callback(1236).t["7NqTJn"]);
const intl4 = callback(1236).intl;
obj[3] = intl4.string(callback(1236).t["ETE/oC"]);
const unpinMessage = closure_1_9.unpinMessage;
obj[4] = unpinMessage.bind(closure_1_9, callback, callback2);
2026-07-29 08:29:29 +00:00
return obj.show(obj);
});
c3 = 3;
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} catch (tmp8) {
c3 = tmp;
throw tmp8;
}
}
})();
2026-07-20 16:05:17 +00:00
},
2026-07-29 08:29:29 +00:00
ackPins(channelId) {
2026-08-24 06:08:38 +00:00
obj = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj = { type: "CHANNEL_PINS_ACK", channelId };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
},
fetchPins(channelId, reset) {
2026-07-23 10:11:24 +00:00
const _require = channelId;
2026-07-29 08:29:29 +00:00
let flag;
if (reset != null) {
flag = reset.reset;
}
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let num;
if (reset != null) {
num = reset.limit;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 25;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (reset != null) {
2026-07-20 16:05:17 +00:00
const before = reset.before;
}
2026-07-29 08:29:29 +00:00
let tmp = flag;
if (!flag) {
let length = pins.getPins(channelId);
let flag2 = true;
if (null != length) {
const state = length.state;
flag2 = true;
2026-07-20 16:05:17 +00:00
if (FetchState.FAILED !== state) {
2026-07-29 08:29:29 +00:00
flag2 = false;
if (tmp3.LOADING !== state) {
flag2 = false;
if (tmp3.LOADED_FINISHED !== state) {
if (tmp3.LOADED_HAS_MORE === state) {
2026-07-20 16:05:17 +00:00
if (null == before) {
2026-07-29 08:29:29 +00:00
length = length.items.length;
let tmp4 = 0 === length;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const items = length.items;
tmp4 = items.at(-1).pinnedAt === before;
2026-07-20 16:05:17 +00:00
}
}
}
}
}
}
2026-07-29 08:29:29 +00:00
tmp = flag2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp) {
2026-08-24 06:08:38 +00:00
obj = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj = { type: "LOAD_PINNED_MESSAGES", channelId: null, reset: null };
obj[1] = channelId;
obj[2] = flag;
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
const HTTP = _require(530).HTTP;
obj = { url: null, query: null, retries: 2, oldFormErrors: true, rejectWithError: true };
obj[0] = closure_7.PINS(channelId);
2026-08-24 06:08:38 +00:00
obj1 = { limit: null, before: null };
2026-07-29 08:29:29 +00:00
obj1[0] = num;
2026-07-20 16:05:17 +00:00
let toISOStringResult;
2026-07-29 08:29:29 +00:00
if (before != null) {
2026-07-20 16:05:17 +00:00
toISOStringResult = before.toISOString();
}
2026-07-29 08:29:29 +00:00
obj1[1] = toISOStringResult;
obj[1] = obj1;
2026-07-20 16:05:17 +00:00
const value = HTTP.get(obj);
value.then((body) => {
2026-08-24 06:08:38 +00:00
obj = closure_1_1(closure_1_2[8]);
2026-07-23 10:11:24 +00:00
obj = { type: "LOAD_PINNED_MESSAGES_SUCCESS", pins: body.body.items, channelId: closure_0, hasMore: body.body.has_more };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
}, () => {
2026-08-24 06:08:38 +00:00
obj = closure_1_1(closure_1_2[8]);
2026-07-23 10:11:24 +00:00
obj = { type: "LOAD_PINNED_MESSAGES_FAILURE", channelId: closure_0 };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
});
}
}
};
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("actions/ChannelPinActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export default obj;