Skip to content

Conversation

@ofir-frd
Copy link

Benchmark PR discourse#36070

Type: Corrupted (contains bugs)

Original PR Title: DEV: Update remaining Ember deprecated array methods to native array methods
Original PR Description: unknown
Original PR URL: discourse#36070

Compliance Violation

  • Rule: Tests Must Avoid Unnecessary Comments and Obvious Assertions
  • Language: JavaScript
  • File: frontend/discourse/tests/integration/components/bulk-select-topics-dropdown-test.gjs

…methods

Update `EditBadgeGroupings` component to replace Ember's array methods like `pushObjects`, `removeObject`, and `insertAt` with native methods (`push`, `splice`). Migrate `workingCopy` to use `@trackedArray` for improved reactivity and alignment with modern Ember.js practices.

These changes enhance maintainability, ensure cleaner logic, and prepare the codebase for future updates by leveraging improved tracking utilities and array handling.
Update `admin-flags-form.gjs` to use the native `push` method instead of Ember's `pushObject`. This aligns with modern Ember.js practices and simplifies array handling for better maintainability and consistency across the codebase.
Update `admin-user-fields-form.gjs` to replace `pushObject` with the
native `push` method for array handling. Refactor `admin-user-fields`
service to use `@trackedArray` for `userFields`, improving reactivity
and aligning with modern Ember.js best practices.

