Skip to content

Fix translated attributes field type change#9547

Merged
andreslucena merged 2 commits intodecidim:developfrom
mainio:fix/translated-attributes-field-change
Jul 13, 2022
Merged

Fix translated attributes field type change#9547
andreslucena merged 2 commits intodecidim:developfrom
mainio:fix/translated-attributes-field-change

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

🎩 What? Why?

The translated attributes getter does not properly work in case the original stored value for the record is not in the expected hash format. This is annoying when changing the field type from string to translated e.g. in content blocks as this breaks the editing view.

This fixes the problem by checking if the stored value is a hash and returning the original value for all locale specific getters in case this happens.

Testing

  • Create a content block with a non-translated string attribute
  • Edit that content block and save it from the admin panel
  • Change the string attribute as translated and restart the server
  • Try to go back to the content block editing view

@ahukkanen ahukkanen added module: core type: fix PRs that implement a fix for a bug labels Jul 7, 2022
@ahukkanen ahukkanen requested a review from andreslucena July 8, 2022 15:41
@andreslucena andreslucena merged commit d011bc1 into decidim:develop Jul 13, 2022
@ahukkanen ahukkanen deleted the fix/translated-attributes-field-change branch July 13, 2022 10:56
@ferblape
Copy link
Copy Markdown
Contributor

@andreslucena we are facing some issues in 0.26 stable that this PR would solve. If you are planning a 0.26.3 release, I can create the backport

entantoencuanto added a commit that referenced this pull request Jul 15, 2022
…ging

* feature/redesign-main-footer:
  Reorder elements in main links of footer and define links and texts
  Define a cell for static_pages and topics configured to appear in footer
  Fix translation call
  Set fixed links in redesigned_main_legal partial
  Add FooterMenuPresenter to display menu items in footer
  Fix budgets seeds on non development apps (#9585)
  Return 404 when there isn't a valid component in program (#9576)
  Add missing queue close_meeting_reminder to sidekiq configuration (#9568)
  Make the HERE Map display in the currently selected language (#9552)
  Add help text for proposals' 'publish answers immediately' setting  (#9549)
  Fix admin language selector with more than 4 locales (#9519)
  Fix publish event on official proposals (#9421)
  Prevent missing ActionLog entries to break the application (#9502)
  Add boilerplate structure to CHANGELOG (#9501)
  Add step-by-step instructions of the Crowdin releases process (#9555)
  Fix translated attributes field type change (#9547)
  Add `modifyList` option to the autocomplete element (#9548)
  Admin log filters (#9460)
  Improve the default gitignore files created by the generators (#9507)
@andreslucena
Copy link
Copy Markdown
Member

andreslucena commented Sep 12, 2022

@andreslucena we are facing some issues in 0.26 stable that this PR would solve. If you are planning a 0.26.3 release, I can create the backport

@ferblape it's already backported and merged. I don't know if there's any plan to make the 0.26.3 release in the short term. Meanwhile, you can point to the release/0.26-stable branch, of course.

eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
* Fix issue when the attribute is changed from string to translatable

* Test the translated attribute conversion when the original value is a string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants