Browse Source

Fix updating sent status

Fix migration message
master
Eduard Kuzmenko 4 years ago
parent
commit
c44b9a7734
  1. 16
      src/components/chat/bubbles.ts
  2. 1
      src/components/sidebarLeft/tabs/2fa/hint.ts
  3. 3
      src/lib/appManagers/appChatsManager.ts
  4. 4
      src/lib/appManagers/appDialogsManager.ts
  5. 6
      src/lib/appManagers/appMessagesManager.ts
  6. 4
      src/scss/partials/_chatBubble.scss
  7. 2
      src/tests/srp.test.ts

16
src/components/chat/bubbles.ts

@ -192,8 +192,10 @@ export default class ChatBubbles { @@ -192,8 +192,10 @@ export default class ChatBubbles {
if(message.replies) {
const repliesElement = bubble.querySelector('replies-element') as RepliesElement;
repliesElement.message = message;
repliesElement.init();
if(repliesElement) {
repliesElement.message = message;
repliesElement.init();
}
}
if(message.media?.document && !message.media.document.type) {
@ -206,13 +208,15 @@ export default class ChatBubbles { @@ -206,13 +208,15 @@ export default class ChatBubbles {
// set new mids to album items for mediaViewer
if(message.grouped_id) {
const item = (bubble.querySelector(`.grouped-item[data-mid="${tempId}"]`) as HTMLElement) || bubble; // * it can be .document-container
item.dataset.mid = '' + mid;
if(item) {
item.dataset.mid = '' + mid;
}
}
if(message.media?.poll) {
const newPoll = message.media.poll;
const pollElement = bubble.querySelector('poll-element') as PollElement;
if(pollElement) {
const newPoll = message.media.poll;
pollElement.message = message;
pollElement.setAttribute('poll-id', newPoll.id);
pollElement.setAttribute('message-id', '' + mid);
@ -370,7 +374,7 @@ export default class ChatBubbles { @@ -370,7 +374,7 @@ export default class ChatBubbles {
if(bubble) {
const mid = +bubble.dataset.mid
this.log('debug message:', this.chat.getMessage(mid));
this.chat.bubbles.highlightBubble(bubble);
this.highlightBubble(bubble);
}
});
}
@ -1399,7 +1403,7 @@ export default class ChatBubbles { @@ -1399,7 +1403,7 @@ export default class ChatBubbles {
}
}
const isJump = lastMsgId !== topMessage;
const isJump = lastMsgId !== topMessage && topMessage !== 0 && lastMsgId !== 0;
if(samePeer) {
const mounted = this.getMountedBubble(lastMsgId);

1
src/components/sidebarLeft/tabs/2fa/hint.ts

@ -59,6 +59,7 @@ export default class AppTwoStepVerificationHintTab extends SliderSuperTab { @@ -59,6 +59,7 @@ export default class AppTwoStepVerificationHintTab extends SliderSuperTab {
inputField.input.addEventListener('keypress', (e) => {
if(e.key === 'Enter') {
cancelEvent(e);
return (inputField.value ? btnContinue : btnSkip).click();
}
});

3
src/lib/appManagers/appChatsManager.ts

@ -398,7 +398,8 @@ export class AppChatsManager { @@ -398,7 +398,8 @@ export class AppChatsManager {
}
const isChannel = this.isBroadcast(id);
return numberThousandSplitter(count || 1, ' ') + ' ' + (isChannel ? 'subscribers' : 'members');
count = count || 1;
return numberThousandSplitter(count, ' ') + ' ' + (isChannel ? (count > 1 ? 'subscribers' : 'subscriber') : (count > 1 ? 'members' : 'member'));
}
public wrapForFull(id: number, fullChat: any) {

4
src/lib/appManagers/appDialogsManager.ts

@ -979,7 +979,7 @@ export class AppDialogsManager { @@ -979,7 +979,7 @@ export class AppDialogsManager {
lastMessage = appMessagesManager.getMessageByPeer(dialog.peerId, dialog.top_message);
}
if(lastMessage._ === 'messageEmpty' || (lastMessage._ === 'messageService' && !lastMessage.rReply)) {
if(lastMessage._ === 'messageEmpty'/* || (lastMessage._ === 'messageService' && !lastMessage.rReply) */) {
dom.lastMessageSpan.innerHTML = '';
dom.lastTimeSpan.innerHTML = '';
delete dom.listEl.dataset.mid;
@ -1089,7 +1089,7 @@ export class AppDialogsManager { @@ -1089,7 +1089,7 @@ export class AppDialogsManager {
dialog.draft :
appMessagesManager.getMessageByPeer(dialog.peerId, dialog.top_message);
if(lastMessage._ !== 'messageEmpty' && !lastMessage.deleted &&
lastMessage.fromId === rootScope.myId && lastMessage.peerId !== rootScope.myId/* &&
lastMessage.pFlags.out && lastMessage.peerId !== rootScope.myId/* &&
dialog.read_outbox_max_id */) { // maybe comment, 06.20.2020
const outgoing = (lastMessage.pFlags && lastMessage.pFlags.unread)
/* && dialog.read_outbox_max_id !== 0 */; // maybe uncomment, 31.01.2020

6
src/lib/appManagers/appMessagesManager.ts

@ -2588,12 +2588,12 @@ export class AppMessagesManager { @@ -2588,12 +2588,12 @@ export class AppMessagesManager {
if(!l) {
l = langPack[_];
if(!l) {
if(l === undefined) {
l = '[' + _ + ']';
}
}
str = l[0].toUpperCase() === l[0] ? l : getNameDivHTML(message.fromId) + l + (suffix ? ' ' : '');
str = !l || l[0].toUpperCase() === l[0] ? l : getNameDivHTML(message.fromId) + l + (suffix ? ' ' : '');
}
//this.log('message action:', action);
@ -3150,6 +3150,8 @@ export class AppMessagesManager { @@ -3150,6 +3150,8 @@ export class AppMessagesManager {
const storage = this.getMessagesStorage(peerId);
for(let i = 0, length = history.length; i < length; i++) {
const message = storage[history[i]];
if(!message) continue;
//|| (neededContents['mentioned'] && message.totalEntities.find((e: any) => e._ === 'messageEntityMention'));

4
src/scss/partials/_chatBubble.scss

@ -49,8 +49,8 @@ $bubble-margin: .25rem; @@ -49,8 +49,8 @@ $bubble-margin: .25rem;
//flex-direction: column; // fix 'Unread messages', still need to refactor it
--background-color: #fff;
--accent-color: $color-blue;
--secondary-color: $color-gray;
--accent-color: #{$color-blue};
--secondary-color: #{$color-gray};
&.is-highlighted, &.is-selected, /* .bubbles.is-selecting */ & {
&:after {

2
src/tests/srp.test.ts

@ -22,7 +22,7 @@ test('2FA whole (with negative)', async() => { @@ -22,7 +22,7 @@ test('2FA whole (with negative)', async() => {
new_algo: null,
new_secure_algo: null
}, false).then(res => {
}, false).then((res: any) => {
expect(res.srp_id).toEqual(srp_id);
expect(res.A).toEqual(A);
expect(res.M1).toEqual(M1);

Loading…
Cancel
Save