-define(['Core', 'Language', 'Ui/Notification', './Abstract'], function (Core, Language, UiNotification, UiUserProfileMenuItemAbstract) {
+define(["require", "exports", "tslib", "../../../../../Language", "../../../../Notification", "./Abstract"], function (require, exports, tslib_1, Language, UiNotification, Abstract_1) {
"use strict";
- if (!COMPILER_TARGET_DEFAULT) {
- var Fake = function () { };
- Fake.prototype = {
- _getLabel: function () { },
- _getAjaxActionName: function () { },
- _ajaxSuccess: function () { },
- _ajaxSetup: function () { },
- init: function () { },
- _initButton: function () { },
- _toggle: function () { },
- _updateButton: function () { }
- };
- return Fake;
- }
- function UiUserProfileMenuItemIgnore(userId, isActive) { this.init(userId, isActive); }
- Core.inherit(UiUserProfileMenuItemIgnore, UiUserProfileMenuItemAbstract, {
- _getLabel: function () {
- return Language.get('wcf.user.button.' + (this._isActive ? 'un' : '') + 'ignore');
- },
- _getAjaxActionName: function () {
- return this._isActive ? 'unignore' : 'ignore';
- },
- _ajaxSuccess: function (data) {
- this._isActive = (data.returnValues.isIgnoredUser ? true : false);
+ Language = tslib_1.__importStar(Language);
+ UiNotification = tslib_1.__importStar(UiNotification);
+ Abstract_1 = tslib_1.__importDefault(Abstract_1);
+ class UiUserProfileMenuItemIgnore extends Abstract_1.default {
+ constructor(userId, isActive) {
+ super(userId, isActive);
+ }
+ _getLabel() {
+ return Language.get("wcf.user.button." + (this._isActive ? "un" : "") + "ignore");
+ }
+ _getAjaxActionName() {
+ return this._isActive ? "unignore" : "ignore";
+ }
+ _ajaxSuccess(data) {
+ this._isActive = !!data.returnValues.isIgnoredUser;
this._updateButton();
UiNotification.show();
- },
- _ajaxSetup: function () {
+ }
+ _ajaxSetup() {
return {
data: {
- className: 'wcf\\data\\user\\ignore\\UserIgnoreAction'
- }
+ className: "wcf\\data\\user\\ignore\\UserIgnoreAction",
+ },
};
}
- });
+ }
return UiUserProfileMenuItemIgnore;
});
+++ /dev/null
-define(['Core', 'Language', 'Ui/Notification', './Abstract'], function(Core, Language, UiNotification, UiUserProfileMenuItemAbstract) {
- "use strict";
-
- if (!COMPILER_TARGET_DEFAULT) {
- var Fake = function() {};
- Fake.prototype = {
- _getLabel: function() {},
- _getAjaxActionName: function() {},
- _ajaxSuccess: function() {},
- _ajaxSetup: function() {},
- init: function() {},
- _initButton: function() {},
- _toggle: function() {},
- _updateButton: function() {}
- };
- return Fake;
- }
-
- function UiUserProfileMenuItemIgnore(userId, isActive) { this.init(userId, isActive); }
- Core.inherit(UiUserProfileMenuItemIgnore, UiUserProfileMenuItemAbstract, {
- _getLabel: function() {
- return Language.get('wcf.user.button.' + (this._isActive ? 'un' : '') + 'ignore');
- },
-
- _getAjaxActionName: function() {
- return this._isActive ? 'unignore' : 'ignore';
- },
-
- _ajaxSuccess: function(data) {
- this._isActive = (data.returnValues.isIgnoredUser ? true : false);
- this._updateButton();
-
- UiNotification.show();
- },
-
- _ajaxSetup: function() {
- return {
- data: {
- className: 'wcf\\data\\user\\ignore\\UserIgnoreAction'
- }
- };
- }
- });
-
- return UiUserProfileMenuItemIgnore;
-});
--- /dev/null
+import * as Language from "../../../../../Language";
+import { RequestOptions, ResponseData } from "../../../../../Ajax/Data";
+import * as UiNotification from "../../../../Notification";
+import UiUserProfileMenuItemAbstract from "./Abstract";
+
+interface AjaxResponse extends ResponseData {
+ returnValues: {
+ isIgnoredUser: 1 | 0;
+ };
+}
+
+class UiUserProfileMenuItemIgnore extends UiUserProfileMenuItemAbstract {
+ constructor(userId: number, isActive: boolean) {
+ super(userId, isActive);
+ }
+
+ _getLabel(): string {
+ return Language.get("wcf.user.button." + (this._isActive ? "un" : "") + "ignore");
+ }
+
+ _getAjaxActionName(): string {
+ return this._isActive ? "unignore" : "ignore";
+ }
+
+ _ajaxSuccess(data: AjaxResponse): void {
+ this._isActive = !!data.returnValues.isIgnoredUser;
+ this._updateButton();
+
+ UiNotification.show();
+ }
+
+ _ajaxSetup(): RequestOptions {
+ return {
+ data: {
+ className: "wcf\\data\\user\\ignore\\UserIgnoreAction",
+ },
+ };
+ }
+}
+
+export = UiUserProfileMenuItemIgnore;