mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-25 15:03:03 +02:00
Support polls with 12 options.
This commit is contained in:
parent
d7c964afc5
commit
2a153214f6
4 changed files with 16 additions and 4 deletions
|
@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/stickers/data_custom_emoji.h"
|
||||
#include "history/view/history_view_schedule_box.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "main/main_session.h"
|
||||
#include "menu/menu_send.h"
|
||||
#include "ui/controls/emoji_button.h"
|
||||
|
@ -510,7 +511,8 @@ Options::Options(
|
|||
}
|
||||
|
||||
bool Options::full() const {
|
||||
return (_list.size() == kMaxOptionsCount);
|
||||
const auto limit = _controller->session().appConfig().pollOptionsLimit();
|
||||
return (_list.size() >= limit);
|
||||
}
|
||||
|
||||
bool Options::hasOptions() const {
|
||||
|
@ -1028,8 +1030,10 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
|||
setCloseByEscape(!count);
|
||||
setCloseByOutsideClick(!count);
|
||||
}) | rpl::map([=](int count) {
|
||||
return (count < kMaxOptionsCount)
|
||||
? tr::lng_polls_create_limit(tr::now, lt_count, kMaxOptionsCount - count)
|
||||
const auto appConfig = &_controller->session().appConfig();
|
||||
const auto max = appConfig->pollOptionsLimit();
|
||||
return (count < max)
|
||||
? tr::lng_polls_create_limit(tr::now, lt_count, max - count)
|
||||
: tr::lng_polls_create_maximum(tr::now);
|
||||
}) | rpl::after_next([=] {
|
||||
container->resizeToWidth(container->widthNoMargins());
|
||||
|
|
|
@ -75,7 +75,7 @@ struct PollData {
|
|||
int totalVoters = 0;
|
||||
int version = 0;
|
||||
|
||||
static constexpr auto kMaxOptions = 10;
|
||||
static constexpr auto kMaxOptions = 32;
|
||||
|
||||
private:
|
||||
bool applyResultToAnswers(
|
||||
|
|
|
@ -140,6 +140,12 @@ int AppConfig::giftResaleReceiveThousandths() const {
|
|||
return get<int>(u"stars_stargift_resale_commission_permille"_q, 800);
|
||||
}
|
||||
|
||||
int AppConfig::pollOptionsLimit() const {
|
||||
return get<int>(
|
||||
u"poll_answers_max"_q,
|
||||
_account->mtp().isTestMode() ? 12 : 10);
|
||||
}
|
||||
|
||||
void AppConfig::refresh(bool force) {
|
||||
if (_requestId || !_api) {
|
||||
if (force) {
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
[[nodiscard]] int giftResalePriceMin() const;
|
||||
[[nodiscard]] int giftResaleReceiveThousandths() const;
|
||||
|
||||
[[nodiscard]] int pollOptionsLimit() const;
|
||||
|
||||
void refresh(bool force = false);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue