-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Remove override and add extend
- Loading branch information
1 parent
1d63139
commit ce01f90
Showing
3 changed files
with
38 additions
and
83 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
lib/extends/commands/decidim/admin/create_attachment_extends.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
require "active_support/concern" | ||
|
||
module CreateAttachmentExtends | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
def notify_followers | ||
return unless @attachment.attached_to.is_a?(Decidim::Followable) | ||
return unless form.send_notification_to_followers | ||
|
||
Decidim::EventsManager.publish( | ||
event: "decidim.events.attachments.attachment_created", | ||
event_class: Decidim::AttachmentCreatedEvent, | ||
resource: @attachment, | ||
followers: @attachment.attached_to.followers, | ||
extra: { force_email: true }, | ||
force_send: true | ||
) | ||
end | ||
end | ||
end | ||
|
||
Decidim::Admin::CreateAttachment.include(CreateAttachmentExtends) |