Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $rootScope.getUserInfo = (conversation) => {
- setTimeout(() => {
- this.userinfoService.getUserInfo(conversation.profile_id, conversation.chat_id, conversation.fanpage_id, (res) => {
- let name_default = 'Khách hàng';
- let user_info = {
- name: name_default,
- tag: [],
- avatar: '/boxchat/assets/images/default-profile-picture.jpg'
- };
- $.each(res.data, function (index, value) {
- user_info[index] = value;
- });
- if (user_info.name === name_default && $rootScope.activeConversation.fullname !== name_default) {
- user_info.name = $rootScope.activeConversation.fullname;
- }
- else {
- if (user_info.name.length > 0) {
- $rootScope.activeConversation.fullname = user_info.name;
- }
- }
- if (!this.$rootScope.user.tag) {
- this.$rootScope.user.tag = [];
- }
- this.$rootScope.user.avatar = $rootScope.activeConversation.avatar;
- if ($rootScope.activeConversation.tag) {
- $rootScope.activeConversation.tag.forEach((item) => {
- user_info.tag.push(item);
- });
- }
- this.$rootScope.user = user_info;
- $rootScope.getAnswerofQuicktag();
- console.log(this.$rootScope.user);
- if (conversation.unread_message > 0) {
- let text = '';
- for (let i = 0; i < Conversation.unread_message; i++) {
- text += this.$rootScope.chatHistory[i].bodyMsg.msg + ' ';
- }
- $rootScope.checkEmailOrPhone(text);
- }
- });
- }, 100)
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement