You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
9.5 KiB
1 line
9.5 KiB
2 years ago
|
define(["jquery","core/ajax","core/notification","core_message/message_drawer_view_conversation_constants"],function(a,b,c,d){var e=d.CONVERSATION_TYPES,f=function(a){"undefined"==typeof a.limit&&(a.limit=0),"undefined"==typeof a.offset&&(a.offset=0),"undefined"==typeof a.type&&(a.type=null),"undefined"==typeof a.favouritesonly&&(a.favouritesonly=!1),a.limitfrom=a.offset,a.limitnum=a.limit,delete a.limit,delete a.offset;var d={methodname:"core_message_data_for_messagearea_conversations",args:a},e=b.call([d])[0];return e.fail(c.exception),e},g=function(a){var d={methodname:"core_message_get_unread_conversations_count",args:a},e=b.call([d])[0];return e.fail(c.exception),e},h=function(a){var d={methodname:"core_message_mark_all_messages_as_read",args:a},e=b.call([d])[0];return e.fail(c.exception),e},i=function(a,c,d){var e={userid:a};"undefined"!=typeof c&&(e.limitnum=c),"undefined"!=typeof d&&(e.limitfrom=d);var f={methodname:"core_message_get_user_contacts",args:e};return b.call([f])[0]},j=function(a,c){var d={methodname:"core_message_data_for_messagearea_get_profile",args:{currentuserid:a,otheruserid:c}};return b.call([d])[0]},k=function(c,d){var e=[{methodname:"core_message_block_user",args:{userid:c,blockeduserid:d}},{methodname:"core_message_get_member_info",args:{referenceuserid:c,userids:[d],includecontactrequests:!0,includeprivacyinfo:!0}}];return a.when.apply(null,b.call(e)).then(function(a,b){return b.length?b[0]:{}})},l=function(c,d){var e=[{methodname:"core_message_unblock_user",args:{userid:c,unblockeduserid:d}},{methodname:"core_message_get_member_info",args:{referenceuserid:c,userids:[d],includecontactrequests:!0,includeprivacyinfo:!0}}];return a.when.apply(null,b.call(e)).then(function(a,b){return b.length?b[0]:{}})},m=function(a,c){var d={methodname:"core_message_create_contact_request",args:{userid:a,requesteduserid:c}};return b.call([d])[0]},n=function(c,d){var e=[{methodname:"core_message_delete_contacts",args:{userid:c,userids:d}},{methodname:"core_message_get_member_info",args:{referenceuserid:c,userids:d,includecontactrequests:!0,includeprivacyinfo:!0}}];return a.when.apply(null,b.call(e)).then(function(a,b){return b})},o=function(a,c,d,e,f,g){var h={currentuserid:a,convid:c,newest:!!f};"undefined"!=typeof d&&(h.limitnum=d),"undefined"!=typeof e&&(h.limitfrom=e),"undefined"!=typeof g&&(h.timefrom=g);var i={methodname:"core_message_get_conversation_messages",args:h};return b.call([i])[0]},p=function(a,c,d,e){var f={userid:a,search:c};"undefined"!=typeof d&&(f.limitnum=d),"undefined"!=typeof e&&(f.limitfrom=e);var g={methodname:"core_message_message_search_users",args:f};return b.call([g])[0]},q=function(a,c,d,e){var f={userid:a,search:c};"undefined"!=typeof d&&(f.limitnum=d),"undefined"!=typeof e&&(f.limitfrom=e);var g={methodname:"core_message_data_for_messagearea_search_messages",args:f};return b.call([g])[0]},r=function(a,c){var d=c.map(function(b){return{touserid:a,text:b}}),e={methodname:"core_message_send_instant_messages",args:{messages:d}};return b.call([e])[0].then(function(a){var b=a.reduce(function(a,b){return b.errormessage&&a.push(b.errormessage),a},[]);if(b.length)throw new Error(b.join("\n"));return a}).then(function(a){return a.map(function(a){return{id:a.msgid,text:a.text,timecreated:a.timecreated,useridfrom:a.useridfrom,conversationid:a.conversationid,candeletemessagesforallusers:a.candeletemessagesforallusers}})})},s=function(a,b){return r(a,[b]).then(function(a){return a[0]})},t=function(a,c){var d=c.map(function(a){return{text:a}}),e={methodname:"core_message_send_messages_to_conversation",args:{conversationid:a,messages:d}};return b.call([e])[0]},u=function(a,b){return t(a,[b]).then(function(a){return a[0]})},v=function(a,c){var d={methodname:"core_user_update_user_preferences",args:{userid:a,preferences:c}};return b.call([d])[0]},w=function(a){var c={methodname:"core_user_get_user_preferences",args:{userid:a}};return b.call([c])[0]},x=function(c,d){return a.when.apply(null,b.call(d.map(function(a){return{methodname:"core_message_delete_message",args:{messageid:a,userid:c}}})))}
|