Fix multiselect album the highest message id
This commit is contained in:
parent
cf8e2aacc6
commit
8f841344eb
@ -164,7 +164,7 @@ export default class ChatSelection {
|
|||||||
|
|
||||||
// * if it is a render of new message
|
// * if it is a render of new message
|
||||||
const mid = +bubble.dataset.mid;
|
const mid = +bubble.dataset.mid;
|
||||||
if(this.selectedMids.has(mid)) {
|
if(this.selectedMids.has(mid) && (!isAlbum || this.isAlbumMidsSelected(mid))) {
|
||||||
checkboxField.input.checked = true;
|
checkboxField.input.checked = true;
|
||||||
bubble.classList.add('is-selected');
|
bubble.classList.add('is-selected');
|
||||||
}
|
}
|
||||||
@ -329,6 +329,12 @@ export default class ChatSelection {
|
|||||||
return albumCheckboxInput?.checked;
|
return albumCheckboxInput?.checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isAlbumMidsSelected(mid: number) {
|
||||||
|
const mids = this.appMessagesManager.getMidsByMid(mid);
|
||||||
|
const selectedMids = mids.filter(mid => this.selectedMids.has(mid));
|
||||||
|
return mids.length == selectedMids.length;
|
||||||
|
}
|
||||||
|
|
||||||
public toggleByBubble = (bubble: HTMLElement) => {
|
public toggleByBubble = (bubble: HTMLElement) => {
|
||||||
const mid = +bubble.dataset.mid;
|
const mid = +bubble.dataset.mid;
|
||||||
|
|
||||||
@ -373,13 +379,11 @@ export default class ChatSelection {
|
|||||||
if(isAlbumItem) {
|
if(isAlbumItem) {
|
||||||
const albumContainer = findUpClassName(bubble, 'bubble');
|
const albumContainer = findUpClassName(bubble, 'bubble');
|
||||||
const isAlbumSelected = this.isAlbumBubbleSelected(albumContainer);
|
const isAlbumSelected = this.isAlbumBubbleSelected(albumContainer);
|
||||||
|
const isAlbumMidsSelected = this.isAlbumMidsSelected(mid);
|
||||||
|
|
||||||
const mids = this.appMessagesManager.getMidsByMid(mid);
|
const willChange = isAlbumMidsSelected || isAlbumSelected;
|
||||||
const selectedMids = mids.filter(mid => this.selectedMids.has(mid));
|
|
||||||
|
|
||||||
const willChange = mids.length == selectedMids.length || isAlbumSelected;
|
|
||||||
if(willChange) {
|
if(willChange) {
|
||||||
this.updateBubbleSelection(albumContainer, mids.length == selectedMids.length);
|
this.updateBubbleSelection(albumContainer, isAlbumMidsSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user