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
12 KiB

define(["jquery","core/notification","core/str","core/templates","core/user_date","core_message/message_drawer_view_conversation_constants"],function(a,b,c,d,e,f){var g=f.SELECTORS,h=f.TEMPLATES,i=f.CONVERSATION_TYPES,j=function(a){return a.find(g.CONTENT_MESSAGES_CONTAINER)},k=function(a){j(a).removeClass("hidden")},l=function(a){j(a).addClass("hidden")},m=function(a){return a.find(g.SELF_CONVERSATION_MESSAGE_CONTAINER)},n=function(a){return m(a).addClass("hidden")},o=function(a){return a.find(g.CONTACT_REQUEST_SENT_MESSAGE_CONTAINER)},p=function(a){return o(a).addClass("hidden")},q=function(a){return a.find(g.CONTENT_MESSAGES_FOOTER_CONTAINER)},r=function(a){q(a).removeClass("hidden")},s=function(a){q(a).addClass("hidden")},t=function(a){return a.find(g.CONTENT_MESSAGES_FOOTER_EDIT_MODE_CONTAINER)},u=function(a){t(a).removeClass("hidden")},v=function(a){t(a).addClass("hidden")},w=function(a){return a.find(g.PLACEHOLDER_CONTAINER)},x=function(a){w(a).removeClass("hidden")},y=function(a){w(a).addClass("hidden")},z=function(a){return a.find(g.CONTENT_MESSAGES_FOOTER_REQUIRE_CONTACT_CONTAINER)},A=function(a){z(a).removeClass("hidden")},B=function(a){z(a).addClass("hidden")},C=function(a){return a.find(g.CONTENT_MESSAGES_FOOTER_REQUIRE_UNBLOCK_CONTAINER)},D=function(a){C(a).removeClass("hidden")},E=function(a){C(a).addClass("hidden")},F=function(a){return a.find(g.CONTENT_MESSAGES_FOOTER_UNABLE_TO_MESSAGE_CONTAINER)},G=function(a){F(a).removeClass("hidden")},H=function(a){F(a).addClass("hidden")},I=function(a){P(a),S(a),V(a)},J=function(a){s(a),v(a),y(a),B(a),E(a),H(a)},K=function(a){return a.find(g.CONTENT_PLACEHOLDER_CONTAINER)},L=function(a){K(a).removeClass("hidden")},M=function(a){K(a).addClass("hidden")},N=function(a){return a.find(g.HEADER)},O=function(a){N(a).removeClass("hidden")},P=function(a){N(a).addClass("hidden")},Q=function(a){return a.find(g.HEADER_EDIT_MODE)},R=function(a){Q(a).removeClass("hidden")},S=function(a){Q(a).addClass("hidden")},T=function(a){return a.find(g.HEADER_PLACEHOLDER_CONTAINER)},U=function(a){T(a).removeClass("hidden")},V=function(a){T(a).addClass("hidden")},W=function(a){return a.find(g.MESSAGE_TEXT_AREA)},X=function(a,b){var c=j(a);return c.find('[data-message-id="'+b+'"]')},Y=function(a,b){var c=j(a);return c.find('[data-day-id="'+b+'"]')},Z=function(a){return a.find(g.MORE_MESSAGES_LOADING_ICON_CONTAINER)},$=function(a){Z(a).removeClass("hidden")},_=function(a){Z(a).addClass("hidden")},aa=function(a){a.find(g.SEND_MESSAGE_BUTTON).prop("disabled",!0),W(a).prop("disabled",!0)},ba=function(a){a.find(g.SEND_MESSAGE_BUTTON).prop("disabled",!1),W(a).prop("disabled",!1)},ca=function(a){aa(a),a.find(g.SEND_MESSAGE_ICON_CONTAINER).addClass("hidden"),a.find(g.LOADING_ICON_CONTAINER).removeClass("hidden")},da=function(a){ba(a),a.find(g.SEND_MESSAGE_ICON_CONTAINER).removeClass("hidden"),a.find(g.LOADING_ICON_CONTAINER).addClass("hidden")},ea=function(a){var b=W(a);b.val(""),b.focus()},fa=function(a){return a.find(g.CONFIRM_DIALOGUE_CONTAINER)},ga=function(a){var b=fa(a),c=b.siblings(":not(.hidden)");c.attr("aria-hidden",!0),c.attr("tabindex",-1),c.attr("data-confirm-dialogue-hidden",!0),b.removeClass("hidden")},ha=function(a){var b=fa(a),c=b.siblings('[data-confirm-dialogue-hidden="true"]');c.removeAttr("aria-hidden"),c.removeAttr("tabindex"),c.removeAttr("data-confirm-dialogue-hidden"),b.addClass("hidden")},ia=function(a,b){Q(a).find(g.MESSAGES_SELECTED_COUNT).text(b)},ja=function(a,b){return a.map(function(a){return{id:a.id,isread:a.isRead,fromloggedinuser:a.fromLoggedInUser,userfrom:a.userFrom,text:a.text,formattedtime:b[a.timeCreated]}})},ka=function(b,c,e,f,g){var i=j(c),k=f.map(function(a){return d.render(h.DAY,{timestamp:a.value.timestamp,messages:ja(a.value.messages,g)})});return a.when.apply(a,k).then(function(){f.forEach(function(b,d){k[d].then(function(d){if(b.before){var e=Y(c,b.before.timestamp);return a(d).insertBefore(e)}return i.append(d)})["catch"](function(){})})})},la=function(b,c,e,f,i){var j=f.map(function(a){return a.value}),k=ja(j,i);return d.render(h.MESSAGES,{messages:k