2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Add simple forwarding options on bar click.

This commit is contained in:
John Preston
2021-08-31 19:47:38 +03:00
parent e9a5c45f34
commit 9dfc60026e
18 changed files with 378 additions and 94 deletions

View File

@@ -336,16 +336,27 @@ void History::draftSavedToCloud() {
session().local().writeDrafts(this);
}
HistoryItemsList History::validateForwardDraft() {
auto result = owner().idsToItems(_forwardDraft);
if (result.size() != _forwardDraft.size()) {
setForwardDraft(owner().itemsToIds(result));
Data::ResolvedForwardDraft History::resolveForwardDraft(
const Data::ForwardDraft &draft) const {
return Data::ResolvedForwardDraft{
.items = owner().idsToItems(draft.ids),
.options = draft.options,
};
}
Data::ResolvedForwardDraft History::resolveForwardDraft() {
auto result = resolveForwardDraft(_forwardDraft);
if (result.items.size() != _forwardDraft.ids.size()) {
setForwardDraft({
.ids = owner().itemsToIds(result.items),
.options = result.options,
});
}
return result;
}
void History::setForwardDraft(MessageIdsList &&items) {
_forwardDraft = std::move(items);
void History::setForwardDraft(Data::ForwardDraft &&draft) {
_forwardDraft = std::move(draft);
}
HistoryItem *History::createItem(