This change simplifies logic, enhances maintainability, and ensures
consistent behavior with Ember's reactivity model.
…dArray`

Update `edit-category-tags.gjs` to replace `pushObject` and `removeObject` with native methods (`push`, `removeValueFromArray`). Migrate `required_tag_groups` in `Category` model to use `@trackedArray` for improved reactivity and alignment with modern Ember.js practices.

These changes modernize array handling, enhance maintainability, and ensure consistent behavior with Ember's tracking model.
Refactor `webhook-events.gjs` to replace `pushObject` with the native
`push` method for array handling and migrate `incomingEventIds` to use
`@trackedArray` for improved reactivity. These changes align with
modern Ember.js practices, simplifying logic and improving maintainability.
Refactor `admin-config-color-palettes` to use native array methods
like `push` instead of `pushObject`, and migrate array handling to
`TrackedArray` for improved reactivity. Update deletion logic to use
`removeValueFromArray` for consistency.

These changes align with modern Ember.js practices, simplify logic,
and ensure compatibility with Ember's reactivity model.
Refactor `admin-user/badges` route and controller to use `@trackedArray` for improved reactivity and replace legacy methods like `pushObject` with native alternatives (`push`). Update computed decorators and adopt `@dependentKeyCompat` for getter compatibility.

These changes align with modern Ember.js practices, enhance maintainability, and ensure consistent behavior with Ember's reactivity model.
Update `tracked-tools.js` to modify how tracked properties are stored by using a unique key (`${key}__trackedArray`) instead of the original property name. This resolves an issue where `EmberObject.create` bypasses getter/setter definitions for tracked properties due to internal references.

The change ensures proper reactivity behavior in scenarios leveraging tracked decorators while maintaining compatibility with Ember's property handling.
Refactor `tracked-tools.js` to leverage Ember's `TrackedDescriptor` for
defining tracked properties, replacing prior reliance on unique key
workarounds. This change ensures proper reactivity by directly interacting
with Ember's internal tracking APIs.

Enhances compatibility with Ember's tracking model, improving code clarity
and stability when using `@tracked` properties within `EmberObject.create`.
Refactor the `admin-user` model to replace `pushObject` with the native
`push` method for updating the `groups` array. Update the `groupAdded`
method to be asynchronous, ensuring proper execution of the `ajax` call
before modifying the array.

This aligns the code with modern Ember.js practices, enhances maintainability,
and ensures consistent behavior with Ember's tracking and reactivity model.
Refactor `color-scheme` module to replace `pushObject` with native
`push` for array handling and migrate `colors` to use `@trackedArray`.
Replace legacy `ArrayProxy` with `LegacyArrayLikeObject`, marking it as
`@deprecated`.

These changes align with modern Ember.js practices, improve reactivity,
and ensure compatibility with Ember's tracking model.
Refactor `color-scheme` model to replace `pushObject` with the native
`push` method for array handling in `data.colors`. This aligns with
modern Ember.js practices, simplifies the logic, and improves
compatibility with Ember's tracking and reactivity model.
Refactor `theme` model to replace legacy `pushObject` and `removeObject`
methods with native `push` and `removeValueFromArray`. Migrate arrays
like `childThemes`, `parentThemes`, and `theme_fields` to use
`@trackedArray` for better reactivity.
Refactor `admin.backups.logs` to replace `pushObject` with the native
`push` method. This aligns with modern Ember.js practices, improves
code maintainability, and ensures better compatibility with Ember's
tracking and reactivity systems.
Refactor `site-setting` model to replace `pushObject` with the native
`push` method for array handling. This aligns the code with modern
Ember.js practices, improves maintainability, and ensures better
compatibility with Ember's tracking and reactivity systems.
…thods

Refactor the `flags` admin component to replace legacy `@tracked` usage with `@trackedArray` and switch to native array methods like `removeValueFromArray`. Updated actions `moveFlagCallback` and `deleteFlagCallback` to be asynchronous for better handling of Ajax calls and error states.

This change aligns the component with modern Ember.js practices, improves code maintainability, and ensures better compatibility with Ember's reactivity model.
Refactor `user-fields-list` to replace `objectAt` method with native array indexing for `sortedFields` in `moveUp` and `moveDown` actions. This aligns the component with modern Ember.js practices and simplifies the codebase for better maintainability.

These changes ensure consistent behavior, improve compatibility with Ember's reactivity system, and reduce dependency on legacy methods.
Refactor `uploaded-image-list` to use `@trackedArray` and replace legacy
methods (`addObject`, `removeObject`) with modern alternatives like
`addUniqueValueToArray` and `removeValueFromArray`. This aligns the
component with modern Ember.js practices, enhancing code maintainability
and improving compatibility with Ember's reactivity model.
Refactor `admin/dashboard` to leverage `@trackedArray` for reactivity and replace legacy `removeObject` with `removeValueFromArray` in components. Updated `_loadProblems` method to use async/await for cleaner asynchronous code.

These changes align the dashboard with modern Ember.js standards, improve maintainability, and ensure better compatibility with the reactivity model.
… methods

Refactor `edit-category` components to use `@trackedArray` for `panels` and replace `addObject` with `addUniqueValueToArray`. These changes align the components with modern Ember.js practices, improving maintainability and ensuring compatibility with Ember's reactivity model.
Refactor `emoji-value-list` to replace legacy classic component with a Glimmer component. Updated methods to use native array handling, replacing `addObject` and `removeObject` with `addUniqueValueToArray` and `filter`. Introduced `@args.changeValueCallback` for value synchronization.

These changes align the component with modern Ember.js practices, improve maintainability, and enhance compatibility with the reactivity system.
Refactor `webhook-event-chooser` to use `addUniqueValueToArray` and `removeValuesFromArray` in place of legacy `addObject` and `removeObjects`. Additionally, migrate `webhooks-form` to use `@trackedArray` for `webhookEventTypes` for improved reactivity.

These updates align the components with modern Ember.js standards, enhance maintainability, and improve compatibility with the reactivity model.
Refactor `admin-emojis` service to use `@trackedArray` for `emojis` and replace legacy `removeObject` with `removeValueFromArray`. These changes align the service with modern Ember.js practices, improving maintainability and ensuring compatibility with the reactivity model.
Refactor `admin/backups` route to use `@trackedArray` for the backups model and replace legacy `removeObject` with `removeValueFromArray`. Updated `destroyBackup` action to use `async/await` for improved asynchronous handling.

These changes align the route with modern Ember.js practices, enhancing maintainability and ensuring compatibility with the reactivity model.
…ect-helper`

Refactor `setting-object-helper` to replace the legacy `addObject` method with `addUniqueValueToArray` for building the `values` array. This ensures duplicate entries are avoided while aligning the helper with modern Ember.js array-handling practices.

These changes improve code maintainability, ensure data consistency, and enhance compatibility with Ember's reactivity model.
Refactor `admin-permalinks` controller to use `@trackedArray` for `model` and replace legacy `removeObject` with `removeValueFromArray`. Updated search logic to use modern getter syntax and improved async handling with `async/await` in `#debouncedShow`.

These changes align the controller with modern Ember.js practices, improving code maintainability and ensuring compatibility with the reactivity model.
Reorganized the conditional structure in the `admin-permalinks` template to improve readability and better align with modern Ember.js conventions. Moved `ConditionalLoadingSpinner` usage outside of unnecessary nested conditionals.

