decidim-admin 0.30.0.rc3 → 0.30.0

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: bc29cc3a462ef48acdc919c381daf77729a0812fa6a9b2ec20dc3beb39a2395a
4
- data.tar.gz: 2ff8e7ae1555b59e367e45df699d3a0e6587ab332f9c93ec89142d7b05a736d6
3
+ metadata.gz: b2daba5d2c690b03030a08511196d9ca36ebc870e8358f97d3161182013a42fd
4
+ data.tar.gz: d57c01e2f502d64c2ba1723af733ed39bd181f0a83412efaff63235acf49c248
5
5
  SHA512:
6
- metadata.gz: 785a41246c5611c557618399411934dc97f83199c8b2414ab331c64df9837241f7d5fb4f329b0535e3cd775bb336adcba749c3addabebef4de25549d1e129f3c
7
- data.tar.gz: 6181f1c0a56f33861f544316a1020d2d5a68a348a1f20e32b75ad6eeaac3de39dedff8d3ad1a0fefd626d1c8b04ee5e391eb89875c709d31776dab5783b9ae2b
6
+ metadata.gz: 8472029f6e4609819f6e09fdcca6413e35513c9b8091fe4fb12129137086ad1c67d40728a2bebec6e8fa10186fbfeb3a80e0b102e03639d5669c903a25901fb3
7
+ data.tar.gz: 7ddbe1c2eb351546b2b9d8fa5efdb59ade43f816bc487c728b1f33abb6801ee70095d6fae5d77a1f7e6c0e9b64e812041f5b3c2627328b0bd24d9099e8c018db
@@ -22,6 +22,7 @@ module Decidim
22
22
  #
23
23
  # Returns nothing.
24
24
  def call
25
+ return broadcast(:parent_invalid) if @reportable.respond_to?(:commentable) && @reportable.commentable.try(:hidden?)
25
26
  return broadcast(:invalid) unless unhideable?
26
27
 
27
28
  @with_admin_log ? unhide_with_admin_log! : unhide!
@@ -57,12 +57,17 @@ module Decidim
57
57
  Admin::UnhideResource.call(reportable, current_user) do
58
58
  on(:ok) do
59
59
  flash[:notice] = I18n.t("reportable.unhide.success", scope: "decidim.moderations.admin")
60
- redirect_to moderations_path
60
+ redirect_to moderations_path(hidden: true)
61
+ end
62
+
63
+ on(:parent_invalid) do
64
+ flash[:alert] = I18n.t("reportable.unhide.parent_invalid", scope: "decidim.moderations.admin")
65
+ redirect_to moderations_path(hidden: true)
61
66
  end
62
67
 
63
68
  on(:invalid) do
64
- flash.now[:alert] = I18n.t("reportable.unhide.invalid", scope: "decidim.moderations.admin")
65
- redirect_to moderations_path
69
+ flash[:alert] = I18n.t("reportable.unhide.invalid", scope: "decidim.moderations.admin")
70
+ redirect_to moderations_path(hidden: true)
66
71
  end
67
72
  end
68
73
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ class ParentHiddenEvent < Decidim::ResourceHiddenEvent
5
+ end
6
+ end
@@ -6,6 +6,10 @@ module Decidim
6
6
 
7
7
  i18n_attributes :resource_path, :report_reasons, :resource_type, :resource_content
8
8
 
9
+ def self.types
10
+ [:email]
11
+ end
12
+
9
13
  def resource_path
10
14
  @resource.reported_content_url
11
15
  end
@@ -3,6 +3,8 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  class Permissions < Decidim::DefaultPermissions
6
+ include Decidim::UserRoleChecker
7
+
6
8
  def permissions
7
9
  return permission_action if managed_user_action?
8
10
 
@@ -31,6 +33,8 @@ module Decidim
31
33
 
32
34
  apply_global_moderations_permission_for_admin!
33
35
 
36
+ can_use_image_editor?
37
+
34
38
  if user.admin? && admin_terms_accepted?
35
39
  allow! if read_admin_log_action?
36
40
  allow! if read_user_statistics_action?
@@ -284,6 +288,10 @@ module Decidim
284
288
  def component
285
289
  context.fetch(:component, nil)
286
290
  end
291
+
292
+ def can_use_image_editor?
293
+ allow! if permission_action.subject == :editor_image && user_has_any_role?(user, nil, broad_check: true)
294
+ end
287
295
  end
288
296
  end
289
297
  end
@@ -44,7 +44,11 @@
44
44
  <%= icon_link_to "eye-line", hide_moderation_path(id: moderation), t("actions.hide", scope: "decidim.moderations"), class: "action-icon--hide", method: :put %>
45
45
  <% end %>
46
46
  <% if moderation.reportable.hidden? && allowed_to?(:unhide, authorization_scope) %>
47
- <%= icon_link_to "eye-line", unhide_moderation_path(id: moderation), t("actions.unhide", scope: "decidim.moderations"), method: :put %>
47
+ <% if moderation.reportable.respond_to?(:commentable) && moderation.reportable.commentable.try(:hidden?) %>
48
+ <%= icon_with_tooltip "eye-line", t("actions.parent_hidden", scope: "decidim.moderations"), class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.parent_hidden", scope: "decidim.moderations") %>
49
+ <% else %>
50
+ <%= icon_link_to "eye-line", unhide_moderation_path(id: moderation), t("actions.unhide", scope: "decidim.moderations"), method: :put %>
51
+ <% end %>
48
52
  <% end %>
49
53
  </td>
50
54
  </tr>