403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/ilovecveti.ru/bitrix/js/im/mixin/src/dialog/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/ilovecveti.ru/bitrix/js/im/mixin/src/dialog/dialogCore.js
import { Vuex } from "ui.vue.vuex";
import { BitrixVue } from "ui.vue";
import { Timer } from "im.lib.timer";
import {DialogState} from 'im.const';

/**
 * @notice you need to provide this.userId and this.dialogId
 */
export const DialogCore = {
	data()
	{
		return {
			dialogState: DialogState.loading
		}
	},
	created()
	{
		this.timer = new Timer();
	},
	methods: {
		getController()
		{
			return this.$Bitrix.Data.get('controller');
		},
		getApplicationController()
		{
			return this.getController().application;
		},
		getApplication()
		{
			return this.$Bitrix.Application.get();
		},
		getRestClient()
		{
			return this.$Bitrix.RestClient.get();
		},
		getCurrentUser()
		{
			return this.$store.getters['users/get'](this.application.common.userId, true);
		},
		executeRestAnswer(method, queryResult, extra)
		{
			this.getController().executeRestAnswer(method, queryResult, extra);
		},
		isUnreadMessagesLoaded()
		{
			if (!this.dialog)
			{
				return true;
			}

			if (this.dialog.lastMessageId <= 0)
			{
				return true;
			}

			if (!this.messageCollection || this.messageCollection.length <= 0)
			{
				return true;
			}

			let lastElementId = 0;
			for (let index = this.messageCollection.length-1; index >= 0; index--)
			{
				const lastElement = this.messageCollection[index];
				if (typeof lastElement.id === "number")
				{
					lastElementId = lastElement.id;
					break;
				}
			}

			return lastElementId >= this.dialog.lastMessageId;
		},
		//methods used in several mixins
		openDialog()
		{
			//TODO
		}
	},
	computed: {
		dialog()
		{
			const dialog = this.$store.getters['dialogues/get'](this.application.dialog.dialogId);

			return dialog? dialog: this.$store.getters['dialogues/getBlank']();
		},
		chatId()
		{
			// if (this.dialog)
			// {
			// 	return this.dialog.chatId;
			// }

			if (this.application)
			{
				return this.application.dialog.chatId;
			}
		},
		// userId()
		// {
		// 	return this.application.common.userId;
		// },
		diskFolderId()
		{
			return this.application.dialog.diskFolderId;
		},
		messageCollection()
		{
			return this.$store.getters['messages/get'](this.application.dialog.chatId);
		},
		isDialogShowingMessages()
		{
			const messagesNotEmpty = this.messageCollection && this.messageCollection.length > 0;
			if (messagesNotEmpty)
			{
				this.dialogState = DialogState.show;
			}
			else if (this.dialog && this.dialog.init)
			{
				this.dialogState = DialogState.empty;
			}
			else
			{
				this.dialogState = DialogState.loading;
			}

			return messagesNotEmpty;
		},
		isDarkBackground()
		{
			return this.application.options.darkBackground;
		},
		...Vuex.mapState({
			application: state => state.application,
		}),
		localize()
		{
			return BitrixVue.getFilteredPhrases(['IM_DIALOG_', 'IM_UTILS_', 'IM_MESSENGER_DIALOG_', 'IM_QUOTE_'], this);
		},
	}
};

Youez - 2016 - github.com/yon3zu
LinuXploit