Feature #13919 » 0001-Demo-for-acts_as_mentionable.patch
| app/models/issue.rb | ||
|---|---|---|
|
acts_as_attachable :after_add => :attachment_added, :after_remove => :attachment_removed
|
||
|
acts_as_customizable
|
||
|
acts_as_watchable
|
||
|
acts_as_mentionable :attributes => ['description']
|
||
|
acts_as_searchable :columns => ['subject', "#{table_name}.description"],
|
||
|
:preload => [:project, :status, :tracker],
|
||
|
:scope => lambda {|options| options[:open_issues] ? self.open : self.all}
|
||
| lib/plugins/acts_as_mentionable/init.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
# Include hook code here
|
||
|
require File.dirname(__FILE__) + '/lib/acts_as_mentionable'
|
||
|
ActiveRecord::Base.send(:include, Redmine::Acts::Mentionable)
|
||
| lib/plugins/acts_as_mentionable/lib/acts_as_mentionable.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
# Redmine - project management software
|
||
|
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
module Redmine
|
||
|
module Acts
|
||
|
module Mentionable
|
||
|
def self.included(base)
|
||
|
base.extend ClassMethods
|
||
|
end
|
||
|
module ClassMethods
|
||
|
def acts_as_mentionable(options = {})
|
||
|
return if self.included_modules.include?(Redmine::Acts::Mentionable::InstanceMethods)
|
||
|
cattr_accessor :mentionable_attributes
|
||
|
self.mentionable_attributes = options[:attributes]
|
||
|
send :include, Redmine::Acts::Mentionable::InstanceMethods
|
||
|
after_save :mentioned_users
|
||
|
end
|
||
|
end
|
||
|
module InstanceMethods
|
||
|
def self.included(base)
|
||
|
base.extend ClassMethods
|
||
|
end
|
||
|
def mentioned_users
|
||
|
puts "****"*50
|
||
|
puts self.saved_changes.inspect
|
||
|
end
|
||
|
module ClassMethods
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||