beetle_reporter 0.1.5 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8c4ae7fc8b53cb021dece1af970833d533766605f1f8a93fb030186f5354a2a
4
- data.tar.gz: e0ecb462118820163770227a8526c70826db2083fafada52e8f23737fbdb655b
3
+ metadata.gz: 0cb5fc2a8becc1cdd26a861c38be040cb31540897aad4ca5de09b3d2a429f7d0
4
+ data.tar.gz: 15bd9e2db23818bfbf4ea73eaf033b146bc32476253b96cfe44240876b34de7c
5
5
  SHA512:
6
- metadata.gz: b61c8f8abbf0ec9b48ba55495b1d74c1b73b9ecd800a30d56e85e3c0b08155e47ec6bff73e260aad5fac83f09eb1cb46f1555bb52942ccc60c726b477dab70ff
7
- data.tar.gz: 3261b751d9c67649c3abe72d0d8dbfb8a6dd08cb7f75f34f000203cec42b1b337f1af73a9ebc1199837616c6afce8642150f31ed5a6b658b60c0593611d2f73d
6
+ metadata.gz: 477f5b928cd1682592bb7a645d284c51e4542f812fbd0856d56b6019ad233d7de28fd1c5dd066f4f366ac8b7435346a3219aeaa5bba9aba281e610ce710aaad0
7
+ data.tar.gz: d10bcf571be5363d800f3dfc0c1326df3fa7a3983b625523c12b77a6006c61d751a9ade5edc81fb8a9a40c649f986d986e1bdbae984865e91f3f0c9bd10817d2
@@ -5,5 +5,10 @@ module BeetleReporter
5
5
  def current_user
6
6
  main_app.scope.request.env['warden']&.user
7
7
  end
8
+
9
+ def avatar(user)
10
+ return user.avatar unless user.avatar.blank?
11
+ Avatarro.image(user.nickname.first) if user.respond_to?(:nickname)
12
+ end
8
13
  end
9
14
  end
@@ -4,6 +4,15 @@ module BeetleReporter
4
4
  include Discard::Model
5
5
 
6
6
  REASON_TYPES = %w(垃圾广告营销 侮辱谩骂内容 淫秽色情内容 涉政敏感信息 违法有害信息 内容令人不适 内容存在错误)
7
+ PROCESS_REASON_LIST = %w(
8
+ 发布垃圾、无意义内容
9
+ 发布恐吓行为/骚扰内容
10
+ 发布营销广告内容
11
+ 发布谩骂、酸讽、引战内容
12
+ 发布令人不适内容
13
+ 发布淫秽色情内容
14
+ 发布涉政敏感违法有害信息
15
+ )
7
16
 
8
17
  belongs_to :record, polymorphic: true, required: false
9
18
  belongs_to :user, class_name: BeetleReporter.config.user_class, optional: true
@@ -1,3 +1,32 @@
1
+ - content_for :head do
2
+ :javascript
3
+ document.addEventListener("turbo:load", () => {
4
+ const hide_reason_input = document.querySelector('#hide_reason');
5
+ const hide_reason_list = document.querySelector('#hide_reason_list');
6
+ hide_reason_list.addEventListener('change', (event) => {
7
+ hide_reason_input.value = event.target.value;
8
+ })
9
+
10
+ const remove_reason_input = document.querySelector('#remove_reason');
11
+ const remove_reason_list = document.querySelector('#remove_reason_list');
12
+ remove_reason_list.addEventListener('change', (event) => {
13
+ remove_reason_input.value = event.target.value;
14
+ })
15
+
16
+ const mute_reason_input = document.querySelector('#mute_reason');
17
+ const mute_reason_list = document.querySelector('#mute_reason_list');
18
+ mute_reason_list.addEventListener('change', (event) => {
19
+ mute_reason_input.value = event.target.value;
20
+ })
21
+
22
+ const ban_reason_input = document.querySelector('#ban_reason');
23
+ const ban_reason_list = document.querySelector('#ban_reason_list');
24
+ ban_reason_list.addEventListener('change', (event) => {
25
+ ban_reason_input.value = event.target.value;
26
+ })
27
+ });
28
+
29
+
1
30
  = turbo_frame_tag dom_id(report) do