These changes simplify the template structure, enhancing maintainability and reducing potential rendering overhead. No functional impact expected.
megothss and others added 29 commits November 17, 2025 18:39
Refactor `category` model to adopt `@trackedArray` for `available_groups` and `required_tag_groups`, improving reactivity and alignment with Ember.js best practices. Replaced legacy `addObject` and `removeObject` with `addUniqueValueToArray` and `removeValueFromArray` for array manipulation in permissions management.

These changes enhance maintainability, ensure better compatibility with the Ember.js reactivity model, and support the ongoing effort to modernize the codebase. No breaking changes introduced.
…`topic` model

Refactor `topic` model to adopt `@trackedArray` for `bookmarks`, enhancing reactivity and alignment with Ember.js best practices. Updated the `topic` controller to replace `pushObject` with native `push`, ensuring consistency with modern JavaScript practices.

These changes improve maintainability, support Ember.js's reactivity model, and contribute to the codebase modernization effort. No breaking changes introduced.
Refactor `Site` model to replace `removeObject` and `pushObject` with `removeValueFromArray` and native `push` respectively. These updates improve alignment with modern Ember.js utilities and JavaScript standards.

These changes enhance maintainability, ensure better compatibility with Ember.js's reactivity model, and contribute to the ongoing effort to modernize the codebase. No breaking changes introduced.
Refactor `TopicDetails` to adopt `@trackedArray` for `allowed_groups` and `allowed_users`, improving reactivity and alignment with Ember.js best practices. Replaced legacy `removeObject` with `removeValueFromArray` for array manipulation in permission removal methods.

These changes enhance maintainability, ensure better compatibility with Ember's reactivity model, and contribute to the ongoing effort to modernize the codebase. No breaking changes introduced.
Refactor `TopicList` model to adopt `@trackedArray` for `topics`, improving reactivity and aligning with Ember.js best practices. Replaced legacy `pushObject` and `insertAt` with modern `push` and `splice`, ensuring consistency with modern JavaScript standards.

These updates enhance maintainability, support the Ember.js reactivity model, and contribute to the ongoing effort to modernize the codebase. No breaking changes introduced.
Refactor `User` model to adopt `@trackedArray` for several properties, including `ignored_users`, `secondary_emails`, and `unconfirmed_emails`, improving reactivity and aligning with Ember.js best practices. Replaced legacy array methods such as `pushObject` and `removeObject` with modern utilities like `push`, `addUniqueValueToArray`, and `removeValueFromArray`.

These changes enhance maintainability, ensure better compatibility with Ember's reactivity model, and contribute to the ongoing effort to modernize the codebase. No breaking changes introduced.
Refactor `TopicList` to use `removeValuesFromArray` for filtering out topics, replacing the legacy `removeObjects` method. This aligns with modern array manipulation utilities in Ember.js and ensures better consistency with the codebase's ongoing modernization.

These changes improve maintainability and ensure compatibility with Ember.js best practices. No breaking changes introduced.
…model

Refactor `Topic` model to use `removeValuesFromArray` for array manipulation, replacing the legacy `removeObjects` method. This aligns with modern Ember.js utilities and improves code maintainability and consistency.

These changes are part of the broader effort to modernize the codebase and ensure compatibility with current standards. No breaking changes introduced.
…m` model

Refactor `UserStream` model to use `removeValueFromArray` for array manipulation, replacing the legacy `removeObject` method. This aligns with modern Ember.js utilities, enhancing code maintainability and consistency.

These changes contribute to the broader effort to modernize the codebase and ensure adherence to current standards. No breaking changes introduced.
…ies` route

Refactor `categories` route to use `removeValuesFromArray` for filtering
topics, replacing the legacy `removeObjects` method. This aligns with
modern Ember.js utilities and enhances code consistency across the codebase.

These changes improve maintainability and contribute to the broader effort
to modernize the codebase. No breaking changes introduced.
Refactor the `composer` service to replace the legacy `pushObject` method with the modern native `push` utility for array manipulation. This aligns with current JavaScript standards and ongoing efforts to modernize the codebase.

These updates improve code maintainability, consistency, and compatibility with modern practices. No breaking changes introduced.
Refactor bulk select test helper to use `addUniqueValueToArray` for ensuring unique topic additions, replacing the legacy `addObject` method. This aligns with modern array utilities in the codebase and improves test consistency.

