Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/message/amd/build/
Upload File :
Current File : /var/www/ljmtc/cbt/message/amd/build/message_repository.min.js

define ("core_message/message_repository",["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,c){var d=c.map(function(b){return{touserid:a,text:b}});return b.call([{methodname:"core_message_send_instant_messages",args:{messages:d}}])[0].then(function(a){var b=a.reduce(function(a,b){if(b.errormessage){a.push(b.errormessage)}return 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}})})},g=function(a,c){var d=c.map(function(a){return{text:a}});return b.call([{methodname:"core_message_send_messages_to_conversation",args:{conversationid:a,messages:d}}])[0]};return{countUnreadConversations:function countUnreadConversations(a){var d=b.call([{methodname:"core_message_get_unread_conversations_count",args:a}])[0];d.fail(c.exception);return d},getContacts:function getContacts(a,c,d){var e={userid:a};if("undefined"!=typeof c){e.limitnum=c}if("undefined"!=typeof d){e.limitfrom=d}return b.call([{methodname:"core_message_get_user_contacts",args:e}])[0]},blockUser:function blockUser(c,d){return a.when.apply(null,b.call([{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}}])).then(function(a,b){return b.length?b[0]:{}})},unblockUser:function unblockUser(c,d){return a.when.apply(null,b.call([{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}}])).then(function(a,b){return b.length?b[0]:{}})},createContactRequest:function createContactRequest(a,c){return b.call([{methodname:"core_message_create_contact_request",args:{userid:a,requesteduserid:c}}])[0]},deleteContacts:function deleteContacts(c,d){return a.when.apply(null,b.call([{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}}])).then(function(a,b){return b})},getMessages:function getMessages(a,c,d,e,f,g){var h={currentuserid:a,convid:c,newest:f?!0:!1};if("undefined"!=typeof d){h.limitnum=d}if("undefined"!=typeof e){h.limitfrom=e}if("undefined"!=typeof g){h.timefrom=g}return b.call([{methodname:"core_message_get_conversation_messages",args:h}])[0]},searchUsers:function searchUsers(a,c,d,e){var f={userid:a,search:c};if("undefined"!=typeof d){f.limitnum=d}if("undefined"!=typeof e){f.limitfrom=e}return b.call([{methodname:"core_message_message_search_users",args:f}])[0]},searchMessages:function searchMessages(a,c,d,e){var f={userid:a,search:c};if("undefined"!=typeof d){f.limitnum=d}if("undefined"!=typeof e){f.limitfrom=e}return b.call([{methodname:"core_message_data_for_messagearea_search_messages",args:f}])[0]},sendMessagesToUser:f,sendMessageToUser:function sendMessageToUser(a,b){return f(a,[b]).then(function(a){return a[0]})},sendMessagesToConversation:g,sendMessageToConversation:function sendMessageToConversation(a,b){return g(a,[b]).then(function(a){return a[0]})},savePreferences:function savePreferences(a,c){return b.call([{methodname:"core_user_update_user_preferences",args:{userid:a,preferences:c}}])[0]},getPreferences:function getPreferences(a){return b.call([{methodname:"core_user_get_user_preferences",args:{userid:a}}])[0]},deleteMessages:function deleteMessages(c,d){return a.when.apply(null,b.call(d.map(function(a){return{methodname:"core_message_delete_message",args:{messageid:a,userid:c}}})))},deleteMessagesForAllUsers:function deleteMessagesForAllUsers(c,d){return a.when.apply(null,b.call(d.map(function(a){return{methodname:"core_message_delete_message_for_all_users",args:{messageid:a,userid:c}}})))},deleteConversation:function deleteConversation(a,c){return b.call([{methodname:"core_message_delete_conversations_by_id",args:{userid:a,conversationids:[c]}}])[0]},getContactRequests:function getContactRequests(a){return b.call([{methodname:"core_message_get_contact_requests",args:{userid:a}}])[0]},acceptContactRequest:function acceptContactRequest(c,d){return a.when.apply(null,b.call([{methodname:"core_message_confirm_contact_request",args:{userid:c,requesteduserid:d}},{methodname:"core_message_get_member_info",args:{referenceuserid:d,userids:[c],includecontactrequests:!0,includeprivacyinfo:!0}}])).then(function(a,b){return b.length?b[0]:{}})},declineContactRequest:function declineContactRequest(c,d){return a.when.apply(null,b.call([{methodname:"core_message_decline_contact_request",args:{userid:c,requesteduserid:d}},{methodname:"core_message_get_member_info",args:{referenceuserid:d,userids:[c],includecontactrequests:!0,includeprivacyinfo:!0}}])).then(function(a,b){return b.length?b[0]:{}})},getConversation:function getConversation(a,c,d,e,f,g,h,i,j){var k={userid:a,conversationid:c};if("undefined"!=typeof d&&null!==d){k.includecontactrequests=d}if("undefined"!=typeof e&&null!==e){k.includeprivacyinfo=e}if("undefined"!=typeof f&&null!==f){k.memberlimit=f}if("undefined"!=typeof g&&null!==g){k.memberoffset=g}if("undefined"!=typeof h&&null!==h){k.messagelimit=h}if("undefined"!=typeof i&&null!==i){k.messageoffset=i}if("undefined"!=typeof j&&null!==j){k.newestmessagesfirst=j}return b.call([{methodname:"core_message_get_conversation",args:k}])[0]},getConversationBetweenUsers:function getConversationBetweenUsers(a,c,d,e,f,g,h,i,j){var k={userid:a,otheruserid:c};if("undefined"!=typeof d&&null!==d){k.includecontactrequests=d}if("undefined"!=typeof e&&null!==e){k.includeprivacyinfo=e}if("undefined"!=typeof f&&null!==f){k.memberlimit=f}if("undefined"!=typeof g&&null!==g){k.memberoffset=g}if("undefined"!=typeof h&&null!==h){k.messagelimit=h}if("undefined"!=typeof i&&null!==i){k.messageoffset=i}if("undefined"!=typeof j&&null!==j){k.newestmessagesfirst=j}return b.call([{methodname:"core_message_get_conversation_between_users",args:k}])[0]},getSelfConversation:function getSelfConversation(a,c,d,e){var f={userid:a};if("undefined"!=typeof c&&null!==c){f.messagelimit=c}if("undefined"!=typeof d&&null!==d){f.messageoffset=d}if("undefined"!=typeof e&&null!==e){f.newestmessagesfirst=e}return b.call([{methodname:"core_message_get_self_conversation",args:f}])[0]},getConversations:function getConversations(a,c,d,f,g,h){var i={userid:a,type:c};if("undefined"!=typeof d&&null!==d){i.limitnum=d}if("undefined"!=typeof f&&null!==f){i.limitfrom=f}if("undefined"!=typeof g&&null!==g){i.favourites=g}if("undefined"!=typeof h&&null!==h){i.mergeself=h}return b.call([{methodname:"core_message_get_conversations",args:i}])[0].then(function(a){if(a.conversations.length){a.conversations=a.conversations.map(function(a){if(a.type==e.PRIVATE||a.type==e.SELF){var b=a.members.length?a.members[0]:null;if(b){a.name=a.name?a.name:b.fullname;a.imageurl=a.imageurl?a.imageurl:b.profileimageurl}}return a})}return a})},getConversationMembers:function getConversationMembers(a,c,d,e,f){var g={userid:c,conversationid:a};if("undefined"!=typeof d&&null!==d){g.limitnum=d}if("undefined"!=typeof e&&null!==e){g.limitfrom=e}if("undefined"!=typeof f&&null!==f){g.includecontactrequests=f}return b.call([{methodname:"core_message_get_conversation_members",args:g}])[0]},setFavouriteConversations:function setFavouriteConversations(a,c){return b.call([{methodname:"core_message_set_favourite_conversations",args:{userid:a,conversations:c}}])[0]},setMutedConversations:function setMutedConversations(a,c){return b.call([{methodname:"core_message_mute_conversations",args:{userid:a,conversationids:c}}])[0]},unsetFavouriteConversations:function unsetFavouriteConversations(a,c){return b.call([{methodname:"core_message_unset_favourite_conversations",args:{userid:a,conversations:c}}])[0]},unsetMutedConversations:function unsetMutedConversations(a,c){return b.call([{methodname:"core_message_unmute_conversations",args:{userid:a,conversationids:c}}])[0]},getMemberInfo:function getMemberInfo(a,c,d,e){var f={referenceuserid:a,userids:c};if("undefined"!=typeof d){f.includecontactrequests=d}if("undefined"!=typeof e){f.includeprivacyinfo=e}return b.call([{methodname:"core_message_get_member_info",args:f}])[0]},markAllConversationMessagesAsRead:function markAllConversationMessagesAsRead(a,c){return b.call([{methodname:"core_message_mark_all_conversation_messages_as_read",args:{userid:a,conversationid:c}}])[0]},getUserMessagePreferences:function getUserMessagePreferences(a){return b.call([{methodname:"core_message_get_user_message_preferences",args:{userid:a}}])[0]},getTotalConversationCounts:function getTotalConversationCounts(a){return b.call([{methodname:"core_message_get_conversation_counts",args:{userid:a}}])[0]},getUnreadConversationCounts:function getUnreadConversationCounts(a){return b.call([{methodname:"core_message_get_unread_conversation_counts",args:{userid:a}}])[0]},getAllConversationCounts:function getAllConversationCounts(c){return a.when.apply(null,b.call([{methodname:"core_message_get_conversation_counts",args:{userid:c}},{methodname:"core_message_get_unread_conversation_counts",args:{userid:c}}])).then(function(a,b){return{total:a,unread:b}})}}});
//# sourceMappingURL=message_repository.min.js.map