diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings
index 78e4b709a..18573ca3d 100644
--- a/Telegram/Resources/langs/lang.strings
+++ b/Telegram/Resources/langs/lang.strings
@@ -1768,6 +1768,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_restricted_send_inline" = "The admins of this group restricted you from posting inline content here.";
"lng_restricted_send_polls" = "The admins of this group restricted you from posting polls here.";
+"lng_restricted_send_message_until" = "The admins of this group restricted you from writing here until {date}, {time}.";
+"lng_restricted_send_media_until" = "The admins of this group restricted you from posting media content here until {date}, {time}.";
+"lng_restricted_send_stickers_until" = "The admins of this group restricted you from posting stickers here until {date}, {time}.";
+"lng_restricted_send_gifs_until" = "The admins of this group restricted you from posting GIFs here until {date}, {time}.";
+"lng_restricted_send_inline_until" = "The admins of this group restricted you from posting inline content here until {date}, {time}.";
+"lng_restricted_send_polls_until" = "The admins of this group restricted you from posting polls here until {date}, {time}.";
+
"lng_restricted_send_message_all" = "Writing messages isn't allowed in this group.";
"lng_restricted_send_media_all" = "Posting media content isn't allowed in this group.";
"lng_restricted_send_stickers_all" = "Posting stickers isn't allowed in this group.";
diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml
index 530165669..7904b4d0e 100644
--- a/Telegram/Resources/uwp/AppX/AppxManifest.xml
+++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml
@@ -9,7 +9,7 @@
+ Version="1.8.15.0" />
Telegram Desktop
Telegram FZ-LLC
diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp
index a1d6bc3a0..eb8f4f150 100644
--- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp
+++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp
@@ -170,7 +170,7 @@ void AppendFoundEmoji(
const std::vector &list) {
// It is important that the 'result' won't relocate while inserting.
result.reserve(result.size() + list.size());
- const auto alreadyBegin = result.data();
+ const auto alreadyBegin = begin(result);
const auto alreadyEnd = alreadyBegin + result.size();
auto &&add = ranges::view::all(
@@ -204,6 +204,12 @@ void AppendLegacySuggestions(
}
const auto suggestions = GetSuggestions(QStringToUTF16(query));
+
+ // It is important that the 'result' won't relocate while inserting.
+ result.reserve(result.size() + suggestions.size());
+ const auto alreadyBegin = begin(result);
+ const auto alreadyEnd = alreadyBegin + result.size();
+
auto &&add = ranges::view::all(
suggestions
) | ranges::view::transform([](const Suggestion &suggestion) {
@@ -214,10 +220,14 @@ void AppendLegacySuggestions(
};
}) | ranges::view::filter([&](const Result &entry) {
const auto i = entry.emoji
- ? ranges::find(result, entry.emoji, &Result::emoji)
- : end(result);
+ ? ranges::find(
+ alreadyBegin,
+ alreadyEnd,
+ entry.emoji,
+ &Result::emoji)
+ : alreadyEnd;
return (entry.emoji != nullptr)
- && (i == end(result));
+ && (i == alreadyEnd);
});
result.insert(end(result), add.begin(), add.end());
}
@@ -593,21 +603,24 @@ std::vector EmojiKeywords::query(
}
auto result = std::vector();
for (const auto &[language, item] : _data) {
- const auto oldcount = result.size();
const auto list = item->query(normalized, exact);
+
+ // It is important that the 'result' won't relocate while inserting.
+ result.reserve(result.size() + list.size());
+ const auto alreadyBegin = begin(result);
+ const auto alreadyEnd = alreadyBegin + result.size();
+
auto &&add = ranges::view::all(
list
) | ranges::view::filter([&](Result entry) {
// In each item->query() result the list has no duplicates.
// So we need to check only for duplicates between queries.
- const auto oldbegin = begin(result);
- const auto oldend = oldbegin + oldcount;
const auto i = ranges::find(
- oldbegin,
- oldend,
+ alreadyBegin,
+ alreadyEnd,
entry.emoji,
&Result::emoji);
- return (i == oldend);
+ return (i == alreadyEnd);
});
result.insert(end(result), add.begin(), add.end());
}
diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h
index eb2587416..86b17567c 100644
--- a/Telegram/SourceFiles/core/version.h
+++ b/Telegram/SourceFiles/core/version.h
@@ -15,8 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#define TDESKTOP_ALPHA_VERSION (0ULL)
#endif // TDESKTOP_OFFICIAL_TARGET
-constexpr auto AppVersion = 1008013;
-constexpr auto AppVersionStr = "1.8.13";
+constexpr auto AppVersion = 1008015;
+constexpr auto AppVersionStr = "1.8.15";
constexpr auto AppBetaVersion = true;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
constexpr auto AppKotatoVersion = 1000007;
diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp
index 6c6610f8b..3dee18076 100644
--- a/Telegram/SourceFiles/data/data_peer.cpp
+++ b/Telegram/SourceFiles/data/data_peer.cpp
@@ -757,6 +757,38 @@ std::optional RestrictionError(
using Flag = ChatRestriction;
if (const auto restricted = peer->amRestricted(restriction)) {
const auto all = restricted.isWithEveryone();
+ const auto channel = peer->asChannel();
+ if (!all && channel) {
+ auto restrictedUntil = channel->restrictedUntil();
+ if (restrictedUntil > 0 && !ChannelData::IsRestrictedForever(restrictedUntil)) {
+ auto restrictedUntilDateTime = base::unixtime::parse(channel->restrictedUntil());
+ auto date = restrictedUntilDateTime.toString(qsl("dd.MM.yy"));
+ auto time = restrictedUntilDateTime.toString(cTimeFormat());
+
+ switch (restriction) {
+ case Flag::f_send_polls:
+ return tr::lng_restricted_send_polls_until(
+ tr::now, lt_date, date, lt_time, time);
+ case Flag::f_send_messages:
+ return tr::lng_restricted_send_message_until(
+ tr::now, lt_date, date, lt_time, time);
+ case Flag::f_send_media:
+ return tr::lng_restricted_send_media_until(
+ tr::now, lt_date, date, lt_time, time);
+ case Flag::f_send_stickers:
+ return tr::lng_restricted_send_stickers_until(
+ tr::now, lt_date, date, lt_time, time);
+ case Flag::f_send_gifs:
+ return tr::lng_restricted_send_gifs_until(
+ tr::now, lt_date, date, lt_time, time);
+ case Flag::f_send_inline:
+ case Flag::f_send_games:
+ return tr::lng_restricted_send_inline_until(
+ tr::now, lt_date, date, lt_time, time);
+ }
+ Unexpected("Restriction in Data::RestrictionErrorKey.");
+ }
+ }
switch (restriction) {
case Flag::f_send_polls:
return all
diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp
index bf84df541..77f283092 100644
--- a/Telegram/SourceFiles/history/history_widget.cpp
+++ b/Telegram/SourceFiles/history/history_widget.cpp
@@ -3227,7 +3227,7 @@ void HistoryWidget::chooseAttach() {
} else if (const auto error = Data::RestrictionError(
_peer,
ChatRestriction::f_send_media)) {
- Ui::Toast::Show(*error);
+ ShowErrorToast(*error);
return;
} else if (showSlowmodeError()) {
return;
diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp
index 9e51ada7e..f2813348f 100644
--- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp
+++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp
@@ -170,7 +170,7 @@ void ScheduledWidget::chooseAttach() {
if (const auto error = Data::RestrictionError(
_history->peer,
ChatRestriction::f_send_media)) {
- Ui::Toast::Show(*error);
+ ShowErrorToast(*error);
return;
}
diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp
index cacf33239..24a485763 100644
--- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp
+++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp
@@ -625,7 +625,7 @@ void Photo::prepareThumbnail(QSize size, QSize frame) const {
}
Video::Video(not_null context, Result *result) : FileBase(context, result)
-, _link(getResultContentUrlHandler())
+, _link(getResultPreviewHandler())
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
if (int duration = content_duration()) {
@@ -1057,7 +1057,7 @@ void Contact::prepareThumbnail(int width, int height) const {
Article::Article(not_null context, Result *result, bool withThumb) : ItemBase(context, result)
, _url(getResultUrlHandler())
-, _link(getResultContentUrlHandler())
+, _link(getResultPreviewHandler())
, _withThumb(withThumb)
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp
index 32601d549..4823a58f1 100644
--- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp
+++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp
@@ -187,11 +187,16 @@ ClickHandlerPtr ItemBase::getResultUrlHandler() const {
return ClickHandlerPtr();
}
-ClickHandlerPtr ItemBase::getResultContentUrlHandler() const {
+ClickHandlerPtr ItemBase::getResultPreviewHandler() const {
if (!_result->_content_url.isEmpty()) {
return std::make_shared(
_result->_content_url,
false);
+ } else if (_result->_document && _result->_document->canBePlayed()) {
+ return std::make_shared(
+ _result->_document);
+ } else if (_result->_photo) {
+ return std::make_shared(_result->_photo);
}
return ClickHandlerPtr();
}
diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.h b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.h
index 106cfb507..b506d6cae 100644
--- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.h
+++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.h
@@ -103,7 +103,7 @@ protected:
int getResultDuration() const;
QString getResultUrl() const;
ClickHandlerPtr getResultUrlHandler() const;
- ClickHandlerPtr getResultContentUrlHandler() const;
+ ClickHandlerPtr getResultPreviewHandler() const;
QString getResultThumbLetter() const;
not_null context() const {
diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp
index 495ee9ed1..0cacca7fa 100644
--- a/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp
+++ b/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp
@@ -272,9 +272,9 @@ bool Result::onChoose(Layout::ItemBase *layout) {
} else if (_document->loading()) {
_document->cancel();
} else {
- _document->save(
+ DocumentSaveClickHandler::Save(
Data::FileOriginSavedGifs(),
- QString());
+ _document);
}
return false;
}
diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp
index 315f3ad21..c63118241 100644
--- a/Telegram/SourceFiles/mainwidget.cpp
+++ b/Telegram/SourceFiles/mainwidget.cpp
@@ -809,6 +809,7 @@ void MainWidget::hiderLayer(base::unique_qptr hider) {
_hider->hidden(
) | rpl::start_with_next([=, instance = _hider.get()] {
clearHider(instance);
+ instance->hide();
instance->deleteLater();
}, _hider->lifetime());
diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
index 99d773f64..9aa9e6cc9 100644
--- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
+++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
@@ -2358,25 +2358,19 @@ void OverlayWidget::playbackPauseResume() {
Expects(_streamed != nullptr);
_streamed->resumeOnCallEnd = false;
- if (const auto item = Auth().data().message(_msgid)) {
- if (_streamed->player.failed()) {
- clearStreaming();
- initStreaming();
- } else if (_streamed->player.finished()) {
- _streamingStartPaused = false;
- restartAtSeekPosition(0);
- } else if (_streamed->player.paused()) {
- _streamed->player.resume();
- updatePlaybackState();
- playbackPauseMusic();
- } else {
- _streamed->player.pause();
- updatePlaybackState();
- }
- } else {
+ if (_streamed->player.failed()) {
clearStreaming();
- updateControls();
- update();
+ initStreaming();
+ } else if (_streamed->player.finished()) {
+ _streamingStartPaused = false;
+ restartAtSeekPosition(0);
+ } else if (_streamed->player.paused()) {
+ _streamed->player.resume();
+ updatePlaybackState();
+ playbackPauseMusic();
+ } else {
+ _streamed->player.pause();
+ updatePlaybackState();
}
}
@@ -3324,7 +3318,7 @@ void OverlayWidget::mousePressEvent(QMouseEvent *e) {
void OverlayWidget::mouseDoubleClickEvent(QMouseEvent *e) {
updateOver(e->pos());
- if (_over == OverVideo) {
+ if (_over == OverVideo && _streamed) {
playbackToggleFullScreen();
playbackPauseResume();
} else {
diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp
index 7891995be..cc865eace 100644
--- a/Telegram/SourceFiles/ui/text/text.cpp
+++ b/Telegram/SourceFiles/ui/text/text.cpp
@@ -118,14 +118,18 @@ bool ComputeCheckTilde(const style::TextStyle &st) {
bool chIsBad(QChar ch) {
return (ch == 0)
- || (ch >= 8232 && ch < 8237)
- || (ch >= 65024 && ch < 65040 && ch != 65039)
- || (ch >= 127 && ch < 160 && ch != 156)
+ || (ch >= 8232 && ch < 8237)
+ || (ch >= 65024 && ch < 65040 && ch != 65039)
+ || (ch >= 127 && ch < 160 && ch != 156)
- // qt harfbuzz crash see https://github.com/telegramdesktop/tdesktop/issues/4551
- || (Platform::IsMac() && ch == 6158)
+ // qt harfbuzz crash see https://github.com/telegramdesktop/tdesktop/issues/4551
+ || (Platform::IsMac() && ch == 6158)
- // tmp hack see https://bugreports.qt.io/browse/QTBUG-48910
+ || (Platform::IsMac()
+ && !Platform::IsMac10_7OrGreater()
+ && (ch == 8207 || ch == 8206 || ch == 8288))
+
+ // tmp hack see https://bugreports.qt.io/browse/QTBUG-48910
|| (Platform::IsMac10_11OrGreater()
&& !Platform::IsMac10_12OrGreater()
&& ch >= 0x0B00
diff --git a/Telegram/build/version b/Telegram/build/version
index aec94f196..8afc73acc 100644
--- a/Telegram/build/version
+++ b/Telegram/build/version
@@ -1,6 +1,6 @@
-AppVersion 1008013
+AppVersion 1008015
AppVersionStrMajor 1.8
-AppVersionStrSmall 1.8.13
-AppVersionStr 1.8.13
+AppVersionStrSmall 1.8.15
+AppVersionStr 1.8.15
BetaChannel 0
AlphaVersion 0
diff --git a/changelog.txt b/changelog.txt
index b7f97921a..b67b9206a 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,11 @@
+1.8.15 (07.10.19)
+
+- Bug fixes and other minor improvements.
+
+1.8.14 (03.10.19)
+
+- Bug fixes and other minor improvements.
+
1.8.13 (03.10.19)
- Bug fixes and other minor improvements.