Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5cecdb814 | ||
|
|
7eef353849 | ||
|
|
0dd8f50592 |
@@ -3,7 +3,7 @@
|
||||
This plugin posts updates to issues in your Redmine installation to a Mattermost
|
||||
channel.
|
||||
|
||||
Redmine Supported versions: 2.0.x - 3.1.x (3.2.x is not yet tested but should work).
|
||||
Redmine Supported versions: 2.0.x - 3.2.x.
|
||||
|
||||
## Screenshot
|
||||
|
||||
|
||||
4
init.rb
4
init.rb
@@ -8,9 +8,9 @@ Redmine::Plugin.register :redmine_mattermost do
|
||||
url 'https://github.com/altsol/redmine_mattermost'
|
||||
author_url 'http://altsol.gr'
|
||||
description 'Mattermost chat integration'
|
||||
version '0.1'
|
||||
version '0.2'
|
||||
|
||||
requires_redmine :version_or_higher => '0.8.0'
|
||||
requires_redmine :version_or_higher => '2.0.0'
|
||||
|
||||
settings \
|
||||
:default => {
|
||||
|
||||
@@ -71,15 +71,30 @@ class MattermostListener < Redmine::Hook::Listener
|
||||
|
||||
repository = changeset.repository
|
||||
|
||||
revision_url = Rails.application.routes.url_for(
|
||||
:controller => 'repositories',
|
||||
:action => 'revision',
|
||||
:id => repository.project,
|
||||
:repository_id => repository.identifier_param,
|
||||
:rev => changeset.revision,
|
||||
:host => Setting.host_name,
|
||||
:protocol => Setting.protocol
|
||||
)
|
||||
if Setting.host_name.to_s =~ /\A(https?\:\/\/)?(.+?)(\:(\d+))?(\/.+)?\z/i
|
||||
host, port, prefix = $2, $4, $5
|
||||
revision_url = Rails.application.routes.url_for(
|
||||
:controller => 'repositories',
|
||||
:action => 'revision',
|
||||
:id => repository.project,
|
||||
:repository_id => repository.identifier_param,
|
||||
:rev => changeset.revision,
|
||||
:host => host,
|
||||
:protocol => Setting.protocol,
|
||||
:port => port,
|
||||
:script_name => prefix
|
||||
)
|
||||
else
|
||||
revision_url = Rails.application.routes.url_for(
|
||||
:controller => 'repositories',
|
||||
:action => 'revision',
|
||||
:id => repository.project,
|
||||
:repository_id => repository.identifier_param,
|
||||
:rev => changeset.revision,
|
||||
:host => Setting.host_name,
|
||||
:protocol => Setting.protocol
|
||||
)
|
||||
end
|
||||
|
||||
attachment = {}
|
||||
attachment[:text] = ll(Setting.default_language, :text_status_changed_by_changeset, "<#{revision_url}|#{escape changeset.comments}>")
|
||||
@@ -127,7 +142,12 @@ private
|
||||
end
|
||||
|
||||
def object_url(obj)
|
||||
Rails.application.routes.url_for(obj.event_url({:host => Setting.host_name, :protocol => Setting.protocol}))
|
||||
if Setting.host_name.to_s =~ /\A(https?\:\/\/)?(.+?)(\:(\d+))?(\/.+)?\z/i
|
||||
host, port, prefix = $2, $4, $5
|
||||
Rails.application.routes.url_for(obj.event_url({:host => host, :protocol => Setting.protocol, :port => port, :script_name => prefix}))
|
||||
else
|
||||
Rails.application.routes.url_for(obj.event_url({:host => Setting.host_name, :protocol => Setting.protocol}))
|
||||
end
|
||||
end
|
||||
|
||||
def url_for_project(proj)
|
||||
|
||||
Reference in New Issue
Block a user