Polls:
Fix update poll when 'min' in results Fix creation bug Fix overflow in answer input field Fix creation popup height
This commit is contained in:
parent
0e78498f87
commit
2ddc209ee5
@ -159,7 +159,7 @@ export default class PopupCreatePoll extends PopupElement {
|
||||
}
|
||||
|
||||
const quizSolution = this.quizSolutionInput.value.trim() || undefined;
|
||||
if(quizSolution.length > MAX_LENGTH_SOLUTION) {
|
||||
if(quizSolution?.length > MAX_LENGTH_SOLUTION) {
|
||||
toast('Explanation is too long.');
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { InputMedia } from "../../layer";
|
||||
import { logger, LogLevels } from "../logger";
|
||||
import { logger } from "../logger";
|
||||
import apiManager from "../mtproto/mtprotoworker";
|
||||
import { MOUNT_CLASS_TO } from "../mtproto/mtproto_config";
|
||||
import { RichTextProcessor } from "../richtextprocessor";
|
||||
@ -74,7 +74,7 @@ class AppPollsManager {
|
||||
public polls: {[id: string]: Poll} = {};
|
||||
public results: {[id: string]: PollResults} = {};
|
||||
|
||||
private log = logger('POLLS', LogLevels.error);
|
||||
private log = logger('POLLS'/* , LogLevels.error */);
|
||||
|
||||
constructor() {
|
||||
$rootScope.$on('apiUpdate', (e) => {
|
||||
@ -89,7 +89,7 @@ class AppPollsManager {
|
||||
case 'updateMessagePoll': { // when someone voted, we too
|
||||
this.log('updateMessagePoll:', update);
|
||||
|
||||
let poll: Poll = /* this.polls[update.poll_id] || */update.poll;
|
||||
let poll: Poll = update.poll || this.polls[update.poll_id];
|
||||
if(!poll) {
|
||||
break;
|
||||
}
|
||||
@ -124,13 +124,15 @@ class AppPollsManager {
|
||||
public saveResults(poll: Poll, results: PollResults) {
|
||||
this.results[poll.id] = results;
|
||||
|
||||
poll.chosenIndexes.length = 0;
|
||||
if(results?.results?.length) {
|
||||
results.results.forEach((answer, idx) => {
|
||||
if(answer.pFlags?.chosen) {
|
||||
poll.chosenIndexes.push(idx);
|
||||
}
|
||||
});
|
||||
if(!results.pFlags.min) { // ! https://core.telegram.org/constructor/pollResults - min
|
||||
poll.chosenIndexes.length = 0;
|
||||
if(results?.results?.length) {
|
||||
results.results.forEach((answer, idx) => {
|
||||
if(answer.pFlags?.chosen) {
|
||||
poll.chosenIndexes.push(idx);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#{$parent} {
|
||||
&-container {
|
||||
//max-height: 468px;
|
||||
max-height: 640px;
|
||||
max-height: unquote('min(640px, 100%)');
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
@ -46,6 +46,10 @@
|
||||
|
||||
.poll-create-questions {
|
||||
padding: 0px 1.25rem 2.03125rem;
|
||||
|
||||
.input-field input {
|
||||
padding-right: 3.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
.poll-create-settings {
|
||||
|
Loading…
x
Reference in New Issue
Block a user