beetle_reporter 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11171951d3f41267ff60f38549fe8448cba2bbd139f5c2e94a2a811ef59b8b0
|
4
|
+
data.tar.gz: db309e98c5fc8b773341534950a3180373624f79f0237a7e788cd59b5c4ebb53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 190aff907f7d2a7c6c91454661f1005d6a259e51571ec39b0aece2f48f63c9ebf6b417dda9d8b9e87703946a97ec139f48850ecab1e18b9a715a88f81c9e3d5a
|
7
|
+
data.tar.gz: 94416c640937569fa17af54e45cf57636329fcae93ffbaaa7ace994a8602865bd54ece19ab0ed371aff79d4994cc81e371f640c409adb69b76cf9c99882e3bab
|
@@ -69,43 +69,65 @@ module BeetleReporter
|
|
69
69
|
def ignore
|
70
70
|
@report.ignore!
|
71
71
|
|
72
|
-
|
72
|
+
respond_to do |format|
|
73
|
+
format.turbo_stream { render turbo_stream: turbo_stream.remove(dom_id(@report)) }
|
74
|
+
format.html { redirect_to reports_url, notice: 'report was successfully ignored.' }
|
75
|
+
end
|
73
76
|
end
|
74
77
|
|
75
78
|
def suspend
|
76
79
|
@report.suspend!
|
77
80
|
|
78
|
-
|
81
|
+
respond_to do |format|
|
82
|
+
format.turbo_stream { render turbo_stream: turbo_stream.remove(dom_id(@report)) }
|
83
|
+
format.html { redirect_to reports_url, notice: 'report was successfully suspended.' }
|
84
|
+
end
|
79
85
|
end
|
80
86
|
|
81
87
|
def hide
|
82
|
-
@report.beetle_hide(
|
88
|
+
@report.beetle_hide(params[:reason])
|
83
89
|
|
84
|
-
|
90
|
+
respond_to do |format|
|
91
|
+
format.turbo_stream { render turbo_stream: turbo_stream.remove(dom_id(@report)) }
|
92
|
+
format.html { redirect_to reports_url, notice: 'report was successfully hidden.' }
|
93
|
+
end
|
85
94
|
end
|
86
95
|
|
87
96
|
def remove
|
88
|
-
@report.beetle_remove(
|
97
|
+
@report.beetle_remove(params[:reason])
|
89
98
|
|
90
|
-
|
99
|
+
respond_to do |format|
|
100
|
+
format.turbo_stream { render turbo_stream: turbo_stream.remove(dom_id(@report)) }
|
101
|
+
format.html { redirect_to reports_url, notice: 'report was successfully removed.' }
|
102
|
+
end
|
91
103
|
end
|
92
104
|
|
93
105
|
def mute
|
94
|
-
|
106
|
+
# TODO: 禁言时间
|
107
|
+
@report.beetle_mute(params[:reason])
|
95
108
|
|
96
|
-
|
109
|
+
respond_to do |format|
|
110
|
+
format.turbo_stream { render turbo_stream: turbo_stream.remove(dom_id(@report)) }
|
111
|
+
format.html { redirect_to reports_url, notice: 'report was successfully muted.' }
|
112
|
+
end
|
97
113
|
end
|
98
114
|
|
99
115
|
def forbid
|
100
|
-
@report.beetle_forbid(
|
116
|
+
@report.beetle_forbid(params[:reason])
|
101
117
|
|
102
|
-
|
118
|
+
respond_to do |format|
|
119
|
+
format.turbo_stream { render turbo_stream: turbo_stream.remove(dom_id(@report)) }
|
120
|
+
format.html { redirect_to reports_url, notice: 'report was successfully forbiden.' }
|
121
|
+
end
|
103
122
|
end
|
104
123
|
|
105
124
|
def undo
|
106
125
|
@report.undo!
|
107
126
|
|
108
|
-
|
127
|
+
respond_to do |format|
|
128
|
+
format.turbo_stream { render turbo_stream: turbo_stream.remove(dom_id(@report)) }
|
129
|
+
format.html { redirect_to reports_url, notice: 'report was successfully undo.' }
|
130
|
+
end
|
109
131
|
end
|
110
132
|
|
111
133
|
private
|
@@ -3,6 +3,8 @@ module BeetleReporter
|
|
3
3
|
include AASM
|
4
4
|
include Discard::Model
|
5
5
|
|
6
|
+
REASON_TYPES = %w(垃圾广告营销 侮辱谩骂内容 淫秽色情内容 涉政敏感信息 违法有害信息 内容令人不适 内容存在错误)
|
7
|
+
|
6
8
|
belongs_to :record, polymorphic: true, required: false
|
7
9
|
belongs_to :user, class_name: BeetleReporter.config.user_class, optional: true
|
8
10
|
|
@@ -40,18 +40,27 @@
|
|
40
40
|
%div
|
41
41
|
- report.images.each do |img|
|
42
42
|
= image_tag img[:src], class: "w-16 rounded-md"
|
43
|
-
%div{class: "flex space-
|
43
|
+
%div{class: "flex flex-col space-y-2"}
|
44
44
|
- if report.may_ignore?
|
45
|
-
=
|
45
|
+
= button_to "无效举报", report_ignore_path(report), class: "text-yellow-600 cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
|
46
|
+
- if report.may_suspend?
|
47
|
+
= button_to "暂缓处理", report_suspend_path(report), class: "text-indigo-600 cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
|
48
|
+
- if report.may_undo?
|
49
|
+
= button_to "撤销", report_undo_path(report), class: "text-red-600 cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
|
46
50
|
- if report.may_hide?
|
47
|
-
=
|
51
|
+
= form_with(url: report_hide_path(report), class: "space-x-1 flex items-center") do |f|
|
52
|
+
= f.text_field :reason, value: report.reason, placeholder: "隐藏原因是什么?", class: "border rounded-md m py-0.5 px-1"
|
53
|
+
= f.submit "隐藏内容", class: "bg-red-500 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
|
48
54
|
- if report.may_remove?
|
49
|
-
=
|
55
|
+
= form_with(url: report_remove_path(report), class: "space-x-1 flex items-center") do |f|
|
56
|
+
= f.text_field :reason, value: report.reason, placeholder: "删除原因是什么?", class: "border rounded-md m py-0.5 px-1"
|
57
|
+
= f.submit "删除内容", class: "bg-red-600 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
|
50
58
|
- if report.may_mute?
|
51
|
-
=
|
59
|
+
= form_with(url: report_mute_path(report), class: "space-x-1 flex items-center") do |f|
|
60
|
+
-# = f.text_field :mute_days, value: report.mute_days, placeholder: "禁言天数", class: "border rounded-md m py-0.5 px-1"
|
61
|
+
= f.text_field :reason, value: report.reason, placeholder: "禁言原因是什么?", class: "border rounded-md m py-0.5 px-1"
|
62
|
+
= f.submit "禁言用户", class: "bg-red-700 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
|
52
63
|
- if report.may_forbid?
|
53
|
-
=
|
54
|
-
|
55
|
-
|
56
|
-
- if report.may_undo?
|
57
|
-
= link_to "撤销", report_undo_path(report), class: "text-red-600 cursor-pointer"
|
64
|
+
= form_with(url: report_forbid_path(report), class: "space-x-1 flex items-center") do |f|
|
65
|
+
= f.text_field :reason, value: report.reason, placeholder: "封禁原因是什么?", class: "border rounded-md m py-0.5 px-1"
|
66
|
+
= f.submit "封禁用户", class: "bg-red-800 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
|
data/config/routes.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
BeetleReporter::Engine.routes.draw do
|
2
2
|
resources :reports do
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
post :ignore
|
4
|
+
post :undo
|
5
|
+
post :suspend
|
6
|
+
post :hide
|
7
|
+
post :remove
|
8
|
+
post :mute
|
9
|
+
post :forbid
|
10
10
|
end
|
11
11
|
|
12
12
|
root "reports#index"
|