Skip to content

Commit 33b4565

Browse files
committedDec 24, 2022
更新:弃用草稿功能
·
v2.7.7v2.1.7
1 parent 3b9c1da commit 33b4565

File tree

10 files changed

+0
-435
lines changed

10 files changed

+0
-435
lines changed
 

‎app/Languages/zh_CN/topic.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
'title' => '帖子标题',
99
'create' => '发帖',
1010
'publish' => "发布",
11-
"draft" => "存为草稿",
1211
"comment" => [
1312
'adoption' => '采纳',
1413
'cancel' => '取消采纳',

‎app/Plugins/Core/bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
Authority()->add("admin_topic_edit","修改所有帖子");
99
Authority()->add("admin_comment_edit","修改所有评论");
1010

11-
Authority()->add("admin_view_draft_topic","预览所有(他人)草稿");
1211
Authority()->add("admin_comment_remove","删除所有(他人)评论");
1312
Authority()->add("comment_remove","删除自己评论");
1413

‎app/Plugins/Core/src/Controller/User/IndexController.php

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -74,49 +74,6 @@ public function user()
7474
return redirect()->url('/users/' . auth()->data()->username . '.html')->go();
7575
}
7676

77-
// 草稿
78-
79-
#[GetMapping('/user/draft')]
80-
public function draft()
81-
{
82-
$page = Topic::query()
83-
->where(['user_id' => auth()->id(), 'status' => 'draft'])
84-
->with('tag', 'user')
85-
->orderBy('topping', 'desc')
86-
->orderBy('id', 'desc')
87-
->paginate((int)get_options('topic_home_num', 15));
88-
89-
return view('User::draft', ['page' => $page]);
90-
}
91-
92-
// 草稿
93-
94-
#[GetMapping('/draft/{id}')]
95-
public function draft_show($id)
96-
{
97-
if (! Topic::query()->where('id', $id)->exists()) {
98-
return admin_abort('页面不存在', 404);
99-
}
100-
$data = Topic::query()
101-
->where('id', $id)
102-
->with('tag', 'user', 'topic_updated')
103-
->first();
104-
$quanxian = false;
105-
if (auth()->id() == $data->user_id) {
106-
$quanxian = true;
107-
}
108-
if (Authority()->check('admin_view_draft_topic')) {
109-
$quanxian = true;
110-
}
111-
if ($quanxian === false) {
112-
return admin_abort('无权预览此草稿', 419);
113-
}
114-
$shang = Topic::query()->where([['id', '<', $id], ['status', 'publish']])->select('title', 'id')->orderBy('id', 'desc')->first();
115-
$xia = Topic::query()->where([['id', '>', $id], ['status', 'publish']])->select('title', 'id')->orderBy('id', 'asc')->first();
116-
$sx = ['shang' => $shang, 'xia' => $xia];
117-
return view('App::topic.show.draft', ['data' => $data, 'get_topic' => $sx]);
118-
}
119-
12077
// 个人通知
12178

12279
#[GetMapping(path: '/user/notice')]

‎app/Plugins/Topic/resources/views/create/vditor.blade.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ class="col-3 col-sm-2 col-md-4 col-lg-3 hvr-glow emoji-picker"
7676
</div>
7777
<div class="mb-3">
7878
<button class="btn btn-primary">{{__("topic.publish")}}</button>
79-
Or
80-
<button type="button" @@click="draft" class="btn btn-danger">
81-
{{__("topic.draft")}}</button>
8279
</div>
8380
</div>
8481
</div>

‎app/Plugins/Topic/src/Controllers/TopicController.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
use App\Plugins\Topic\src\Handler\Topic\CreateTopic;
1414
use App\Plugins\Topic\src\Handler\Topic\CreateTopicView;
15-
use App\Plugins\Topic\src\Handler\Topic\DraftEditTopic;
16-
use App\Plugins\Topic\src\Handler\Topic\DraftTopic;
1715
use App\Plugins\Topic\src\Handler\Topic\EditTopic;
1816
use App\Plugins\Topic\src\Handler\Topic\EditTopicView;
1917
use App\Plugins\Topic\src\Models\Topic;
@@ -69,18 +67,6 @@ public function create_preview()
6967
return view('Topic::create.preview', ['content' => $content]);
7068
}
7169

72-
#[PostMapping(path: 'create/draft')]
73-
#[Middleware(LoginMiddleware::class)]
74-
75-
// 存为草稿
76-
public function draft_post(CreateTopicRequest $request)
77-
{
78-
if (! Authority()->check('topic_create')) {
79-
return Json_Api(419, false, ['无发帖权限']);
80-
}
81-
return (new DraftTopic())->handler($request);
82-
}
83-
8470
#[GetMapping(path: '/topic/{topic_id}/edit')]
8571
public function edit($topic_id)
8672
{
@@ -115,19 +101,4 @@ public function edit_post()
115101
}
116102
return admin_abort('无权限', 419);
117103
}
118-
119-
#[PostMapping(path: '/topic/edit/draft')]
120-
public function edit_draft_post(UpdateTopicRequest $request)
121-
{
122-
$quanxian = false;
123-
if (@Authority()->check('admin_topic_edit') && @curd()->GetUserClass(auth()->data()->class_id)['permission-value'] > curd()->GetUserClass(auth()->data()->class_id)['permission-value']) {
124-
$quanxian = true;
125-
} elseif (Authority()->check('topic_edit') && auth()->id() === auth()->data()->id) {
126-
$quanxian = true;
127-
}
128-
if ($quanxian === true) {
129-
return (new DraftEditTopic())->handler($request);
130-
}
131-
return Json_Api(419, false, ['无权限']);
132-
}
133104
}

‎app/Plugins/Topic/src/Handler/Topic/DraftEditTopic.php

Lines changed: 0 additions & 108 deletions
This file was deleted.

‎app/Plugins/Topic/src/Handler/Topic/DraftTopic.php

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.