mirror of
https://github.com/flarum/framework.git
synced 2024-11-23 21:19:18 +08:00
Generalise the potential for unapproved state to all posts, rather than just comments
This is just more future-proofing, in case any other extensions introduce new post types which can be queued for approval.
This commit is contained in:
parent
9f4e11097d
commit
0bd3c16084
14
extensions/approval/js/forum/dist/extension.js
vendored
14
extensions/approval/js/forum/dist/extension.js
vendored
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
System.register('flarum/approval/main', ['flarum/extend', 'flarum/app', 'flarum/models/Discussion', 'flarum/models/Post', 'flarum/components/Badge', 'flarum/components/DiscussionListItem', 'flarum/components/CommentPost', 'flarum/components/Button', 'flarum/utils/PostControls'], function (_export, _context) {
|
||||
var extend, override, app, Discussion, Post, Badge, DiscussionListItem, CommentPost, Button, PostControls;
|
||||
System.register('flarum/approval/main', ['flarum/extend', 'flarum/app', 'flarum/models/Discussion', 'flarum/models/Post', 'flarum/components/Badge', 'flarum/components/DiscussionListItem', 'flarum/components/Post', 'flarum/components/CommentPost', 'flarum/components/Button', 'flarum/utils/PostControls'], function (_export, _context) {
|
||||
var extend, override, app, Discussion, Post, Badge, DiscussionListItem, PostComponent, CommentPost, Button, PostControls;
|
||||
return {
|
||||
setters: [function (_flarumExtend) {
|
||||
extend = _flarumExtend.extend;
|
||||
|
@ -16,6 +16,8 @@ System.register('flarum/approval/main', ['flarum/extend', 'flarum/app', 'flarum/
|
|||
Badge = _flarumComponentsBadge.default;
|
||||
}, function (_flarumComponentsDiscussionListItem) {
|
||||
DiscussionListItem = _flarumComponentsDiscussionListItem.default;
|
||||
}, function (_flarumComponentsPost) {
|
||||
PostComponent = _flarumComponentsPost.default;
|
||||
}, function (_flarumComponentsCommentPost) {
|
||||
CommentPost = _flarumComponentsCommentPost.default;
|
||||
}, function (_flarumComponentsButton) {
|
||||
|
@ -44,9 +46,9 @@ System.register('flarum/approval/main', ['flarum/extend', 'flarum/app', 'flarum/
|
|||
}
|
||||
});
|
||||
|
||||
extend(CommentPost.prototype, 'attrs', function (attrs) {
|
||||
if (!this.props.post.isApproved() && !this.props.post.isHidden()) {
|
||||
attrs.className += ' CommentPost--unapproved';
|
||||
extend(PostComponent.prototype, 'attrs', function (attrs) {
|
||||
if (!this.props.post.isApproved()) {
|
||||
attrs.className += ' Post--unapproved';
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -56,7 +58,7 @@ System.register('flarum/approval/main', ['flarum/extend', 'flarum/app', 'flarum/
|
|||
}
|
||||
});
|
||||
|
||||
override(CommentPost.prototype, 'flagReason', function (original, flag) {
|
||||
override(PostComponent.prototype, 'flagReason', function (original, flag) {
|
||||
if (flag.type() === 'approval') {
|
||||
return app.translator.trans('flarum-approval.forum.post.awaiting_approval_text');
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import Discussion from 'flarum/models/Discussion';
|
|||
import Post from 'flarum/models/Post';
|
||||
import Badge from 'flarum/components/Badge';
|
||||
import DiscussionListItem from 'flarum/components/DiscussionListItem';
|
||||
import PostComponent from 'flarum/components/Post';
|
||||
import CommentPost from 'flarum/components/CommentPost';
|
||||
import Button from 'flarum/components/Button';
|
||||
import PostControls from 'flarum/utils/PostControls';
|
||||
|
@ -27,9 +28,9 @@ app.initializers.add('flarum-approval', () => {
|
|||
}
|
||||
});
|
||||
|
||||
extend(CommentPost.prototype, 'attrs', function(attrs) {
|
||||
if (!this.props.post.isApproved() && !this.props.post.isHidden()) {
|
||||
attrs.className += ' CommentPost--unapproved';
|
||||
extend(PostComponent.prototype, 'attrs', function(attrs) {
|
||||
if (!this.props.post.isApproved()) {
|
||||
attrs.className += ' Post--unapproved';
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -39,7 +40,7 @@ app.initializers.add('flarum-approval', () => {
|
|||
}
|
||||
});
|
||||
|
||||
override(CommentPost.prototype, 'flagReason', function(original, flag) {
|
||||
override(PostComponent.prototype, 'flagReason', function(original, flag) {
|
||||
if (flag.type() === 'approval') {
|
||||
return app.translator.trans('flarum-approval.forum.post.awaiting_approval_text');
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
.CommentPost--unapproved {
|
||||
.Post--unapproved {
|
||||
.Post-header,
|
||||
.Post-body,
|
||||
.Post-footer {
|
||||
.EventPost-icon,
|
||||
.EventPost-info {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user