Skip to content

Commit

Permalink
更新:弃用草稿功能
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchunshu committed Dec 24, 2022
1 parent 3b9c1da commit 33b4565
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 435 deletions.
1 change: 0 additions & 1 deletion app/Languages/zh_CN/topic.php
Expand Up @@ -8,7 +8,6 @@
'title' => '帖子标题',
'create' => '发帖',
'publish' => "发布",
"draft" => "存为草稿",
"comment" => [
'adoption' => '采纳',
'cancel' => '取消采纳',
Expand Down
1 change: 0 additions & 1 deletion app/Plugins/Core/bootstrap.php
Expand Up @@ -8,7 +8,6 @@
Authority()->add("admin_topic_edit","修改所有帖子");
Authority()->add("admin_comment_edit","修改所有评论");

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

Expand Down
43 changes: 0 additions & 43 deletions app/Plugins/Core/src/Controller/User/IndexController.php
Expand Up @@ -74,49 +74,6 @@ public function user()
return redirect()->url('/users/' . auth()->data()->username . '.html')->go();
}

// 草稿

#[GetMapping('/user/draft')]
public function draft()
{
$page = Topic::query()
->where(['user_id' => auth()->id(), 'status' => 'draft'])
->with('tag', 'user')
->orderBy('topping', 'desc')
->orderBy('id', 'desc')
->paginate((int)get_options('topic_home_num', 15));

return view('User::draft', ['page' => $page]);
}

// 草稿

#[GetMapping('/draft/{id}')]
public function draft_show($id)
{
if (! Topic::query()->where('id', $id)->exists()) {
return admin_abort('页面不存在', 404);
}
$data = Topic::query()
->where('id', $id)
->with('tag', 'user', 'topic_updated')
->first();
$quanxian = false;
if (auth()->id() == $data->user_id) {
$quanxian = true;
}
if (Authority()->check('admin_view_draft_topic')) {
$quanxian = true;
}
if ($quanxian === false) {
return admin_abort('无权预览此草稿', 419);
}
$shang = Topic::query()->where([['id', '<', $id], ['status', 'publish']])->select('title', 'id')->orderBy('id', 'desc')->first();
$xia = Topic::query()->where([['id', '>', $id], ['status', 'publish']])->select('title', 'id')->orderBy('id', 'asc')->first();
$sx = ['shang' => $shang, 'xia' => $xia];
return view('App::topic.show.draft', ['data' => $data, 'get_topic' => $sx]);
}

// 个人通知

#[GetMapping(path: '/user/notice')]
Expand Down
3 changes: 0 additions & 3 deletions app/Plugins/Topic/resources/views/create/vditor.blade.php
Expand Up @@ -76,9 +76,6 @@ class="col-3 col-sm-2 col-md-4 col-lg-3 hvr-glow emoji-picker"
</div>
<div class="mb-3">
<button class="btn btn-primary">{{__("topic.publish")}}</button>
Or
<button type="button" @@click="draft" class="btn btn-danger">
{{__("topic.draft")}}</button>
</div>
</div>
</div>
Expand Down
29 changes: 0 additions & 29 deletions app/Plugins/Topic/src/Controllers/TopicController.php
Expand Up @@ -12,8 +12,6 @@

use App\Plugins\Topic\src\Handler\Topic\CreateTopic;
use App\Plugins\Topic\src\Handler\Topic\CreateTopicView;
use App\Plugins\Topic\src\Handler\Topic\DraftEditTopic;
use App\Plugins\Topic\src\Handler\Topic\DraftTopic;
use App\Plugins\Topic\src\Handler\Topic\EditTopic;
use App\Plugins\Topic\src\Handler\Topic\EditTopicView;
use App\Plugins\Topic\src\Models\Topic;
Expand Down Expand Up @@ -69,18 +67,6 @@ public function create_preview()
return view('Topic::create.preview', ['content' => $content]);
}

#[PostMapping(path: 'create/draft')]
#[Middleware(LoginMiddleware::class)]

// 存为草稿
public function draft_post(CreateTopicRequest $request)
{
if (! Authority()->check('topic_create')) {
return Json_Api(419, false, ['无发帖权限']);
}
return (new DraftTopic())->handler($request);
}

#[GetMapping(path: '/topic/{topic_id}/edit')]
public function edit($topic_id)
{
Expand Down Expand Up @@ -115,19 +101,4 @@ public function edit_post()
}
return admin_abort('无权限', 419);
}

#[PostMapping(path: '/topic/edit/draft')]
public function edit_draft_post(UpdateTopicRequest $request)
{
$quanxian = false;
if (@Authority()->check('admin_topic_edit') && @curd()->GetUserClass(auth()->data()->class_id)['permission-value'] > curd()->GetUserClass(auth()->data()->class_id)['permission-value']) {
$quanxian = true;
} elseif (Authority()->check('topic_edit') && auth()->id() === auth()->data()->id) {
$quanxian = true;
}
if ($quanxian === true) {
return (new DraftEditTopic())->handler($request);
}
return Json_Api(419, false, ['无权限']);
}
}
108 changes: 0 additions & 108 deletions app/Plugins/Topic/src/Handler/Topic/DraftEditTopic.php

This file was deleted.

95 changes: 0 additions & 95 deletions app/Plugins/Topic/src/Handler/Topic/DraftTopic.php

This file was deleted.

0 comments on commit 33b4565

Please sign in to comment.