2
31
  %div{class: "flex flex-col space-y-2 border rounded-md p-2 mt-2"}
3
32
  %div{class: "flex justify-between text-xs"}
@@ -12,11 +41,12 @@
12
41
  %span{class: "flex space-x-2 items-center text-sm"}
13
42
  - if report.reason
14
43
  %span{class: "bg-red-100 text-red-600 p-1 rounded-lg"}= "处置原因:#{report.reason}"
15
- %span{class: "space-x-1"}
16
- - report.user_ids.compact.uniq.each do |uid|
17
- = link_to main_app.send(BeetleReporter.config.main_app_user_path_method.to_sym, uid), data: {turbo: false} do
18
- %span{class: "bg-blue-100 rounded-lg px-1 py-0.5"}= "#{uid}"
19
- %span{class: "bg-red-600 text-white rounded-full w-5 h-5 flex justify-center items-center"}= "#{report.reported_count}"
44
+ %span{class: "flex space-x-0.5"}
45
+ - users = User.where(id: report.user_ids.compact.uniq)
46
+ - users.each do |user|
47
+ = link_to main_app.send(BeetleReporter.config.main_app_user_path_method.to_sym, user.id), data: {turbo: false} do
48
+ = image_tag avatar(user), size: '24x24', class: "h-5 w-5 rounded-full border"
49
+ %span{class: "w-5 h-5 flex justify-center items-center text-blue-600"}= "+#{report.reported_count}"
20
50
  %span{class: "bg-gray-100 text-gray-600 py-1 px-2 rounded-lg"}
21
51
  = link_to report.created_at, report_path(report), data: {turbo: false}
22
52
  - unless current_user&.admin?
@@ -31,25 +61,35 @@
31
61
  = render report.record_partial_path, record: report.record
32
62
  %div{class: "flex flex-col space-y-2"}
33
63
  - if report.may_ignore?
34
- = button_to "无效举报", report_ignore_path(report), class: "text-yellow-600 cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
64
+ = button_to "无效举报", report_ignore_path(report), class: "cursor-pointer px-2 py-0.5 bg-green-700 text-white rounded-lg"
65
+ %span{class: "text-xs text-gray-500"} 用户乱举报的,没有触犯社区规范,点击后不会影响用户内容的可见性。
35
66
  - if report.may_suspend?
36
- = button_to "暂缓处理", report_suspend_path(report), class: "text-indigo-600 cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
67
+ = button_to "暂缓处理", report_suspend_path(report), class: "cursor-pointer px-2 py-0.5 bg-yellow-700 text-white rounded-lg"
68
+ %span{class: "text-xs text-gray-500"} 有争议的内容,拿捏不准的,先搁置,让大家一起来看一看怎么处理。
37
69
  - if report.may_undo?
38
70
  = button_to "撤销", report_undo_path(report), class: "text-red-600 cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
39
71
  - if report.may_hide?
40
72
  = form_with(url: report_hide_path(report), class: "space-x-1 flex items-center") do |f|
41
- = f.text_field :reason, value: report.reason, placeholder: "隐藏原因是什么?", class: "border rounded-md m py-0.5 px-1"
73
+ = f.text_field :reason, value: report.reason, placeholder: "隐藏原因是什么?", class: "border rounded-md py-0.5 px-1", id: "hide_reason"
74
+ = select_tag "process_reason", options_for_select(BeetleReporter::Report::PROCESS_REASON_LIST.map{|r| [r, r]}), prompt: "选择原因", id: "hide_reason_list", class: "border rounded-md py-0.5 px-1"
42
75
  = f.submit "隐藏内容", class: "bg-red-500 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
76
+ %span{class: "text-xs text-gray-500"} 举报属实,内容不适合公开展示,对其它人隐藏,对创建者可见。
43
77
  - if report.may_remove?
44
78
  = form_with(url: report_remove_path(report), class: "space-x-1 flex items-center") do |f|
