Creating new poll removes old poll of different language

Created on 6 October 2023, about 1 year ago

Problem/Motivation

When creating a new poll (not translating an existing one) old polls on different langauges are removed. As an example if i have a poll translated in both Romanian and English and i create an new poll in English the latter will replace the old one as it should be but the Romanian page that should show the old poll will not.

Steps to reproduce

Creat a poll and translated in two different languages. The poll will appear as expected in both. Create a new poll in one language. The latter language will show the poll but the former language will show no poll.

Proposed resolution

Add language in getMostRecentPoll query

  public function getMostRecentPoll() {
    $language_code = \Drupal::languageManager()->getCurrentLanguage()->getId();
    $query = \Drupal::entityQuery('poll')
      ->condition('status', POLL_PUBLISHED)
      ->condition('langcode', $language_code)
      ->accessCheck(TRUE)
      ->sort('created', 'DESC')
      ->pager(1);
    return $this->loadMultiple($query->execute());
  }

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.6

Component

Code

Created by

🇬🇷Greece dithomas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024