OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
43
app/Domain/Reactions/Js/reactionsController.js
Normal file
43
app/Domain/Reactions/Js/reactionsController.js
Normal file
@@ -0,0 +1,43 @@
|
||||
leantime.reactionsController = (function () {
|
||||
|
||||
|
||||
//Functions
|
||||
|
||||
let addReactions = function (module, moduleId, reaction, clb) {
|
||||
|
||||
leantime.rpc('Reactions.Reactions.react', {
|
||||
module: module,
|
||||
moduleId: moduleId,
|
||||
reaction: reaction
|
||||
}).then(function (success) {
|
||||
// The service returns false when the reaction was not applied
|
||||
// (e.g. the user already reacted) — only update the UI on success.
|
||||
if (success) {
|
||||
clb();
|
||||
}
|
||||
}).catch(function (e) { console.error('Could not add reaction', e); });
|
||||
|
||||
};
|
||||
|
||||
let removeReaction = function (module, moduleId, reaction, clb) {
|
||||
|
||||
leantime.rpc('Reactions.Reactions.unreact', {
|
||||
module: module,
|
||||
moduleId: moduleId,
|
||||
reaction: reaction
|
||||
}).then(function (success) {
|
||||
// Only update the UI when the reaction was actually removed.
|
||||
if (success) {
|
||||
clb();
|
||||
}
|
||||
}).catch(function (e) { console.error('Could not remove reaction', e); });
|
||||
|
||||
};
|
||||
|
||||
// Make public what you want to have public, everything else is private
|
||||
return {
|
||||
addReactions:addReactions,
|
||||
removeReaction:removeReaction
|
||||
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user