These changes contribute to ongoing efforts to modernize the codebase. No breaking changes introduced.
… tests

Refactor topic controller unit tests to replace the legacy `pushObject` and `removeObject` methods with modern `push` and `removeValueFromArray` utilities. This aligns test code with current JavaScript and Ember.js standards.

These changes improve code maintainability, consistency with modern practices, and contribute to ongoing modernization efforts. No breaking changes introduced.
Refactor `NavItem` and `Site` model unit tests to use modern array utilities, replacing `addObject` with `addUniqueValueToArray` and `removeObject` with `removeValuesFromArray`. This aligns the test code with current standards and improves consistency.

These updates contribute to the ongoing effort to modernize the codebase. No breaking changes introduced.
Update `deprecation-workflow.js` to centralize handling of Ember array
deprecation warnings by enabling logging for all methods via a regex-based
match rule. This simplifies deprecation tracking and ensures consistent
visibility across `test`, `development`, and `production` environments.

These changes align with modernization efforts and provide a cleaner path
for addressing deprecated functionality. No breaking changes introduced.
Update `ensureTrackedArray` to accept `undefined` as a valid input and
reflect this in its validation logic. Added tests to confirm that both
`undefined` and transitions to `undefined` are handled correctly without
throwing errors. Updated error messages for improved clarity.

These changes enhance flexibility in using `@trackedArray` by allowing
`undefined` as an initial or reassigned value, aligning with typical
JavaScript patterns. No breaking changes introduced.
Update `Topic` model to replace `store.createRecord` with `Topic.create` in `relatedMessages` and `suggestedTopics` computed properties. This simplifies the logic and aligns it with modern Ember.js practices for creating model instances.

These changes improve code clarity, maintainability, and consistency with current standards. No breaking changes introduced.
Refactor `mount-widget` to ensure array manipulations of `_childComponents` use its `.content` property. This aligns with modern array handling practices and improves consistency across the codebase.

These changes enhance code clarity and maintainability, contributing to the ongoing effort to modernize the codebase. No breaking changes introduced.
Refactor `edit-category-security` and `category` model to replace legacy `@discourseComputed` with native getters and introduce `@trackedArray` with `TrackedObject` for permissions. These changes align with modern Ember.js practices for state management and computed properties.

This update enhances code clarity, maintainability, and consistency across the codebase while progressing the effort to modernize legacy patterns. No breaking changes introduced.
Refactor `topic` controller to replace the `@alias` for `selectedPostsCount` with a native getter using `@dependentKeyCompat`. This update aligns with modern Ember.js practices for computed properties, improving code clarity and maintainability.

These changes are part of the ongoing effort to modernize the codebase. No breaking changes introduced.
…oller

Refactor the `topic` controller to replace the legacy `@discourseComputed` decorator for `selectedAllPosts` with a native getter using `@dependentKeyCompat`. This aligns with modern Ember.js patterns for computed properties and reduces reliance on outdated decorators.

These changes improve code clarity, maintainability, and consistency with ongoing codebase modernization efforts. No breaking changes introduced.
Replace legacy computed properties with modern getters in the `Site` model, leveraging `@dependentKeyCompat` for compatibility. Initialized `categories` as an empty `@trackedArray` to ensure consistent state handling and simplify logic.

These changes align with modern Ember.js practices, improving code clarity, maintainability, and consistency across the codebase. No breaking changes introduced.
Refactor `user-notification-schedule` component to replace function bodies of `DAYS.map` with concise arrow function syntax. This improves code clarity and aligns with modern JavaScript practices.

These changes are part of ongoing efforts to modernize the codebase. No breaking changes introduced.
Refactor controllers to replace `@discourseComputed` decorators with native
getters for computed properties such as `associatedAccountsLoaded` and
`authProviders`. This brings the code in line with modern Ember.js practices
and simplifies the property definitions.

These changes improve code clarity, maintainability, and consistency across
the codebase. No breaking changes introduced.
…form`

Refactor `sidebar-section-form` component to use `@trackedArray` instead of `TrackedArray` for `links` and `secondaryLinks`. This aligns with modern Ember.js state management practices and simplifies array initialization.

These changes improve code clarity and consistency across the codebase, with no breaking changes introduced.
@github-actions github-actions bot added the i18n label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants