From bbbd711507d8b47ac8b4092a0961e3172f20f2d1 Mon Sep 17 00:00:00 2001 From: Markus Sanin Date: Fri, 24 May 2024 10:27:09 +0200 Subject: [PATCH] Remove deprecated code --- ember-can/package.json | 1 - ember-can/src/computed.js | 26 --------------- ember-can/src/services/can.js | 59 ----------------------------------- 3 files changed, 86 deletions(-) delete mode 100644 ember-can/src/computed.js delete mode 100644 ember-can/src/services/can.js diff --git a/ember-can/package.json b/ember-can/package.json index b41fae5..8085732 100644 --- a/ember-can/package.json +++ b/ember-can/package.json @@ -121,7 +121,6 @@ "./helpers/can.js": "./dist/_app_/helpers/can.js", "./helpers/cannot.js": "./dist/_app_/helpers/cannot.js", "./services/abilities.js": "./dist/_app_/services/abilities.js", - "./services/can.js": "./dist/_app_/services/can.js", "./utils/normalize.js": "./dist/_app_/utils/normalize.js" } }, diff --git a/ember-can/src/computed.js b/ember-can/src/computed.js deleted file mode 100644 index 4bd906a..0000000 --- a/ember-can/src/computed.js +++ /dev/null @@ -1,26 +0,0 @@ -import { computed, get } from '@ember/object'; -import { getOwner } from '@ember/application'; -import { deprecate } from '@ember/debug'; - -export function ability(abilityName, resourceName) { - deprecate( - 'Using ability() computed property is deprecated. Use getters and Can service directly.', - false, - { - for: 'ember-can', - since: { - enabled: '4.0.0', - available: '4.0.0', - }, - id: 'ember-can.deprecate-ability-computed', - until: '5.0.0', - }, - ); - - resourceName = resourceName || abilityName; - - return computed(resourceName, function () { - let canService = getOwner(this).lookup('service:abilities'); - return canService.abilityFor(abilityName, get(this, resourceName)); - }).readOnly(); -} diff --git a/ember-can/src/services/can.js b/ember-can/src/services/can.js deleted file mode 100644 index c41d272..0000000 --- a/ember-can/src/services/can.js +++ /dev/null @@ -1,59 +0,0 @@ -import AbilitiesService from './abilities.ts'; -import { deprecate } from '@ember/debug'; - -function deprecateMethod() { - deprecate( - 'Using CanService has been deprecated in favor of AbilitiesService. You should replace all occurrences with new `abilities` service.', - false, - { - id: 'ember-can.can-service', - until: '5.0.0', - for: 'ember-can', - since: { - enabled: '4.1.0', - }, - }, - ); -} - -export default class CanService extends AbilitiesService { - /** - * @deprecated Use new AbilitiesService methods - */ - parse() { - deprecateMethod(); - return super.parse(...arguments); - } - - /** - * @deprecated Use new AbilitiesService methods - */ - abilityFor() { - deprecateMethod(); - return super.abilityFor(...arguments); - } - - /** - * @deprecated Use new AbilitiesService methods - */ - valueFor() { - deprecateMethod(); - return super.valueFor(...arguments); - } - - /** - * @deprecated Use new AbilitiesService methods - */ - can() { - deprecateMethod(); - return super.can(...arguments); - } - - /** - * @deprecated Use new AbilitiesService methods - */ - cannot() { - deprecateMethod(); - return super.cannot(...arguments); - } -}