{"version":3,"sources":["https:\/\/vlm2.ub.ac.id\/mod\/forum\/amd\/src\/repository.js"],"names":["define","Ajax","setDiscussionSubscriptionState","forumId","discussionId","targetState","call","methodname","args","forumid","discussionid","targetstate","addDiscussionPost","postid","subject","message","messageformat","isprivatereply","topreferredformat","options","name","value","setDiscussionLockState","setFavouriteDiscussionState","setPinDiscussionState","getDiscussionByUserID","userid","cmid","sortby","sortdirection","getDiscussionPosts"],"mappings":"AAwBAA,OAAM,wBAAC,CAAC,WAAD,CAAD,CAAgB,SAASC,CAAT,CAAe,CAoIjC,MAAO,CACHC,8BAA8B,CA5HG,QAAjCA,CAAAA,8BAAiC,CAASC,CAAT,CAAkBC,CAAlB,CAAgCC,CAAhC,CAA6C,CAS9E,MAAOJ,CAAAA,CAAI,CAACK,IAAL,CAAU,CARH,CACVC,UAAU,CAAE,kCADF,CAEVC,IAAI,CAAE,CACFC,OAAO,CAAEN,CADP,CAEFO,YAAY,CAAEN,CAFZ,CAGFO,WAAW,CAAEN,CAHX,CAFI,CAQG,CAAV,EAAqB,CAArB,CACV,CAiHM,CAEHO,iBAAiB,CAjHG,QAApBA,CAAAA,iBAAoB,CAASC,CAAT,CAAiBC,CAAjB,CAA0BC,CAA1B,CAAmCC,CAAnC,CAAkDC,CAAlD,CAAkEC,CAAlE,CAAqF,CAiBzG,MAAOjB,CAAAA,CAAI,CAACK,IAAL,CAAU,CAhBH,CACVC,UAAU,CAAE,+BADF,CAEVC,IAAI,CAAE,CACFK,MAAM,CAAEA,CADN,CAEFE,OAAO,CAAEA,CAFP,CAGFC,aAAa,CAAEA,CAHb,CAIFF,OAAO,CAAEA,CAJP,CAKFK,OAAO,CAAE,CAAC,CACNC,IAAI,CAAE,SADA,CAENC,KAAK,CAAEJ,CAFD,CAAD,CAGN,CACCG,IAAI,CAAE,mBADP,CAECC,KAAK,CAAEH,CAFR,CAHM,CALP,CAFI,CAgBG,CAAV,EAAqB,CAArB,CACV,CA6FM,CAGHI,sBAAsB,CA3EG,Q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G,CAAV,EAAqB,CAArB,CACV,CAsBM,CAOHC,kBAAkB,CAnBG,QAArBA,CAAAA,kBAAqB,CAAS1B,CAAT,CAAkE,IAA3CwB,CAAAA,CAA2C,wDAAlC,SAAkC,CAAvBC,CAAuB,wDAAP,KAAO,CASvF,MAAO5B,CAAAA,CAAI,CAACK,IAAL,CAAU,CARH,CACVC,UAAU,CAAE,gCADF,CAEVC,IAAI,CAAE,CACFE,YAAY,CAAEN,CADZ,CAEFwB,MAAM,CAAEA,CAFN,CAGFC,aAAa,CAAEA,CAHb,CAFI,CAQG,CAAV,EAAqB,CAArB,CACV,CAEM,CASV,CA7IK,CAAN","sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/\n\/\/\n\/\/ Moodle is free software: you can redistribute it and\/or modify\n\/\/ it under the terms of the GNU General Public License as published by\n\/\/ the Free Software Foundation, either version 3 of the License, or\n\/\/ (at your option) any later version.\n\/\/\n\/\/ Moodle is distributed in the hope that it will be useful,\n\/\/ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\/\/ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\/\/ GNU General Public License for more details.\n\/\/\n\/\/ You should have received a copy of the GNU General Public License\n\/\/ along with Moodle. If not, see .\n\n\/**\n * Forum repository class to encapsulate all of the AJAX requests that subscribe or unsubscribe\n * can be sent for forum.\n *\n * @module mod_forum\/repository\n * @package mod_forum\n * @copyright 2019 Andrew Nicols \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\ndefine(['core\/ajax'], function(Ajax) {\n \/**\n * Set the subscription state for a discussion in a forum.\n *\n * @param {number} forumId ID of the forum the discussion belongs to\n * @param {number} discussionId ID of the discussion with the subscription state\n * @param {boolean} targetState Set the subscribed state. True == subscribed; false == unsubscribed.\n * @return {object} jQuery promise\n *\/\n var setDiscussionSubscriptionState = function(forumId, discussionId, targetState) {\n var request = {\n methodname: 'mod_forum_set_subscription_state',\n args: {\n forumid: forumId,\n discussionid: discussionId,\n targetstate: targetState\n }\n };\n return Ajax.call([request])[0];\n };\n\n var addDiscussionPost = function(postid, subject, message, messageformat, isprivatereply, topreferredformat) {\n var request = {\n methodname: 'mod_forum_add_discussion_post',\n args: {\n postid: postid,\n message: message,\n messageformat: messageformat,\n subject: subject,\n options: [{\n name: \"private\",\n value: isprivatereply,\n }, {\n name: \"topreferredformat\",\n value: topreferredformat,\n }]\n }\n };\n return Ajax.call([request])[0];\n };\n\n \/**\n * Set the favourite state for a discussion in a forum.\n *\n * @param {number} forumId ID of the forum the discussion belongs to\n * @param {number} discussionId ID of the discussion with the subscription state\n * @param {null|date} targetState Set the favourite state. True == favourited; false == unfavourited.\n * @return {object} jQuery promise\n *\/\n var setFavouriteDiscussionState = function(forumId, discussionId, targetState) {\n var request = {\n methodname: 'mod_forum_toggle_favourite_state',\n args: {\n discussionid: discussionId,\n targetstate: targetState\n }\n };\n return Ajax.call([request])[0];\n };\n\n var setDiscussionLockState = function(forumId, discussionId, targetState) {\n var request = {\n methodname: 'mod_forum_set_lock_state',\n args: {\n forumid: forumId,\n discussionid: discussionId,\n targetstate: targetState}\n };\n return Ajax.call([request])[0];\n };\n\n \/**\n * Set the pinned state for the discussion provided.\n *\n * @param {number} forumid\n * @param {number} discussionid\n * @param {boolean} targetstate\n * @return {*|Promise}\n *\/\n var setPinDiscussionState = function(forumid, discussionid, targetstate) {\n var request = {\n methodname: 'mod_forum_set_pin_state',\n args: {\n discussionid: discussionid,\n targetstate: targetstate\n }\n };\n return Ajax.call([request])[0];\n };\n\n \/**\n * Get the discussions for the user and cmid provided.\n *\n * @param {number} userid\n * @param {number} cmid\n * @param {string} sortby\n * @param {string} sortdirection\n * @return {*|Promise}\n *\/\n var getDiscussionByUserID = function(userid, cmid, sortby = 'modified', sortdirection = 'DESC') {\n var request = {\n methodname: 'mod_forum_get_discussion_posts_by_userid',\n args: {\n userid: userid,\n cmid: cmid,\n sortby: sortby,\n sortdirection: sortdirection,\n },\n };\n return Ajax.call([request])[0];\n };\n\n \/**\n * Get the posts for the discussion ID provided.\n *\n * @param {number} discussionId\n * @param {String} sortby\n * @param {String} sortdirection\n * @return {*|Promise}\n *\/\n var getDiscussionPosts = function(discussionId, sortby = 'created', sortdirection = 'ASC') {\n var request = {\n methodname: 'mod_forum_get_discussion_posts',\n args: {\n discussionid: discussionId,\n sortby: sortby,\n sortdirection: sortdirection,\n },\n };\n return Ajax.call([request])[0];\n };\n\n return {\n setDiscussionSubscriptionState: setDiscussionSubscriptionState,\n addDiscussionPost: addDiscussionPost,\n setDiscussionLockState: setDiscussionLockState,\n setFavouriteDiscussionState: setFavouriteDiscussionState,\n setPinDiscussionState: setPinDiscussionState,\n getDiscussionByUserID: getDiscussionByUserID,\n getDiscussionPosts: getDiscussionPosts,\n };\n});\n"],"file":"repository.min.js"}