mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-05 17:06:03 +00:00
Support drafts in monoforum sublists.
This commit is contained in:
@@ -54,6 +54,7 @@ constexpr auto kOccupyFor = TimeId(60);
|
||||
constexpr auto kReoccupyEach = 30 * crl::time(1000);
|
||||
constexpr auto kMaxSupportInfoLength = MaxMessageSize * 4;
|
||||
constexpr auto kTopicRootId = MsgId(0);
|
||||
constexpr auto kMonoforumPeerId = PeerId(0);
|
||||
|
||||
class EditInfoBox : public Ui::BoxContent {
|
||||
public:
|
||||
@@ -183,7 +184,7 @@ uint32 ParseOccupationTag(History *history) {
|
||||
if (!TrackHistoryOccupation(history)) {
|
||||
return 0;
|
||||
}
|
||||
const auto draft = history->cloudDraft(kTopicRootId);
|
||||
const auto draft = history->cloudDraft(kTopicRootId, kMonoforumPeerId);
|
||||
if (!draft) {
|
||||
return 0;
|
||||
}
|
||||
@@ -209,7 +210,7 @@ QString ParseOccupationName(History *history) {
|
||||
if (!TrackHistoryOccupation(history)) {
|
||||
return QString();
|
||||
}
|
||||
const auto draft = history->cloudDraft(kTopicRootId);
|
||||
const auto draft = history->cloudDraft(kTopicRootId, kMonoforumPeerId);
|
||||
if (!draft) {
|
||||
return QString();
|
||||
}
|
||||
@@ -235,7 +236,7 @@ TimeId OccupiedBySomeoneTill(History *history) {
|
||||
if (!TrackHistoryOccupation(history)) {
|
||||
return 0;
|
||||
}
|
||||
const auto draft = history->cloudDraft(kTopicRootId);
|
||||
const auto draft = history->cloudDraft(kTopicRootId, kMonoforumPeerId);
|
||||
if (!draft) {
|
||||
return 0;
|
||||
}
|
||||
@@ -353,7 +354,7 @@ void Helper::updateOccupiedHistory(
|
||||
not_null<Window::SessionController*> controller,
|
||||
History *history) {
|
||||
if (isOccupiedByMe(_occupiedHistory)) {
|
||||
_occupiedHistory->clearCloudDraft(kTopicRootId);
|
||||
_occupiedHistory->clearCloudDraft(kTopicRootId, kMonoforumPeerId);
|
||||
_session->api().saveDraftToCloudDelayed(_occupiedHistory);
|
||||
}
|
||||
_occupiedHistory = history;
|
||||
@@ -377,7 +378,10 @@ void Helper::occupyInDraft() {
|
||||
&& !isOccupiedBySomeone(_occupiedHistory)
|
||||
&& !_supportName.isEmpty()) {
|
||||
const auto draft = OccupiedDraft(_supportNameNormalized);
|
||||
_occupiedHistory->createCloudDraft(kTopicRootId, &draft);
|
||||
_occupiedHistory->createCloudDraft(
|
||||
kTopicRootId,
|
||||
kMonoforumPeerId,
|
||||
&draft);
|
||||
_session->api().saveDraftToCloudDelayed(_occupiedHistory);
|
||||
_reoccupyTimer.callEach(kReoccupyEach);
|
||||
}
|
||||
@@ -386,7 +390,10 @@ void Helper::occupyInDraft() {
|
||||
void Helper::reoccupy() {
|
||||
if (isOccupiedByMe(_occupiedHistory)) {
|
||||
const auto draft = OccupiedDraft(_supportNameNormalized);
|
||||
_occupiedHistory->createCloudDraft(kTopicRootId, &draft);
|
||||
_occupiedHistory->createCloudDraft(
|
||||
kTopicRootId,
|
||||
kMonoforumPeerId,
|
||||
&draft);
|
||||
_session->api().saveDraftToCloudDelayed(_occupiedHistory);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user