mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 12:43:52 +08:00
forum: remove 'controls' from user, moderation, and destructive controls in util
This commit is contained in:
parent
717442741f
commit
82ef5f975c
40
js/dist/forum.js
vendored
40
js/dist/forum.js
vendored
|
@ -16014,7 +16014,9 @@ var Discussion = /*#__PURE__*/function (_Model) {
|
|||
;
|
||||
|
||||
_proto.postIds = function postIds() {
|
||||
var posts = this.data.relationships.posts;
|
||||
var _this$data$relationsh;
|
||||
|
||||
var posts = (_this$data$relationsh = this.data.relationships) === null || _this$data$relationsh === void 0 ? void 0 : _this$data$relationsh.posts;
|
||||
return posts ? posts.data.map(function (link) {
|
||||
return link.id;
|
||||
}) : [];
|
||||
|
@ -23981,7 +23983,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
moderation: function moderation(discussion) {
|
||||
moderation: function moderation(discussion, context) {
|
||||
var items = new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
||||
|
||||
if (discussion.canRename()) {
|
||||
|
@ -24003,7 +24005,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
destructive: function destructive(discussion) {
|
||||
destructive: function destructive(discussion, context) {
|
||||
var items = new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
||||
|
||||
if (!discussion.isHidden()) {
|
||||
|
@ -24445,8 +24447,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/**
|
||||
* Get a list of controls for a post.
|
||||
*
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* @param post
|
||||
* @param context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @public
|
||||
*/
|
||||
|
@ -24455,7 +24457,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
var items = new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
||||
['user', 'moderation', 'destructive'].forEach(function (section) {
|
||||
var controls = _this[section + 'Controls'](post, context).toArray();
|
||||
var controls = _this[section](post, context).toArray();
|
||||
|
||||
if (controls.length) {
|
||||
controls.forEach(function (item) {
|
||||
|
@ -24470,24 +24472,24 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/**
|
||||
* Get controls for a post pertaining to the current user (e.g. report).
|
||||
*
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* @param post
|
||||
* @param context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
userControls: function userControls(post, context) {
|
||||
user: function user(post, context) {
|
||||
return new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get controls for a post pertaining to moderation (e.g. edit).
|
||||
*
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* @param post
|
||||
* @param context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
moderationControls: function moderationControls(post, context) {
|
||||
moderation: function moderation(post, context) {
|
||||
var items = new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
||||
|
||||
if (post.contentType() === 'comment' && post.canEdit()) {
|
||||
|
@ -24505,12 +24507,12 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/**
|
||||
* Get controls for a post that are destructive (e.g. delete).
|
||||
*
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* @param post
|
||||
* @param context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
destructiveControls: function destructiveControls(post, context) {
|
||||
destructive: function destructive(post, context) {
|
||||
var items = new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
||||
|
||||
if (post.contentType() === 'comment' && !post.isHidden()) {
|
||||
|
@ -24658,7 +24660,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
var items = new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
||||
['user', 'moderation', 'destructive'].forEach(function (section) {
|
||||
var controls = _this[section + 'Controls'](user, context).toArray();
|
||||
var controls = _this[section](user, context).toArray();
|
||||
|
||||
if (controls.length) {
|
||||
controls.forEach(function (item) {
|
||||
|
@ -24673,14 +24675,14 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/**
|
||||
* Get controls for a user pertaining to the current user (e.g. poke, follow).
|
||||
*/
|
||||
userControls: function userControls() {
|
||||
user: function user() {
|
||||
return new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get controls for a user pertaining to moderation (e.g. suspend, edit).
|
||||
*/
|
||||
moderationControls: function moderationControls(user) {
|
||||
moderation: function moderation(user) {
|
||||
var items = new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
||||
|
||||
if (user.canEdit()) {
|
||||
|
@ -24697,7 +24699,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/**
|
||||
* Get controls for a user which are destructive (e.g. delete).
|
||||
*/
|
||||
destructiveControls: function destructiveControls(user) {
|
||||
destructive: function destructive(user) {
|
||||
var items = new _common_utils_ItemList__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
||||
|
||||
if (user.id() !== '1' && user.canDelete()) {
|
||||
|
|
2
js/dist/forum.js.map
vendored
2
js/dist/forum.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -43,7 +43,7 @@ export default class Discussion extends Model {
|
|||
*
|
||||
* @param id The ID of the post to remove.
|
||||
*/
|
||||
removePost(id: number) {
|
||||
removePost(id: string) {
|
||||
const relationships = this.data.relationships;
|
||||
const posts = relationships && relationships.posts;
|
||||
|
||||
|
@ -88,7 +88,7 @@ export default class Discussion extends Model {
|
|||
* Get a list of all of the post IDs in this discussion.
|
||||
*/
|
||||
postIds(): string[] {
|
||||
const posts = this.data.relationships.posts;
|
||||
const posts = this.data.relationships?.posts;
|
||||
|
||||
return posts ? posts.data.map(link => link.id) : [];
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ export default {
|
|||
* be displayed
|
||||
* @public
|
||||
*/
|
||||
controls(discussion: Discussion, context): ItemList {
|
||||
controls(discussion: Discussion, context: any): ItemList {
|
||||
const items = new ItemList();
|
||||
|
||||
['user', 'moderation', 'destructive'].forEach(section => {
|
||||
|
@ -83,7 +83,7 @@ export default {
|
|||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
moderation(discussion): ItemList {
|
||||
moderation(discussion, context: any): ItemList {
|
||||
const items = new ItemList();
|
||||
|
||||
if (discussion.canRename()) {
|
||||
|
@ -108,7 +108,7 @@ export default {
|
|||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
destructive(discussion: Discussion): ItemList {
|
||||
destructive(discussion: Discussion, context: any): ItemList {
|
||||
const items = new ItemList();
|
||||
|
||||
if (!discussion.isHidden()) {
|
||||
|
|
|
@ -15,16 +15,16 @@ export default {
|
|||
/**
|
||||
* Get a list of controls for a post.
|
||||
*
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* @param post
|
||||
* @param context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @public
|
||||
*/
|
||||
controls(post: Post, context) {
|
||||
controls(post: Post, context: any) {
|
||||
const items = new ItemList();
|
||||
|
||||
['user', 'moderation', 'destructive'].forEach(section => {
|
||||
const controls = this[section + 'Controls'](post, context).toArray();
|
||||
const controls = this[section](post, context).toArray();
|
||||
|
||||
if (controls.length) {
|
||||
controls.forEach(item => items.add(item.itemName, item));
|
||||
|
@ -38,24 +38,24 @@ export default {
|
|||
/**
|
||||
* Get controls for a post pertaining to the current user (e.g. report).
|
||||
*
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* @param post
|
||||
* @param context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
userControls(post: Post, context) {
|
||||
user(post: Post, context: any) {
|
||||
return new ItemList();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get controls for a post pertaining to moderation (e.g. edit).
|
||||
*
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* @param post
|
||||
* @param context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
moderationControls(post: Post, context) {
|
||||
moderation(post: Post, context: any) {
|
||||
const items = new ItemList();
|
||||
|
||||
if (post.contentType() === 'comment' && post.canEdit()) {
|
||||
|
@ -79,12 +79,12 @@ export default {
|
|||
/**
|
||||
* Get controls for a post that are destructive (e.g. delete).
|
||||
*
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* @param post
|
||||
* @param context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @protected
|
||||
*/
|
||||
destructiveControls(post: Post, context) {
|
||||
destructive(post: Post, context: any) {
|
||||
const items = new ItemList();
|
||||
|
||||
if (post.contentType() === 'comment' && !post.isHidden()) {
|
||||
|
|
|
@ -22,7 +22,7 @@ export default {
|
|||
const items = new ItemList();
|
||||
|
||||
['user', 'moderation', 'destructive'].forEach(section => {
|
||||
const controls = this[section + 'Controls'](user, context).toArray();
|
||||
const controls = this[section](user, context).toArray();
|
||||
if (controls.length) {
|
||||
controls.forEach(item => items.add(item.itemName, item));
|
||||
items.add(section + 'Separator', Separator.component());
|
||||
|
@ -35,14 +35,14 @@ export default {
|
|||
/**
|
||||
* Get controls for a user pertaining to the current user (e.g. poke, follow).
|
||||
*/
|
||||
userControls(): ItemList {
|
||||
user(): ItemList {
|
||||
return new ItemList();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get controls for a user pertaining to moderation (e.g. suspend, edit).
|
||||
*/
|
||||
moderationControls(user: User): ItemList {
|
||||
moderation(user: User): ItemList {
|
||||
const items = new ItemList();
|
||||
|
||||
if (user.canEdit()) {
|
||||
|
@ -62,7 +62,7 @@ export default {
|
|||
/**
|
||||
* Get controls for a user which are destructive (e.g. delete).
|
||||
*/
|
||||
destructiveControls(user: User): ItemList {
|
||||
destructive(user: User): ItemList {
|
||||
const items = new ItemList();
|
||||
|
||||
if (user.id() !== '1' && user.canDelete()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user