beetle_reporter 0.1.3 → 0.1.7

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: dd4664c26bd5a899fc6000d4bfc6ff601bbb797621639b3da7a72e120995ec64
4
- data.tar.gz: 1ce9dd17994c831c23cd4950da60e0de5a7968f8216b889054f1efabd7476db8
3
+ metadata.gz: 436169fe4f1466be6f330254612d38b03501873c2d0be73431bcae949b2cccf7
4
+ data.tar.gz: d86fbd6f0b83c33c9b530b7041e63aa2ddca42acb33bb28a6c8548e872ff0f5e
5
5
  SHA512:
6
- metadata.gz: 76f8fccbeac3b4905d74dc29a08cbc8d15aa8d88a74d731f37ed351406b9a00a288612c9e754fe7be5a7f83452baa9901566644e1c6853e740f114161f55327f
7
- data.tar.gz: 44d7d828b78dfd4975c1a913e60f6982618776a84ee297450f2cadeba3e7a0c655ef2b0ff815789257f2a34243aae6e6239c8a308dbd89cb4e4e11fcb7962ad0
6
+ metadata.gz: 7c0799f0682d92a24200d383e2decc8ac3efac75e5706fb568664e00c33aed3a29bcc8a395d924fa8b71a30dea56319a2656e5b65289d2f79d1c301c6af24958
7
+ data.tar.gz: 831c910960df2675b97281322ee00db8e7b40bb89b93258f1d21ff2fcf72364715b33c8d18c5293512d251348b106b0543df166217ae0f5e6f9cb090564262cc
@@ -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
@@ -62,16 +62,7 @@ module BeetleReporter
62
62
  return if record&.user.blank?
63
63
  raise NoMethodError unless record.respond_to?(:beetle_mute)
64
64
 
65
- ret = record.beetle_mute
66
- mute!(reason) if ret
67
- end
68
-
69
- def beetle_mute(reason)
70
- return if record.blank?
71
- return if record&.user.blank?
72
- raise NoMethodError unless record.respond_to?(:beetle_mute)
73
-
74
- ret = record.beetle_mute
65
+ ret = record.beetle_mute(reason)
75
66
  mute!(reason) if ret
76
67
  end
77
68
 
@@ -80,7 +71,7 @@ module BeetleReporter
80
71
  return if record&.user.blank?
81
72
  raise NoMethodError unless record.respond_to?(:beetle_forbid)
82
73
 
83
- ret = record.beetle_forbid
74
+ ret = record.beetle_forbid(reason)
84
75
  forbid!(reason) if ret
85
76
  end
86
77
 
@@ -13,10 +13,11 @@
13
13
  - if report.reason
14
14
  %span{class: "bg-red-100 text-red-600 p-1 rounded-lg"}= "处置原因:#{report.reason}"
15
15
  %span{class: "space-x-1"}
16
- - report.user_ids.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}"
16
+ - users = User.where(id: report.user_ids.compact.uniq)
17
+ - users.each do |user|
18
+ = link_to main_app.send(BeetleReporter.config.main_app_user_path_method.to_sym, user.id), data: {turbo: false} do
19
+ = image_tag avatar(user), size: '24x24', class: "h-5 w-5 rounded-full border"
20
+ %span{class: "w-5 h-5 flex justify-center items-center text-blue-600"}= "+#{report.reported_count}"
20
21
  %span{class: "bg-gray-100 text-gray-600 py-1 px-2 rounded-lg"}
21
22
  = link_to report.created_at, report_path(report), data: {turbo: false}
22
23
  - unless current_user&.admin?
@@ -31,25 +32,31 @@
31
32
  = render report.record_partial_path, record: report.record
32
33
  %div{class: "flex flex-col space-y-2"}
33
34
  - 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"
35
+ = button_to "无效举报", report_ignore_path(report), class: "cursor-pointer px-2 py-0.5 bg-green-700 text-white rounded-lg"
36
+ %span{class: "text-xs text-gray-500"} 用户乱举报的,没有触犯社区规范,点击后不会影响用户内容的可见性。
35
37
  - 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"
38
+ = button_to "暂缓处理", report_suspend_path(report), class: "cursor-pointer px-2 py-0.5 bg-yellow-700 text-white rounded-lg"
39
+ %span{class: "text-xs text-gray-500"} 有争议的内容,拿捏不准的,先搁置,让大家一起来看一看怎么处理。
37
40
  - if report.may_undo?
38
41
  = button_to "撤销", report_undo_path(report), class: "text-red-600 cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
39
42
  - if report.may_hide?
40
43
  = form_with(url: report_hide_path(report), class: "space-x-1 flex items-center") do |f|
41
44
  = f.text_field :reason, value: report.reason, placeholder: "隐藏原因是什么?", class: "border rounded-md m py-0.5 px-1"
42
45
  = f.submit "隐藏内容", class: "bg-red-500 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
46
+ %span{class: "text-xs text-gray-500"} 举报属实,内容不适合公开展示,对其它人隐藏,对创建者可见。
43
47
  - if report.may_remove?
44
48
  = form_with(url: report_remove_path(report), class: "space-x-1 flex items-center") do |f|
45
49
  = f.text_field :reason, value: report.reason, placeholder: "删除原因是什么?", class: "border rounded-md m py-0.5 px-1"
46
50
  = f.submit "删除内容", class: "bg-red-600 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
51
+ %span{class: "text-xs text-gray-500"} 举报属实,不仅不适合展示,也不适合在平台里存在,违法乱纪、破坏和谐气氛的内容,直接删掉。
47
52
  - if report.may_mute?
48
53
  = form_with(url: report_mute_path(report), class: "space-x-1 flex items-center") do |f|
49
54
  -# = f.text_field :mute_days, value: report.mute_days, placeholder: "禁言天数", class: "border rounded-md m py-0.5 px-1"
50
55
  = f.text_field :reason, value: report.reason, placeholder: "禁言原因是什么?", class: "border rounded-md m py-0.5 px-1"
51
56
  = f.submit "禁言用户", class: "bg-red-700 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
57
+ %span{class: "text-xs text-gray-500"} 举报属实,该用户其它内容正常,只有少数几条奇怪的内容,除了删除内容之外也要禁言用户,关小黑屋清醒清醒。
52
58
  - if report.may_forbid?
53
59
  = form_with(url: report_forbid_path(report), class: "space-x-1 flex items-center") do |f|
54
60
  = f.text_field :reason, value: report.reason, placeholder: "封禁原因是什么?", class: "border rounded-md m py-0.5 px-1"
55
61
  = f.submit "封禁用户", class: "bg-red-800 text-white cursor-pointer px-2 py-0.5 bg-gray-100 rounded-lg"
62
+ %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.3'
2
+ VERSION = '0.1.7'
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.3
4
+ version: 0.1.7
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-17 00:00:00.000000000 Z
11
+ date: 2021-12-22 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