Allow saving just the sticker in custom intro.

This commit is contained in:
John Preston 2024-04-01 11:20:11 +04:00
parent f95817861a
commit 139d1a9aa3
3 changed files with 7 additions and 6 deletions

View file

@ -187,10 +187,14 @@ struct ChatIntro {
QString description;
DocumentData *sticker = nullptr;
explicit operator bool() const {
[[nodiscard]] bool customPhrases() const {
return !title.isEmpty() || !description.isEmpty();
}
explicit operator bool() const {
return customPhrases() || sticker;
}
friend inline bool operator==(
const ChatIntro &a,
const ChatIntro &b) = default;

View file

@ -95,10 +95,10 @@ auto GenerateChatIntro(
margins,
links));
};
const auto title = data
const auto title = data.customPhrases()
? data.title
: tr::lng_chat_intro_default_title(tr::now);
const auto description = data
const auto description = data.customPhrases()
? data.description
: tr::lng_chat_intro_default_message(tr::now);
pushText(Ui::Text::Bold(title), st::chatIntroTitleMargin);

View file

@ -649,9 +649,6 @@ void ChatIntro::setupContent(
void ChatIntro::save() {
const auto show = controller()->uiShow();
const auto fail = [=](QString error) {
if (error == u"BUSINESS_RECIPIENTS_EMPTY"_q) {
show->showToast(tr::lng_greeting_recipients_empty(tr::now));
}
};
controller()->session().data().businessInfo().saveChatIntro(
_intro.current(),