45
- = f.text_field :reason, value: report.reason, placeholder: "删除原因是什么?", class: "border rounded-md m py-0.5 px-1"
79
+ = f.text_field :reason, value: report.reason, placeholder: "删除原因是什么?", class: "border rounded-md py-0.5 px-1", id: "remove_reason"
80
+ = select_tag "process_reason", options_for_select(BeetleReporter::Report::PROCESS_REASON_LIST.map{|r| [r, r]}), prompt: "选择原因", id: "remove_reason_list", class: "border rounded-md py-0.5 px-1"
46
81
  = f.submit "删除内容", class: "bg-red-600 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
82
+ %span{class: "text-xs text-gray-500"} 举报属实,不仅不适合展示,也不适合在平台里存在,违法乱纪、破坏和谐气氛的内容,直接删掉。
47
83
  - if report.may_mute?
48
84
  = form_with(url: report_mute_path(report), class: "space-x-1 flex items-center") do |f|
49
- -# = f.text_field :mute_days, value: report.mute_days, placeholder: "禁言天数", class: "border rounded-md m py-0.5 px-1"
50
- = f.text_field :reason, value: report.reason, placeholder: "禁言原因是什么?", class: "border rounded-md m py-0.5 px-1"
85
+ -# = f.text_field :mute_days, value: report.mute_days, placeholder: "禁言天数", class: "border rounded-md py-0.5 px-1"
86
+ = f.text_field :reason, value: report.reason, placeholder: "禁言原因是什么?", class: "border rounded-md py-0.5 px-1", id: "mute_reason"
87
+ = select_tag "process_reason", options_for_select(BeetleReporter::Report::PROCESS_REASON_LIST.map{|r| [r, r]}), prompt: "选择原因", id: "mute_reason_list", class: "border rounded-md py-0.5 px-1"
51
88
  = f.submit "禁言用户", class: "bg-red-700 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
89
+ %span{class: "text-xs text-gray-500"} 举报属实,该用户其它内容正常,只有少数几条奇怪的内容,除了删除内容之外也要禁言用户,关小黑屋清醒清醒。
52
90
  - if report.may_forbid?
53
91
  = form_with(url: report_forbid_path(report), class: "space-x-1 flex items-center") do |f|
54
- = f.text_field :reason, value: report.reason, placeholder: "封禁原因是什么?", class: "border rounded-md m py-0.5 px-1"
92
+ = f.text_field :reason, value: report.reason, placeholder: "封禁原因是什么?", class: "border rounded-md py-0.5 px-1", id: "ban_reason"
93
+ = select_tag "process_reason", options_for_select(BeetleReporter::Report::PROCESS_REASON_LIST.map{|r| [r, r]}), prompt: "选择原因", id: "ban_reason_list", class: "border rounded-md py-0.5 px-1"
55
94
  = f.submit "封禁用户", class: "bg-red-800 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
95
+ %span{class: "text-xs text-gray-500"} 举报属实,ta就不是正常用户,搞黄色、发广告、违法乱纪的捣乱份子直接永久封禁,并删除其名下所有内容。
@@ -14,7 +14,7 @@
14
14
  %span 举报中心
15
15
 
16
16
  %ul{class: "flex justify-end items-center space-x-2 text-blue-600"}
17
- %li= link_to "待处理(#{BeetleReporter::Report.pending.count})", reports_path
17
+ %li= link_to "待处理(#{BeetleReporter::Report.kept.pending.count})", reports_path
18
18
  %li= link_to "控制台", main_app.send(BeetleReporter.config.main_app_root_path_method.to_sym)
19
19
  %li= current_user.email
20
20
 
@@ -1,3 +1,3 @@
1
1
  module BeetleReporter
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.9'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beetle_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - 42up
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-19 00:00:00.000000000 Z
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '5.6'
111
+ - !ruby/object:Gem::Dependency
112
+ name: avatarro
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.1.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.1.0
111
125
  description: Description of BeetleReporter.
112
126
  email:
113
127
  - foobar@v2up.com