Some fixes
This commit is contained in:
parent
ac1865f678
commit
7d7726d7cc
@ -25,7 +25,11 @@ const onAvatarUpdate = (peerId: number) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
rootScope.addEventListener('avatar_update', onAvatarUpdate);
|
rootScope.addEventListener('avatar_update', onAvatarUpdate);
|
||||||
rootScope.addEventListener('peer_title_edit', onAvatarUpdate);
|
rootScope.addEventListener('peer_title_edit', (peerId) => {
|
||||||
|
if(!appAvatarsManager.isAvatarCached(peerId)) {
|
||||||
|
onAvatarUpdate(peerId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export async function openAvatarViewer(target: HTMLElement, peerId: number, middleware: () => boolean, message?: any, prevTargets?: {element: HTMLElement, item: string | Message.messageService}[], nextTargets?: typeof prevTargets) {
|
export async function openAvatarViewer(target: HTMLElement, peerId: number, middleware: () => boolean, message?: any, prevTargets?: {element: HTMLElement, item: string | Message.messageService}[], nextTargets?: typeof prevTargets) {
|
||||||
let photo = await appProfileManager.getFullPhoto(peerId);
|
let photo = await appProfileManager.getFullPhoto(peerId);
|
||||||
|
@ -83,7 +83,7 @@ export default class AutocompletePeerHelper extends AutocompleteHelper {
|
|||||||
div.dataset.peerId = '' + options.peerId;
|
div.dataset.peerId = '' + options.peerId;
|
||||||
|
|
||||||
const avatar = new AvatarElement();
|
const avatar = new AvatarElement();
|
||||||
avatar.classList.add('avatar-30');
|
avatar.classList.add('avatar-30', options.className + '-avatar');
|
||||||
avatar.setAttribute('dialog', '0');
|
avatar.setAttribute('dialog', '0');
|
||||||
avatar.setAttribute('peer', '' + options.peerId);
|
avatar.setAttribute('peer', '' + options.peerId);
|
||||||
|
|
||||||
|
@ -14,22 +14,22 @@ import windowSize from "../../../helpers/windowSize";
|
|||||||
import ButtonCorner from "../../buttonCorner";
|
import ButtonCorner from "../../buttonCorner";
|
||||||
import { attachClickEvent } from "../../../helpers/dom/clickEvent";
|
import { attachClickEvent } from "../../../helpers/dom/clickEvent";
|
||||||
import PopupCreateContact from "../../popups/createContact";
|
import PopupCreateContact from "../../popups/createContact";
|
||||||
|
import SortedUserList from "../../sortedUserList";
|
||||||
|
import { getMiddleware } from "../../../helpers/middleware";
|
||||||
|
import replaceContent from "../../../helpers/dom/replaceContent";
|
||||||
|
import rootScope from "../../../lib/rootScope";
|
||||||
|
|
||||||
// TODO: поиск по людям глобальный, если не нашло в контактах никого
|
// TODO: поиск по людям глобальный, если не нашло в контактах никого
|
||||||
|
|
||||||
export default class AppContactsTab extends SliderSuperTab {
|
export default class AppContactsTab extends SliderSuperTab {
|
||||||
private list: HTMLUListElement;
|
|
||||||
private promise: Promise<void>;
|
|
||||||
|
|
||||||
private inputSearch: InputSearch;
|
private inputSearch: InputSearch;
|
||||||
private alive = true;
|
private middleware: ReturnType<typeof getMiddleware>;
|
||||||
|
private sortedUserList: SortedUserList;
|
||||||
|
|
||||||
init() {
|
protected init() {
|
||||||
this.container.id = 'contacts-container';
|
this.container.id = 'contacts-container';
|
||||||
|
|
||||||
this.list = appDialogsManager.createChatList(/* {avatarSize: 48, handheldsSize: 66} */);
|
// this.list = appDialogsManager.createChatList(/* {avatarSize: 48, handheldsSize: 66} */);
|
||||||
this.list.id = 'contacts';
|
|
||||||
this.list.classList.add('contacts-container');
|
|
||||||
|
|
||||||
const btnAdd = ButtonCorner({icon: 'add', className: 'is-visible'});
|
const btnAdd = ButtonCorner({icon: 'add', className: 'is-visible'});
|
||||||
this.content.append(btnAdd);
|
this.content.append(btnAdd);
|
||||||
@ -38,31 +38,43 @@ export default class AppContactsTab extends SliderSuperTab {
|
|||||||
new PopupCreateContact();
|
new PopupCreateContact();
|
||||||
}, {listenerSetter: this.listenerSetter});
|
}, {listenerSetter: this.listenerSetter});
|
||||||
|
|
||||||
appDialogsManager.setListClickListener(this.list, () => {
|
|
||||||
this.close();
|
|
||||||
}, undefined, true);
|
|
||||||
|
|
||||||
this.inputSearch = new InputSearch('Search', (value) => {
|
this.inputSearch = new InputSearch('Search', (value) => {
|
||||||
this.list.innerHTML = '';
|
|
||||||
this.openContacts(value);
|
this.openContacts(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.listenerSetter.add(rootScope)('contacts_update', (userId) => {
|
||||||
|
const isContact = appUsersManager.isContact(userId);
|
||||||
|
if(isContact) this.sortedUserList.add(userId);
|
||||||
|
else this.sortedUserList.delete(userId);
|
||||||
|
});
|
||||||
|
|
||||||
this.title.replaceWith(this.inputSearch.container);
|
this.title.replaceWith(this.inputSearch.container);
|
||||||
|
|
||||||
this.scrollable.append(this.list);
|
this.middleware = getMiddleware();
|
||||||
|
|
||||||
// preload contacts
|
// preload contacts
|
||||||
// appUsersManager.getContacts();
|
// appUsersManager.getContacts();
|
||||||
}
|
}
|
||||||
|
|
||||||
onClose() {
|
protected createList() {
|
||||||
this.alive = false;
|
const sortedUserList = new SortedUserList();
|
||||||
|
const list = sortedUserList.list;
|
||||||
|
list.id = 'contacts';
|
||||||
|
list.classList.add('contacts-container');
|
||||||
|
appDialogsManager.setListClickListener(list, () => {
|
||||||
|
this.close();
|
||||||
|
}, undefined, true);
|
||||||
|
return sortedUserList;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onClose() {
|
||||||
|
this.middleware.clean();
|
||||||
/* // need to clear, and left 1 page for smooth slide
|
/* // need to clear, and left 1 page for smooth slide
|
||||||
let pageCount = appPhotosManager.windowH / 72 * 1.25 | 0;
|
let pageCount = appPhotosManager.windowH / 72 * 1.25 | 0;
|
||||||
(Array.from(this.list.children) as HTMLElement[]).slice(pageCount).forEach(el => el.remove()); */
|
(Array.from(this.list.children) as HTMLElement[]).slice(pageCount).forEach(el => el.remove()); */
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpenAfterTimeout() {
|
protected onOpenAfterTimeout() {
|
||||||
if(isMobile || !canFocus(true)) return;
|
if(isMobile || !canFocus(true)) return;
|
||||||
this.inputSearch.input.focus();
|
this.inputSearch.input.focus();
|
||||||
}
|
}
|
||||||
@ -73,36 +85,29 @@ export default class AppContactsTab extends SliderSuperTab {
|
|||||||
this.init = null;
|
this.init = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.promise) return this.promise;
|
this.middleware.clean();
|
||||||
|
const middleware = this.middleware.get();
|
||||||
this.scrollable.onScrolledBottom = null;
|
this.scrollable.onScrolledBottom = null;
|
||||||
|
this.scrollable.container.textContent = '';
|
||||||
|
|
||||||
this.promise = appUsersManager.getContacts(query, undefined, 'online').then(contacts => {
|
appUsersManager.getContacts(query, undefined, 'online').then(contacts => {
|
||||||
this.promise = null;
|
if(!middleware()) {
|
||||||
|
|
||||||
if(!this.alive) {
|
|
||||||
//console.warn('user closed contacts before it\'s loaded');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sortedUserList = this.sortedUserList = this.createList();
|
||||||
|
|
||||||
let renderPage = () => {
|
let renderPage = () => {
|
||||||
const pageCount = windowSize.windowH / 72 * 1.25 | 0;
|
const pageCount = windowSize.windowH / 72 * 1.25 | 0;
|
||||||
const arr = contacts.splice(0, pageCount); // надо splice!
|
const arr = contacts.splice(0, pageCount); // надо splice!
|
||||||
|
|
||||||
arr.forEach((peerId) => {
|
arr.forEach((peerId) => {
|
||||||
const {dom} = appDialogsManager.addDialogNew({
|
sortedUserList.add(peerId);
|
||||||
dialog: peerId,
|
|
||||||
container: this.list,
|
|
||||||
drawStatus: false,
|
|
||||||
avatarSize: 48,
|
|
||||||
autonomous: true
|
|
||||||
});
|
|
||||||
|
|
||||||
const status = appUsersManager.getUserStatusString(peerId);
|
|
||||||
dom.lastMessageSpan.append(status);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!contacts.length) {
|
if(!contacts.length) {
|
||||||
renderPage = undefined;
|
renderPage = undefined;
|
||||||
|
this.scrollable.onScrolledBottom = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -114,6 +119,8 @@ export default class AppContactsTab extends SliderSuperTab {
|
|||||||
this.scrollable.onScrolledBottom = null;
|
this.scrollable.onScrolledBottom = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
replaceContent(this.scrollable.container, sortedUserList.list);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,9 +591,7 @@ class PeerProfile {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rootScope.addEventListener('peer_typings', (e) => {
|
rootScope.addEventListener('peer_typings', ({peerId}) => {
|
||||||
const {peerId} = e;
|
|
||||||
|
|
||||||
if(this.peerId === peerId) {
|
if(this.peerId === peerId) {
|
||||||
this.setPeerStatus();
|
this.setPeerStatus();
|
||||||
}
|
}
|
||||||
@ -605,14 +603,25 @@ class PeerProfile {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rootScope.addEventListener('user_update', (e) => {
|
rootScope.addEventListener('user_update', (userId) => {
|
||||||
const userId = e;
|
|
||||||
|
|
||||||
if(this.peerId === userId) {
|
if(this.peerId === userId) {
|
||||||
this.setPeerStatus();
|
this.setPeerStatus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rootScope.addEventListener('contacts_update', (userId) => {
|
||||||
|
if(this.peerId === userId) {
|
||||||
|
const user = appUsersManager.getUser(userId);
|
||||||
|
if(!user.pFlags.self) {
|
||||||
|
if(user.phone) {
|
||||||
|
setText(appUsersManager.formatUserPhone(user.phone), this.phone);
|
||||||
|
} else {
|
||||||
|
this.phone.container.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.setPeerStatusInterval = window.setInterval(this.setPeerStatus, 60e3);
|
this.setPeerStatusInterval = window.setInterval(this.setPeerStatus, 60e3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,7 +701,7 @@ class PeerProfile {
|
|||||||
const muted = appNotificationsManager.isPeerLocalMuted(peerId, false);
|
const muted = appNotificationsManager.isPeerLocalMuted(peerId, false);
|
||||||
this.notifications.checkboxField.checked = !muted;
|
this.notifications.checkboxField.checked = !muted;
|
||||||
} else {
|
} else {
|
||||||
window.requestAnimationFrame(() => {
|
fastRaf(() => {
|
||||||
this.notifications.container.style.display = 'none';
|
this.notifications.container.style.display = 'none';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -901,6 +910,12 @@ export default class AppSharedMediaTab extends SliderSuperTab {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rootScope.addEventListener('contacts_update', (userId) => {
|
||||||
|
if(this.peerId === userId && rootScope.myId !== userId) {
|
||||||
|
this.editBtn.classList.toggle('hide', !appUsersManager.isContact(userId));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//this.container.prepend(this.closeBtn.parentElement);
|
//this.container.prepend(this.closeBtn.parentElement);
|
||||||
|
|
||||||
this.searchSuper = new AppSearchSuper({
|
this.searchSuper = new AppSearchSuper({
|
||||||
@ -1113,7 +1128,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
|
|||||||
// const perf = performance.now();
|
// const perf = performance.now();
|
||||||
this.profile.cleanupHTML();
|
this.profile.cleanupHTML();
|
||||||
|
|
||||||
this.editBtn.style.display = 'none';
|
this.editBtn.classList.add('hide');
|
||||||
|
|
||||||
this.searchSuper.cleanupHTML(true);
|
this.searchSuper.cleanupHTML(true);
|
||||||
|
|
||||||
@ -1162,12 +1177,12 @@ export default class AppSharedMediaTab extends SliderSuperTab {
|
|||||||
|
|
||||||
if(this.peerId > 0) {
|
if(this.peerId > 0) {
|
||||||
if(this.peerId !== rootScope.myId && appUsersManager.isContact(this.peerId)) {
|
if(this.peerId !== rootScope.myId && appUsersManager.isContact(this.peerId)) {
|
||||||
this.editBtn.style.display = '';
|
this.editBtn.classList.remove('hide');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const chat: Chat = appChatsManager.getChat(-this.peerId);
|
const chat: Chat = appChatsManager.getChat(-this.peerId);
|
||||||
if((chat._ === 'chat' || (chat as Chat.channel).admin_rights) && !(chat as Chat.chat).pFlags.deactivated) {
|
if((chat._ === 'chat' || (chat as Chat.channel).admin_rights) && !(chat as Chat.chat).pFlags.deactivated) {
|
||||||
this.editBtn.style.display = '';
|
this.editBtn.classList.remove('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ type SortedUser = {
|
|||||||
};
|
};
|
||||||
export default class SortedUserList {
|
export default class SortedUserList {
|
||||||
protected static SORT_INTERVAL = 30e3;
|
protected static SORT_INTERVAL = 30e3;
|
||||||
public users: Map<number, SortedUser>;
|
protected users: Map<number, SortedUser>;
|
||||||
public sorted: Array<SortedUser>;
|
protected sorted: Array<SortedUser>;
|
||||||
public list: HTMLUListElement;
|
public list: HTMLUListElement;
|
||||||
|
|
||||||
protected lazyLoadQueue: LazyLoadQueueIntersector;
|
protected lazyLoadQueue: LazyLoadQueueIntersector;
|
||||||
@ -116,7 +116,11 @@ export default class SortedUserList {
|
|||||||
|
|
||||||
user.dom.listEl.remove();
|
user.dom.listEl.remove();
|
||||||
this.users.delete(peerId);
|
this.users.delete(peerId);
|
||||||
this.sorted.findAndSplice(_user => _user === user);
|
|
||||||
|
const idx = this.sorted.indexOf(user);
|
||||||
|
if(idx !== -1) {
|
||||||
|
this.sorted.splice(idx, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public update(peerId: number, batch = false) {
|
public update(peerId: number, batch = false) {
|
||||||
|
@ -23,6 +23,10 @@ export class AppAvatarsManager {
|
|||||||
[size in PeerPhotoSize]?: string | Promise<string>
|
[size in PeerPhotoSize]?: string | Promise<string>
|
||||||
}
|
}
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
|
public isAvatarCached(peerId: number) {
|
||||||
|
return !!this.savedAvatarURLs[peerId];
|
||||||
|
}
|
||||||
|
|
||||||
public removeFromAvatarsCache(peerId: number) {
|
public removeFromAvatarsCache(peerId: number) {
|
||||||
if(this.savedAvatarURLs[peerId]) {
|
if(this.savedAvatarURLs[peerId]) {
|
||||||
|
@ -51,7 +51,7 @@ import PeerTitle from "../../components/peerTitle";
|
|||||||
import { forEachReverse } from "../../helpers/array";
|
import { forEachReverse } from "../../helpers/array";
|
||||||
import htmlToDocumentFragment from "../../helpers/dom/htmlToDocumentFragment";
|
import htmlToDocumentFragment from "../../helpers/dom/htmlToDocumentFragment";
|
||||||
import htmlToSpan from "../../helpers/dom/htmlToSpan";
|
import htmlToSpan from "../../helpers/dom/htmlToSpan";
|
||||||
import { REPLIES_PEER_ID } from "../mtproto/mtproto_config";
|
import { REPLIES_PEER_ID, SERVICE_PEER_ID } from "../mtproto/mtproto_config";
|
||||||
import formatCallDuration from "../../helpers/formatCallDuration";
|
import formatCallDuration from "../../helpers/formatCallDuration";
|
||||||
import appAvatarsManager from "./appAvatarsManager";
|
import appAvatarsManager from "./appAvatarsManager";
|
||||||
import telegramMeWebManager from "../mtproto/telegramMeWebManager";
|
import telegramMeWebManager from "../mtproto/telegramMeWebManager";
|
||||||
@ -4443,7 +4443,7 @@ export class AppMessagesManager {
|
|||||||
|
|
||||||
private onUpdateServiceNotification = (update: Update.updateServiceNotification) => {
|
private onUpdateServiceNotification = (update: Update.updateServiceNotification) => {
|
||||||
//this.log('updateServiceNotification', update);
|
//this.log('updateServiceNotification', update);
|
||||||
const fromId = 777000;
|
const fromId = SERVICE_PEER_ID;
|
||||||
const peerId = fromId;
|
const peerId = fromId;
|
||||||
const messageId = this.generateTempMessageId(peerId);
|
const messageId = this.generateTempMessageId(peerId);
|
||||||
const message: any = {
|
const message: any = {
|
||||||
|
@ -21,7 +21,7 @@ import { Chat, InputContact, InputUser, User as MTUser, UserProfilePhoto, UserSt
|
|||||||
import I18n, { i18n, LangPackKey } from "../langPack";
|
import I18n, { i18n, LangPackKey } from "../langPack";
|
||||||
//import apiManager from '../mtproto/apiManager';
|
//import apiManager from '../mtproto/apiManager';
|
||||||
import apiManager from '../mtproto/mtprotoworker';
|
import apiManager from '../mtproto/mtprotoworker';
|
||||||
import { REPLIES_PEER_ID } from "../mtproto/mtproto_config";
|
import { REPLIES_PEER_ID, SERVICE_PEER_ID } from "../mtproto/mtproto_config";
|
||||||
import serverTimeManager from "../mtproto/serverTimeManager";
|
import serverTimeManager from "../mtproto/serverTimeManager";
|
||||||
import { RichTextProcessor } from "../richtextprocessor";
|
import { RichTextProcessor } from "../richtextprocessor";
|
||||||
import rootScope from "../rootScope";
|
import rootScope from "../rootScope";
|
||||||
@ -371,15 +371,31 @@ export class AppUsersManager {
|
|||||||
// * exclude from state
|
// * exclude from state
|
||||||
// defineNotNumerableProperties(user, ['initials', 'num', 'rFirstName', 'rFullName', 'rPhone', 'sortName', 'sortStatus']);
|
// defineNotNumerableProperties(user, ['initials', 'num', 'rFirstName', 'rFullName', 'rPhone', 'sortName', 'sortStatus']);
|
||||||
|
|
||||||
const fullName = user.first_name + ' ' + (user.last_name || '');
|
if(!oldUser || oldUser.username !== user.username) {
|
||||||
if(user.username) {
|
if(oldUser?.username) {
|
||||||
const searchUsername = cleanUsername(user.username);
|
const oldSearchUsername = cleanUsername(oldUser.username);
|
||||||
this.usernames[searchUsername] = userId;
|
delete this.usernames[oldSearchUsername];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(user.username) {
|
||||||
|
const searchUsername = cleanUsername(user.username);
|
||||||
|
this.usernames[searchUsername] = userId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user.sortName = user.pFlags.deleted ? '' : cleanSearchText(fullName, false);
|
if(!oldUser
|
||||||
|
|| oldUser.initials === undefined
|
||||||
|
|| oldUser.sortName === undefined
|
||||||
|
|| oldUser.first_name !== user.first_name
|
||||||
|
|| oldUser.last_name !== user.last_name) {
|
||||||
|
const fullName = user.first_name + ' ' + (user.last_name || '');
|
||||||
|
|
||||||
user.initials = RichTextProcessor.getAbbreviation(fullName);
|
user.sortName = user.pFlags.deleted ? '' : cleanSearchText(fullName, false);
|
||||||
|
user.initials = RichTextProcessor.getAbbreviation(fullName);
|
||||||
|
} else {
|
||||||
|
user.sortName = oldUser.sortName;
|
||||||
|
user.initials = oldUser.initials;
|
||||||
|
}
|
||||||
|
|
||||||
if(user.status) {
|
if(user.status) {
|
||||||
if((user.status as UserStatus.userStatusOnline).expires) {
|
if((user.status as UserStatus.userStatusOnline).expires) {
|
||||||
@ -413,8 +429,15 @@ export class AppUsersManager {
|
|||||||
|
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
const wasContact = !!oldUser.pFlags.contact;
|
||||||
|
const newContact = !!user.pFlags.contact;
|
||||||
|
|
||||||
safeReplaceObject(oldUser, user);
|
safeReplaceObject(oldUser, user);
|
||||||
rootScope.dispatchEvent('user_update', userId);
|
rootScope.dispatchEvent('user_update', userId);
|
||||||
|
|
||||||
|
if(wasContact !== newContact) {
|
||||||
|
this.onContactUpdated(userId, newContact, wasContact);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(changedPhoto) {
|
if(changedPhoto) {
|
||||||
@ -497,7 +520,7 @@ export class AppUsersManager {
|
|||||||
case REPLIES_PEER_ID:
|
case REPLIES_PEER_ID:
|
||||||
key = 'Peer.RepliesNotifications';
|
key = 'Peer.RepliesNotifications';
|
||||||
break;
|
break;
|
||||||
case 777000:
|
case SERVICE_PEER_ID:
|
||||||
key = 'Peer.ServiceNotifications';
|
key = 'Peer.ServiceNotifications';
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
@ -599,7 +622,7 @@ export class AppUsersManager {
|
|||||||
|
|
||||||
public canSendToUser(id: number) {
|
public canSendToUser(id: number) {
|
||||||
const user = this.getUser(id);
|
const user = this.getUser(id);
|
||||||
return !user.pFlags.deleted && user.username !== 'replies';
|
return !user.pFlags.deleted && user.id !== REPLIES_PEER_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getUserPhoto(id: number) {
|
public getUserPhoto(id: number) {
|
||||||
@ -632,19 +655,22 @@ export class AppUsersManager {
|
|||||||
const timestampNow = tsNow(true);
|
const timestampNow = tsNow(true);
|
||||||
for(const i in this.users) {
|
for(const i in this.users) {
|
||||||
const user = this.users[i];
|
const user = this.users[i];
|
||||||
|
this.updateUserStatus(user, timestampNow);
|
||||||
if(user.status &&
|
|
||||||
user.status._ === 'userStatusOnline' &&
|
|
||||||
user.status.expires < timestampNow) {
|
|
||||||
|
|
||||||
user.status = {_: 'userStatusOffline', was_online: user.status.expires};
|
|
||||||
rootScope.dispatchEvent('user_update', user.id);
|
|
||||||
|
|
||||||
this.setUserToStateIfNeeded(user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public updateUserStatus(user: MTUser.user, timestampNow = tsNow(true)) {
|
||||||
|
if(user.status &&
|
||||||
|
user.status._ === 'userStatusOnline' &&
|
||||||
|
user.status.expires < timestampNow) {
|
||||||
|
|
||||||
|
user.status = {_: 'userStatusOffline', was_online: user.status.expires};
|
||||||
|
rootScope.dispatchEvent('user_update', user.id);
|
||||||
|
|
||||||
|
this.setUserToStateIfNeeded(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public forceUserOnline(id: number, eventTimestamp?: number) {
|
public forceUserOnline(id: number, eventTimestamp?: number) {
|
||||||
if(this.isBot(id)) {
|
if(this.isBot(id)) {
|
||||||
return;
|
return;
|
||||||
@ -819,8 +845,7 @@ export class AppUsersManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private onContactUpdated(userId: number, isContact: boolean) {
|
private onContactUpdated(userId: number, isContact: boolean, curIsContact = this.isContact(userId)) {
|
||||||
const curIsContact = this.isContact(userId);
|
|
||||||
if(isContact !== curIsContact) {
|
if(isContact !== curIsContact) {
|
||||||
if(isContact) {
|
if(isContact) {
|
||||||
this.pushContact(userId);
|
this.pushContact(userId);
|
||||||
|
@ -10,3 +10,4 @@
|
|||||||
export type UserAuth = {dcID: number | string, date: number, id: number};
|
export type UserAuth = {dcID: number | string, date: number, id: number};
|
||||||
|
|
||||||
export const REPLIES_PEER_ID = 1271266957;
|
export const REPLIES_PEER_ID = 1271266957;
|
||||||
|
export const SERVICE_PEER_ID = 777000;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
height: 3.125rem;
|
height: 3.125rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
// padding: 0 .75rem;
|
// padding: 0 .75rem;
|
||||||
padding: 0 2.125rem 0px 0.75rem;
|
padding: 0 2.125rem 0 0.75rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
@ -35,6 +35,10 @@
|
|||||||
margin-left: .5625rem;
|
margin-left: .5625rem;
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-avatar {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -899,8 +899,7 @@ $bubble-margin: .25rem;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
overflow: hidden;
|
word-break: break-word;
|
||||||
text-overflow: ellipsis;
|
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
font-size: var(--messages-secondary-text-size);
|
font-size: var(--messages-secondary-text-size);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
margin-top: calc((var(--height) - 1.5rem) / 2); // * Center of first line
|
margin-top: calc((var(--height) - 1.5rem) / 2); // * Center of first line
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
@include animation-level(2) {
|
@include animation-level(2) {
|
||||||
transition: .2s transform, .2s padding, .1s opacity, font-weight 0s .1s;
|
transition: .2s transform, .2s padding, .1s opacity, font-weight 0s .1s;
|
||||||
|
@ -70,10 +70,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.poll-create-questions {
|
.poll-create-questions {
|
||||||
padding: 0px 1.25rem 1.5rem;
|
padding: 0 1.25rem 1.5rem;
|
||||||
|
|
||||||
.input-field-input {
|
&:not(:last-child) {
|
||||||
padding-right: 3.25rem;
|
.input-field-input {
|
||||||
|
padding-right: 3.25rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img, video {
|
||||||
|
border-radius: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-header {
|
&-header {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user