Unpin from pinned list
Delete unpinned bubble Media viewer fix search back limit Fix album item selection border-radius
This commit is contained in:
parent
9126a522c2
commit
bf0268c480
@ -1242,7 +1242,7 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
|
||||
const peerId = this.peerId;
|
||||
|
||||
const promise = appMessagesManager.getSearch(peerId, '',
|
||||
{_: this.inputFilter}, maxId, loadCount/* older ? loadCount : 0 */, 0, backLimit).then(value => {
|
||||
{_: this.inputFilter}, maxId, backLimit ? 0 : loadCount/* older ? loadCount : 0 */, 0, backLimit).then(value => {
|
||||
if(this.peerId != peerId) {
|
||||
this.log.warn('peer changed');
|
||||
return;
|
||||
|
@ -402,6 +402,20 @@ export default class ChatBubbles {
|
||||
});
|
||||
}
|
||||
|
||||
public constructPinnedHelpers() {
|
||||
this.listenerSetter.add(rootScope, 'peer_pinned_messages', (e) => {
|
||||
const {peerId, mids, pinned} = e.detail;
|
||||
|
||||
if(peerId !== this.peerId) return;
|
||||
|
||||
if(mids) {
|
||||
if(!pinned) {
|
||||
this.deleteMessagesByIds(mids);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public onBubblesClick = (e: Event) => {
|
||||
let target = e.target as HTMLElement;
|
||||
let bubble: HTMLElement = null;
|
||||
|
@ -70,6 +70,8 @@ export default class Chat extends EventListenerBase<{
|
||||
|
||||
if(this.type == 'chat') {
|
||||
this.topbar.constructPeerHelpers();
|
||||
} else if(this.type == 'pinned') {
|
||||
this.topbar.constructPinnedHelpers();
|
||||
}
|
||||
|
||||
this.topbar.construct();
|
||||
@ -79,8 +81,10 @@ export default class Chat extends EventListenerBase<{
|
||||
this.input.constructPeerHelpers();
|
||||
} else if(this.type == 'pinned') {
|
||||
this.input.constructPinnedHelpers();
|
||||
this.bubbles.constructPinnedHelpers();
|
||||
}
|
||||
|
||||
this.container.classList.add('type-' + this.type);
|
||||
this.container.append(this.topbar.container, this.bubbles.bubblesContainer, this.input.chatInput);
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ export default class ChatPinnedMessage {
|
||||
});
|
||||
|
||||
this.listenerSetter.add(rootScope, 'peer_pinned_messages', (e) => {
|
||||
const peerId = e.detail;
|
||||
const peerId = e.detail.peerId;
|
||||
|
||||
if(peerId == this.topbar.peerId) {
|
||||
//this.wasPinnedIndex = 0;
|
||||
|
@ -281,6 +281,18 @@ export default class ChatTopbar {
|
||||
return this;
|
||||
}
|
||||
|
||||
public constructPinnedHelpers() {
|
||||
this.listenerSetter.add(rootScope, 'peer_pinned_messages', (e) => {
|
||||
const {peerId, mids, pinned} = e.detail;
|
||||
|
||||
if(peerId !== this.peerId) return;
|
||||
|
||||
if(mids) {
|
||||
this.setTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public openPinned(byCurrent: boolean) {
|
||||
this.chat.appImManager.setInnerPeer(this.peerId, byCurrent ? +this.pinnedMessage.pinnedMessageContainer.divAndCaption.container.dataset.mid : 0, 'pinned');
|
||||
}
|
||||
@ -366,7 +378,19 @@ export default class ChatTopbar {
|
||||
|
||||
if(count === undefined) {
|
||||
this.appMessagesManager.getSearchCounters(this.peerId, [{_: 'inputMessagesFilterPinned'}]).then(result => {
|
||||
this.setTitle(result[0].count);
|
||||
const count = result[0].count;
|
||||
this.setTitle(count);
|
||||
|
||||
// ! костыль х2, это нужно делать в другом месте
|
||||
if(!count) {
|
||||
this.chat.appImManager.setPeer(0); // * close tab
|
||||
|
||||
// ! костыль, это скроет закреплённые сообщения сразу, вместо того, чтобы ждать пока анимация перехода закончится
|
||||
const originalChat = this.chat.appImManager.chat;
|
||||
if(originalChat.topbar.pinnedMessage) {
|
||||
originalChat.topbar.pinnedMessage.pinnedMessageContainer.toggle(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -1683,7 +1683,7 @@ export class AppMessagesManager {
|
||||
}
|
||||
}
|
||||
|
||||
rootScope.broadcast('peer_pinned_messages', peerId);
|
||||
rootScope.broadcast('peer_pinned_messages', {peerId, unpinAll: true});
|
||||
delete this.pinnedMessages[peerId];
|
||||
|
||||
return true;
|
||||
@ -3726,7 +3726,7 @@ export class AppMessagesManager {
|
||||
delete this.pinnedMessages[peerId];
|
||||
appStateManager.getState().then(state => {
|
||||
delete state.hiddenPinnedMessages[peerId];
|
||||
rootScope.broadcast('peer_pinned_messages', peerId);
|
||||
rootScope.broadcast('peer_pinned_messages', {peerId, mids: messages, pinned: werePinned});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -11,7 +11,7 @@ type BroadcastEvents = {
|
||||
'user_update': number,
|
||||
'user_auth': UserAuth,
|
||||
'peer_changed': number,
|
||||
'peer_pinned_messages': number,
|
||||
'peer_pinned_messages': {peerId: number, mids?: number[], pinned?: boolean, unpinAll?: true},
|
||||
'peer_pinned_hidden': {peerId: number, maxId: number},
|
||||
'peer_typings': {peerId: number, typings: UserTyping[]},
|
||||
|
||||
|
@ -154,13 +154,13 @@ $bubble-margin: .25rem;
|
||||
|
||||
&.channel-post {
|
||||
.message.poll-message {
|
||||
.time {
|
||||
position: unset;
|
||||
}
|
||||
.time {
|
||||
position: unset;
|
||||
}
|
||||
}
|
||||
|
||||
poll-element .poll-footer {
|
||||
height: auto;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ $bubble-margin: .25rem;
|
||||
} */
|
||||
}
|
||||
|
||||
.bubble__container {
|
||||
.chat:not(.type-pinned) & .bubble__container {
|
||||
cursor: pointer;
|
||||
pointer-events: all;
|
||||
}
|
||||
@ -665,17 +665,17 @@ $bubble-margin: .25rem;
|
||||
}
|
||||
|
||||
&.is-selected {
|
||||
//border-radius: 0;
|
||||
border-radius: 0;
|
||||
|
||||
.album-item-media {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
&.animating {
|
||||
//transition: border-radius var(--layer-transition);
|
||||
transition: border-radius var(--layer-transition);
|
||||
|
||||
.album-item-media {
|
||||
transition: transform var(--layer-transition)/* , border-radius var(--layer-transition) */;
|
||||
transition: transform var(--layer-transition), border-radius var(--layer-transition);
|
||||
}
|
||||
}
|
||||
|
||||
@ -684,9 +684,10 @@ $bubble-margin: .25rem;
|
||||
transform: scale(.883333);
|
||||
}
|
||||
|
||||
/* &, .album-item-media {
|
||||
border-radius: .5rem;
|
||||
} */
|
||||
&, .album-item-media {
|
||||
//border-radius: .5rem;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user