Compare commits
267 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e47c55130d | ||
|
|
dadaa32a57 | ||
|
|
67a8faa284 | ||
|
|
36d8261d4a | ||
|
|
385b6f6cef | ||
|
|
fae0efbc7c | ||
|
|
b290a59f5c | ||
|
|
18e3cb6af5 | ||
|
|
2678b5512b | ||
|
|
887d3917bd | ||
|
|
d226072f34 | ||
|
|
6e6378b7e7 | ||
|
|
6713c3749b | ||
|
|
514a6f3cae | ||
|
|
677d99a2cc | ||
|
|
add5f43ebd | ||
|
|
b63773c5ab | ||
|
|
8715f90b8f | ||
|
|
d5658cbb95 | ||
|
|
835e0fc5f9 | ||
|
|
693bedf63c | ||
|
|
6c9351933d | ||
|
|
062f77e4b4 | ||
|
|
5db63a67e2 | ||
|
|
82d5dd2cd0 | ||
|
|
b21ac109f3 | ||
|
|
f6b25521a7 | ||
|
|
3c7b14b3f2 | ||
|
|
568a477431 | ||
|
|
66813ff691 | ||
|
|
60b78f973b | ||
|
|
6c84096c52 | ||
|
|
d78435895a | ||
|
|
efc562b855 | ||
|
|
357148e580 | ||
|
|
9823c578a5 | ||
|
|
d3cdce03d0 | ||
|
|
f7d25d8a28 | ||
|
|
5e7b1813c0 | ||
|
|
4b74808a6f | ||
|
|
16f106712e | ||
|
|
f7d62852d5 | ||
|
|
e7f6de9af2 | ||
|
|
e5d5a94119 | ||
|
|
24095bf9db | ||
|
|
8943040f4d | ||
|
|
c2c8023f14 | ||
|
|
45531d783a | ||
|
|
e7e6539500 | ||
|
|
5623961366 | ||
|
|
3f61d8cde7 | ||
|
|
f843f7ea48 | ||
|
|
cb23763b63 | ||
|
|
61f54fce26 | ||
|
|
6477a02afe | ||
|
|
c9d6028792 | ||
|
|
1c45192653 | ||
|
|
2a59483fca | ||
|
|
1b6c00b4c0 | ||
|
|
49c9f42343 | ||
|
|
4a2d652163 | ||
|
|
f4382f7d86 | ||
|
|
18b0ea1adf | ||
|
|
c58c93005d | ||
|
|
e0e35e6edf | ||
|
|
8702f062fa | ||
|
|
4cdd909889 | ||
|
|
8501a98486 | ||
|
|
b1d7309d97 | ||
|
|
03fab2c28e | ||
|
|
e82efa6180 | ||
|
|
b6afda186e | ||
|
|
25b2694018 | ||
|
|
57f8ef4092 | ||
|
|
f13d5c1e55 | ||
|
|
54de15db0b | ||
|
|
294f435452 | ||
|
|
8519130cee | ||
|
|
39cab0e954 | ||
|
|
0074475a66 | ||
|
|
731e616b7d | ||
|
|
e54c4406e1 | ||
|
|
74e39b918e | ||
|
|
6167b64112 | ||
|
|
f95fd57ab8 | ||
|
|
24a7b99b7f | ||
|
|
73a623c791 | ||
|
|
e25d02a110 | ||
|
|
8398d32c4f | ||
|
|
c3ffdff7d3 | ||
|
|
ba82f825bf | ||
|
|
15dc372bb2 | ||
|
|
dd410756c2 | ||
|
|
3178a6e921 | ||
|
|
f4b62005b4 | ||
|
|
edc63d1ee5 | ||
|
|
fa9127cb24 | ||
|
|
d2ad1fb020 | ||
|
|
48c4b99882 | ||
|
|
e4eee286ba | ||
|
|
ee9347d8fb | ||
|
|
873cbe1021 | ||
|
|
5d037719c7 | ||
|
|
49e847794f | ||
|
|
442c3fb320 | ||
|
|
0b4425399a | ||
|
|
de5cce957c | ||
|
|
31d0ce3748 | ||
|
|
6fa21f3648 | ||
|
|
e71bba934a | ||
|
|
164bc700e1 | ||
|
|
b2e7cca639 | ||
|
|
b0977a54e8 | ||
|
|
43b5ad945a | ||
|
|
8e4bc584d7 | ||
|
|
2563b8007c | ||
|
|
3a9101eda9 | ||
|
|
8b1fad1745 | ||
|
|
d027d77141 | ||
|
|
7cba13f8cd | ||
|
|
9be229f1c4 | ||
|
|
49b282e638 | ||
|
|
0ae4da5e40 | ||
|
|
94a09c0803 | ||
|
|
0e9235875b | ||
|
|
b68d2d9f6f | ||
|
|
543f8ff49b | ||
|
|
96f9e93e31 | ||
|
|
c7a9f0c8da | ||
|
|
bf8d2d3d4d | ||
|
|
c670b5606d | ||
|
|
8c60b1ae0b | ||
|
|
56fa966d92 | ||
|
|
b658906ee6 | ||
|
|
7fd5910d50 | ||
|
|
3df2d55fef | ||
|
|
712fbcd69a | ||
|
|
1d7e53fd9c | ||
|
|
23673170b4 | ||
|
|
2a73c105e6 | ||
|
|
da9102c741 | ||
|
|
8067fd40e8 | ||
|
|
d3e3bbde0f | ||
|
|
58b4a890ca | ||
|
|
94212d2f3d | ||
|
|
c1b8c033d4 | ||
|
|
c7f97afc0c | ||
|
|
4f5868cc57 | ||
|
|
f670a44c66 | ||
|
|
b2780bf618 | ||
|
|
ca62927d19 | ||
|
|
ba65df0ece | ||
|
|
06d1edd5cc | ||
|
|
0c4482b3a5 | ||
|
|
504730e337 | ||
|
|
c0b892e983 | ||
|
|
9454e06766 | ||
|
|
9339ad53b2 | ||
|
|
bb1920f1ce | ||
|
|
ddf87dd2dc | ||
|
|
41a510fbb4 | ||
|
|
91977c8b83 | ||
|
|
4392789a1b | ||
|
|
466c676e40 | ||
|
|
aecc9572c2 | ||
|
|
6ba0ea782a | ||
|
|
183f8dfa00 | ||
|
|
2cdd0c0cce | ||
|
|
0b91d86290 | ||
|
|
0dc906e61d | ||
|
|
835174d831 | ||
|
|
25744d4337 | ||
|
|
585d49bdec | ||
|
|
b1a527fc52 | ||
|
|
f44366bd75 | ||
|
|
7339e9e382 | ||
|
|
4d447f75ab | ||
|
|
593d7055e0 | ||
|
|
c16dec39e4 | ||
|
|
0ee9fa36e6 | ||
|
|
95a914f1ae | ||
|
|
d683f08eef | ||
|
|
1085b042e5 | ||
|
|
454437cbf5 | ||
|
|
a53fd43ef4 | ||
|
|
7a3d335065 | ||
|
|
b2d71d2a0e | ||
|
|
2a1672f024 | ||
|
|
2c3b503f68 | ||
|
|
0427b97a46 | ||
|
|
bbd6a69f8d | ||
|
|
763cf347f6 | ||
|
|
3687fbbe90 | ||
|
|
9a8295247c | ||
|
|
fe8d1fd856 | ||
|
|
53e75212cb | ||
|
|
c98e4fc989 | ||
|
|
18a2856aa2 | ||
|
|
df46bf0f15 | ||
|
|
5d6495f009 | ||
|
|
8162eeb01d | ||
|
|
7e9a994c03 | ||
|
|
2e2e2c4286 | ||
|
|
5882bad2cb | ||
|
|
92f0c40b50 | ||
|
|
a91795a818 | ||
|
|
6295fb3b26 | ||
|
|
a68e3a2fb1 | ||
|
|
b37759d850 | ||
|
|
19f7c9cd05 | ||
|
|
cb8852d95c | ||
|
|
56a3eef324 | ||
|
|
87869706a6 | ||
|
|
22ccab7e72 | ||
|
|
7f1ac1ff38 | ||
|
|
26d2e3978f | ||
|
|
b783970da5 | ||
|
|
5689393e8d | ||
|
|
b03c15586b | ||
|
|
36fb2bb786 | ||
|
|
86ecd0676c | ||
|
|
35798e451c | ||
|
|
19dd1712db | ||
|
|
f1257faf83 | ||
|
|
abbf20b5bd | ||
|
|
4775c2ac49 | ||
|
|
a567405682 | ||
|
|
0672f3808d | ||
|
|
2c0211310b | ||
|
|
b852a33598 | ||
|
|
3116fa6953 | ||
|
|
1a0a087477 | ||
|
|
d8010c6ff0 | ||
|
|
69a4070dcb | ||
|
|
f25dda021e | ||
|
|
28eebbbc80 | ||
|
|
ca69cfd67f | ||
|
|
715ac9f753 | ||
|
|
8551a96ec8 | ||
|
|
31b215ad01 | ||
|
|
cb271d3522 | ||
|
|
6755e9cb94 | ||
|
|
61f4367b6f | ||
|
|
a414136510 | ||
|
|
bdd9c9442e | ||
|
|
cc6a036213 | ||
|
|
bd88f92a66 | ||
|
|
24f9e716b9 | ||
|
|
4881062c3d | ||
|
|
99fde7ebe0 | ||
|
|
bba71e1d06 | ||
|
|
e10b351b88 | ||
|
|
24268e2297 | ||
|
|
5171908a19 | ||
|
|
bc9f5df3fc | ||
|
|
c092d8bfcc | ||
|
|
2a3e52f80f | ||
|
|
f89232d657 | ||
|
|
f467383922 | ||
|
|
dea106ccde | ||
|
|
9d1c844c4c | ||
|
|
42ff187547 | ||
|
|
3271493126 | ||
|
|
e001232b23 | ||
|
|
b3e8f3a6e4 | ||
|
|
4719dec85a | ||
|
|
6a3c5c7694 |
17
.eslintrc.yml
Normal file
17
.eslintrc.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
env:
|
||||
browser: true
|
||||
jquery: true
|
||||
extends: 'eslint:recommended'
|
||||
rules:
|
||||
indent:
|
||||
- error
|
||||
- 2
|
||||
linebreak-style:
|
||||
- error
|
||||
- unix
|
||||
quotes:
|
||||
- error
|
||||
- single
|
||||
semi:
|
||||
- error
|
||||
- always
|
||||
37
.github/workflows/linters.yml
vendored
Normal file
37
.github/workflows/linters.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Run Linters
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '30 5 * * *'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Setup Gemfile
|
||||
run: |
|
||||
touch .enable_dev
|
||||
sed -i "3isource 'https://rubygems.org'" Gemfile
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
bundler-cache: true
|
||||
|
||||
- name: Setup gems
|
||||
run: |
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- name: Run RuboCop
|
||||
run: |
|
||||
bundle exec rubocop -S
|
||||
|
||||
- name: Run Slim-Lint
|
||||
run: |
|
||||
bundle exec slim-lint app/views
|
||||
if: always()
|
||||
121
.github/workflows/tests.yml
vendored
Normal file
121
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
name: Tests
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 5 * * *'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: ${{ matrix.redmine }} ruby-${{ matrix.ruby }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: ['2.7', '2.6', '2.5']
|
||||
redmine: ['4.1-stable', '4.2-stable', 'master']
|
||||
db: ['postgres', 'mysql']
|
||||
exclude:
|
||||
- ruby: '2.7'
|
||||
redmine: 4.1-stable
|
||||
fail-fast: false
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:13
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: 'BestPasswordEver'
|
||||
ports:
|
||||
# will assign a random free host port
|
||||
- 3306/tcp
|
||||
options: >-
|
||||
--health-cmd="mysqladmin ping"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=3
|
||||
|
||||
steps:
|
||||
- name: Verify MySQL connection from host
|
||||
run: |
|
||||
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -pBestPasswordEver -e "SHOW DATABASES"
|
||||
if: matrix.db == 'mysql'
|
||||
|
||||
- name: Checkout Redmine
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: redmine/redmine
|
||||
ref: ${{ matrix.redmine }}
|
||||
path: redmine
|
||||
|
||||
- name: Checkout redmine_messenger
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: AlphaNodes/redmine_messenger
|
||||
path: redmine/plugins/redmine_messenger
|
||||
|
||||
- name: Update package archives
|
||||
run: sudo apt-get update --yes --quiet
|
||||
|
||||
- name: Install package dependencies
|
||||
run: >
|
||||
sudo apt-get install --yes --quiet
|
||||
build-essential
|
||||
cmake
|
||||
libicu-dev
|
||||
libmysqlclient-dev
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||
|
||||
- name: Prepare Redmine source
|
||||
working-directory: redmine
|
||||
run: |
|
||||
cp plugins/redmine_messenger/test/support/database-mysql.yml config/database.yml
|
||||
cp plugins/redmine_messenger/test/support/configuration.yml config/configuration.yml
|
||||
|
||||
- name: Install Ruby dependencies
|
||||
working-directory: redmine
|
||||
run: |
|
||||
bundle config set --local without 'development'
|
||||
bundle install --jobs=4 --retry=3
|
||||
|
||||
- name: Run Redmine rake tasks
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
|
||||
working-directory: redmine
|
||||
run: |
|
||||
bundle exec rake generate_secret_token
|
||||
bundle exec rake db:create db:migrate redmine:plugins:migrate
|
||||
bundle exec rake db:test:prepare
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
|
||||
working-directory: redmine
|
||||
run: bundle exec rake redmine:plugins:test NAME=redmine_messenger RUBYOPT="-W0"
|
||||
|
||||
- name: Run uninstall test
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
|
||||
working-directory: redmine
|
||||
run: bundle exec rake redmine:plugins:migrate NAME=redmine_messenger VERSION=0
|
||||
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
.DS_Store
|
||||
coverage/
|
||||
Gemfile.lock
|
||||
.buildpath
|
||||
.project
|
||||
.settings/
|
||||
docs/_build
|
||||
docs/_static
|
||||
docs/_templates
|
||||
.enable_dev
|
||||
89
.rubocop.yml
Normal file
89
.rubocop.yml
Normal file
@@ -0,0 +1,89 @@
|
||||
require:
|
||||
- rubocop-performance
|
||||
- rubocop-rails
|
||||
|
||||
Rails:
|
||||
Enabled: true
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.5
|
||||
TargetRailsVersion: 5.2
|
||||
NewCops: enable
|
||||
|
||||
Metrics:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ParameterLists:
|
||||
Enabled: true
|
||||
CountKeywordArgs: false
|
||||
|
||||
Layout/LineLength:
|
||||
Max: 140
|
||||
|
||||
Rails/ApplicationJob:
|
||||
Enabled: false
|
||||
|
||||
Rails/ApplicationRecord:
|
||||
Enabled: false
|
||||
|
||||
Rails/CreateTableWithTimestamps:
|
||||
Enabled: false
|
||||
|
||||
Rails/HelperInstanceVariable:
|
||||
Enabled: false
|
||||
|
||||
Rails/SkipsModelValidations:
|
||||
Enabled: false
|
||||
|
||||
Performance/ChainArrayAllocation:
|
||||
Enabled: true
|
||||
|
||||
Style/AutoResourceCleanup:
|
||||
Enabled: true
|
||||
|
||||
Style/ExpandPathArguments:
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- test/**/*
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- '/**/*.rsb'
|
||||
|
||||
Style/OptionHash:
|
||||
Enabled: true
|
||||
SuspiciousParamNames:
|
||||
- options
|
||||
- api_options
|
||||
- opts
|
||||
- args
|
||||
- params
|
||||
- parameters
|
||||
- settings
|
||||
Exclude:
|
||||
- lib/redmine_messenger/patches/*.rb
|
||||
|
||||
Style/ReturnNil:
|
||||
Enabled: true
|
||||
|
||||
Style/UnlessLogicalOperators:
|
||||
Enabled: true
|
||||
|
||||
Style/MethodCallWithArgsParentheses:
|
||||
Enabled: true
|
||||
AllowParenthesesInMultilineCall: true
|
||||
AllowParenthesesInChaining: true
|
||||
EnforcedStyle: omit_parentheses
|
||||
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
Style/HashTransformKeys:
|
||||
Enabled: false
|
||||
|
||||
Style/HashTransformValues:
|
||||
Enabled: false
|
||||
|
||||
Naming/VariableNumber:
|
||||
Enabled: false
|
||||
40
.slim-lint.yml
Normal file
40
.slim-lint.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
linters:
|
||||
LineLength:
|
||||
max: 140
|
||||
RuboCop:
|
||||
ignored_cops:
|
||||
- Layout/ArgumentAlignment
|
||||
- Layout/ArrayAlignment
|
||||
- Layout/BlockEndNewline
|
||||
- Layout/EmptyLineAfterGuardClause
|
||||
- Layout/HashAlignment
|
||||
- Layout/IndentationConsistency
|
||||
- Layout/IndentationWidth
|
||||
- Layout/IndentFirstArgument
|
||||
- Layout/IndentFirstArrayElement
|
||||
- Layout/IndentFirstHashElement
|
||||
- Layout/MultilineArrayBraceLayout
|
||||
- Layout/MultilineAssignmentLayout
|
||||
- Layout/MultilineBlockLayout
|
||||
- Layout/MultilineHashBraceLayout
|
||||
- Layout/MultilineMethodCallBraceLayout
|
||||
- Layout/MultilineMethodCallIndentation
|
||||
- Layout/MultilineMethodDefinitionBraceLayout
|
||||
- Layout/MultilineOperationIndentation
|
||||
- Layout/TrailingBlankLines
|
||||
- Layout/TrailingEmptyLines
|
||||
- Layout/TrailingWhitespace
|
||||
- Lint/BlockAlignment
|
||||
- Lint/EndAlignment
|
||||
- Lint/Void
|
||||
- Metrics/BlockLength
|
||||
- Metrics/BlockNesting
|
||||
- Layout/LineLength
|
||||
- Naming/FileName
|
||||
- Rails/OutputSafety
|
||||
- Style/ConditionalAssignment
|
||||
- Style/FrozenStringLiteralComment
|
||||
- Style/IdenticalConditionalBranches
|
||||
- Style/IfUnlessModifier
|
||||
- Style/Next
|
||||
- Style/WhileUntilModifier
|
||||
163
.stylelintrc.json
Normal file
163
.stylelintrc.json
Normal file
@@ -0,0 +1,163 @@
|
||||
{
|
||||
"rules": {
|
||||
"at-rule-no-unknown": true,
|
||||
"block-no-empty": true,
|
||||
"color-no-invalid-hex": true,
|
||||
"comment-no-empty": true,
|
||||
"declaration-block-no-duplicate-properties": [
|
||||
true,
|
||||
{
|
||||
"ignore": [
|
||||
"consecutive-duplicates-with-different-values"
|
||||
]
|
||||
}
|
||||
],
|
||||
"declaration-block-no-redundant-longhand-properties": true,
|
||||
"declaration-block-no-shorthand-property-overrides": true,
|
||||
"font-family-no-duplicate-names": true,
|
||||
"font-family-no-missing-generic-family-keyword": true,
|
||||
"function-calc-no-unspaced-operator": true,
|
||||
"function-linear-gradient-no-nonstandard-direction": true,
|
||||
"keyframe-declaration-no-important": true,
|
||||
"media-feature-name-no-unknown": true,
|
||||
"no-descending-specificity": true,
|
||||
"no-duplicate-at-import-rules": true,
|
||||
"no-duplicate-selectors": true,
|
||||
"no-empty-source": true,
|
||||
"no-extra-semicolons": true,
|
||||
"no-invalid-double-slash-comments": true,
|
||||
"property-no-unknown": true,
|
||||
"selector-pseudo-class-no-unknown": true,
|
||||
"selector-pseudo-element-no-unknown": true,
|
||||
"selector-type-no-unknown": true,
|
||||
"string-no-newline": true,
|
||||
"unit-no-unknown": true,
|
||||
"at-rule-empty-line-before": [
|
||||
"always",
|
||||
{
|
||||
"except": [
|
||||
"blockless-after-same-name-blockless",
|
||||
"first-nested"
|
||||
],
|
||||
"ignore": [
|
||||
"after-comment"
|
||||
]
|
||||
}
|
||||
],
|
||||
"at-rule-name-case": "lower",
|
||||
"at-rule-name-space-after": "always-single-line",
|
||||
"at-rule-semicolon-newline-after": "always",
|
||||
"block-closing-brace-empty-line-before": "never",
|
||||
"block-closing-brace-newline-after": "always",
|
||||
"block-closing-brace-newline-before": "always-multi-line",
|
||||
"block-closing-brace-space-before": "always-single-line",
|
||||
"block-opening-brace-newline-after": "always-multi-line",
|
||||
"block-opening-brace-space-after": "always-single-line",
|
||||
"block-opening-brace-space-before": "always",
|
||||
"color-hex-case": "lower",
|
||||
"color-hex-length": "short",
|
||||
"comment-empty-line-before": [
|
||||
"always",
|
||||
{
|
||||
"except": [
|
||||
"first-nested"
|
||||
],
|
||||
"ignore": [
|
||||
"stylelint-commands"
|
||||
]
|
||||
}
|
||||
],
|
||||
"comment-whitespace-inside": "always",
|
||||
"custom-property-empty-line-before": [
|
||||
"always",
|
||||
{
|
||||
"except": [
|
||||
"after-custom-property",
|
||||
"first-nested"
|
||||
],
|
||||
"ignore": [
|
||||
"after-comment",
|
||||
"inside-single-line-block"
|
||||
]
|
||||
}
|
||||
],
|
||||
"declaration-bang-space-after": "never",
|
||||
"declaration-bang-space-before": "always",
|
||||
"declaration-block-semicolon-newline-after": "always-multi-line",
|
||||
"declaration-block-semicolon-space-after": "always-single-line",
|
||||
"declaration-block-semicolon-space-before": "never",
|
||||
"declaration-block-single-line-max-declarations": 1,
|
||||
"declaration-block-trailing-semicolon": "always",
|
||||
"declaration-colon-newline-after": "always-multi-line",
|
||||
"declaration-colon-space-after": "always-single-line",
|
||||
"declaration-colon-space-before": "never",
|
||||
"declaration-empty-line-before": [
|
||||
"always",
|
||||
{
|
||||
"except": [
|
||||
"after-declaration",
|
||||
"first-nested"
|
||||
],
|
||||
"ignore": [
|
||||
"after-comment",
|
||||
"inside-single-line-block"
|
||||
]
|
||||
}
|
||||
],
|
||||
"function-comma-newline-after": "always-multi-line",
|
||||
"function-comma-space-after": "always-single-line",
|
||||
"function-comma-space-before": "never",
|
||||
"function-max-empty-lines": 0,
|
||||
"function-name-case": "lower",
|
||||
"function-parentheses-newline-inside": "always-multi-line",
|
||||
"function-parentheses-space-inside": "never-single-line",
|
||||
"function-whitespace-after": "always",
|
||||
"indentation": 2,
|
||||
"length-zero-no-unit": true,
|
||||
"max-empty-lines": 1,
|
||||
"media-feature-colon-space-after": "always",
|
||||
"media-feature-colon-space-before": "never",
|
||||
"media-feature-name-case": "lower",
|
||||
"media-feature-parentheses-space-inside": "never",
|
||||
"media-feature-range-operator-space-after": "always",
|
||||
"media-feature-range-operator-space-before": "always",
|
||||
"media-query-list-comma-newline-after": "always-multi-line",
|
||||
"media-query-list-comma-space-after": "always-single-line",
|
||||
"media-query-list-comma-space-before": "never",
|
||||
"no-eol-whitespace": true,
|
||||
"no-missing-end-of-source-newline": true,
|
||||
"number-leading-zero": "always",
|
||||
"number-no-trailing-zeros": true,
|
||||
"property-case": "lower",
|
||||
"rule-empty-line-before": [
|
||||
"always-multi-line",
|
||||
{
|
||||
"except": [
|
||||
"first-nested"
|
||||
],
|
||||
"ignore": [
|
||||
"after-comment"
|
||||
]
|
||||
}
|
||||
],
|
||||
"selector-attribute-brackets-space-inside": "never",
|
||||
"selector-attribute-operator-space-after": "never",
|
||||
"selector-attribute-operator-space-before": "never",
|
||||
"selector-combinator-space-after": "always",
|
||||
"selector-combinator-space-before": "always",
|
||||
"selector-descendant-combinator-no-non-space": true,
|
||||
"selector-list-comma-newline-after": "always",
|
||||
"selector-list-comma-space-before": "never",
|
||||
"selector-max-empty-lines": 0,
|
||||
"selector-pseudo-class-case": "lower",
|
||||
"selector-pseudo-class-parentheses-space-inside": "never",
|
||||
"selector-pseudo-element-case": "lower",
|
||||
"selector-pseudo-element-colon-notation": "double",
|
||||
"selector-type-case": "lower",
|
||||
"unit-case": "lower",
|
||||
"value-list-comma-newline-after": "always-multi-line",
|
||||
"value-list-comma-space-after": "always-single-line",
|
||||
"value-list-comma-space-before": "never",
|
||||
"value-list-max-empty-lines": 0
|
||||
}
|
||||
}
|
||||
108
CHANGELOG.md
Normal file
108
CHANGELOG.md
Normal file
@@ -0,0 +1,108 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
1.0.9
|
||||
-----
|
||||
|
||||
- Redmine 4.1 is required. Use git tag 1.0.8, if you use an older version.
|
||||
- Redmine 4.2 support
|
||||
- Ruby 2.5 or higher is required
|
||||
|
||||
1.0.8
|
||||
-----
|
||||
|
||||
- Drop testing with travis - we use github actions
|
||||
- Add translation pt-BR - thanks to @lucianocosta
|
||||
|
||||
1.0.7
|
||||
-----
|
||||
|
||||
- Added feature to send messages directly to users to be notified - thanks to @Ujifman
|
||||
|
||||
1.0.6
|
||||
-----
|
||||
|
||||
- Redmine 4 is required. Use git tag 1.0.5, if you use an older version.
|
||||
- Redmine 4.1 support
|
||||
- Fix problems with changed fields, description and notes
|
||||
- Fix problems with quotes #38
|
||||
- Redundant status and priority in messages #56
|
||||
- Show attachments for new issues
|
||||
- Show indicator for private comment on issue
|
||||
- Ruby 2.4 or higher is required
|
||||
- Fix project name with &
|
||||
|
||||
1.0.5
|
||||
-----
|
||||
|
||||
- ruby 2.4.x or newer is required
|
||||
|
||||
1.0.4
|
||||
-----
|
||||
|
||||
- Frensh translation added - thanks to @ZerooCool
|
||||
|
||||
1.0.3
|
||||
-----
|
||||
|
||||
- Redmine 4 support
|
||||
|
||||
1.0.2
|
||||
-----
|
||||
|
||||
- Bug fixed with issue urls, if Redmine is in subdirectory
|
||||
- slim is used as template engine
|
||||
- add private contacts, db and passwords support (if plugins are installed)
|
||||
- Discord support added to documentation
|
||||
|
||||
1.0.1
|
||||
-----
|
||||
|
||||
- Japanese translation has been added - thanks @Yoto
|
||||
- Default mentions has been added - thanks @xstasi
|
||||
|
||||
1.0.0
|
||||
-----
|
||||
|
||||
- Redmine 3.4.x compatibility
|
||||
- Commit message issue bug fix
|
||||
- Some code cleanups
|
||||
|
||||
0.9.9
|
||||
-----
|
||||
|
||||
- All global messenger settings can be overwritten project based
|
||||
- Locale support added
|
||||
- Wiki added supported for notification
|
||||
- Contact added/updated supported for notification (if redmine_contacts is installed)
|
||||
- Password added/updated supported for notification (if redmine_passwords is installed)
|
||||
- DB entry added/updated supported for notification (if redmine_db is installed)
|
||||
- SSL verify can be disabled
|
||||
- Lots of refactoring and code cleanups
|
||||
- Swith from httpclient to net/http
|
||||
- Fork of redmine_rocketchat, redmine_slack and redmine_mattermost (base functions for all three messenger)
|
||||
|
||||
v0.6.1
|
||||
------
|
||||
|
||||
unknown changes
|
||||
|
||||
v0.4
|
||||
----
|
||||
|
||||
unknown changes
|
||||
|
||||
v0.3
|
||||
----
|
||||
|
||||
unknown changes
|
||||
|
||||
v0.2
|
||||
----
|
||||
|
||||
unknown changes
|
||||
|
||||
v0.1
|
||||
----
|
||||
|
||||
unknown changes
|
||||
18
Gemfile
18
Gemfile
@@ -1,3 +1,17 @@
|
||||
source 'https://rubygems.org'
|
||||
# frozen_string_literal: true
|
||||
|
||||
gem "httpclient"
|
||||
gem 'slim-rails'
|
||||
|
||||
group :development do
|
||||
# this is only used for development.
|
||||
# if you want to use it, do:
|
||||
# - create .enable_dev file in additionals directory
|
||||
# - remove rubocop entries from REDMINE/Gemfile
|
||||
# - remove REDMINE/.rubocop* files
|
||||
if File.file? File.expand_path './.enable_dev', __dir__
|
||||
gem 'rubocop', require: false
|
||||
gem 'rubocop-performance', require: false
|
||||
gem 'rubocop-rails', require: false
|
||||
gem 'slim_lint', require: false
|
||||
end
|
||||
end
|
||||
|
||||
1
LICENSE
1
LICENSE
@@ -2,6 +2,7 @@ Released under the MIT license.
|
||||
|
||||
Project redmine-slack is Copyright (c) 2014-2016 by Samuel Cormier-Iijima (https://github.com/sciyoshi/redmine-slack).
|
||||
Fork project redmine_mattermost is Copyright (c) 2015-2016 by AltSol (https://github.com/altsol/redmine_mattermost).
|
||||
Fork project redmine_rocketchat is Copyright (c) 2016-2017 by Phlegx (https://github.com/phlegx/redmine_rocketchat).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
131
README.md
131
README.md
@@ -1,64 +1,121 @@
|
||||
# Mattermost chat plugin for Redmine
|
||||
Messenger plugin for Redmine
|
||||
============================
|
||||
|
||||
This plugin posts updates to issues in your Redmine installation to a Mattermost
|
||||
channel.
|
||||
This plugin posts updates to issues in your Redmine installation to [Slack](https://slack.com/), [Rocket.Chat](https://rocket.chat/), [Discord](https://discordapp.com/) or [Mattermost](https://about.mattermost.com/) channel.
|
||||
|
||||
Redmine Supported versions: 2.0.x - 3.2.x.
|
||||
[](https://www.redmine.org/plugins/redmine_messenger) [](https://github.com/AlphaNodes/redmine_messenger/actions?query=workflow%3A%22Run+Linters%22) [](https://github.com/AlphaNodes/redmine_messenger/actions/workflows/tests.yml)
|
||||
|
||||
## Screenshot
|
||||
Features
|
||||
--------
|
||||
|
||||

|
||||
* Post information to messenger channel
|
||||
* post issue updates
|
||||
* post private issue updates
|
||||
* display watchers
|
||||
* convert username to mentions
|
||||
* post wiki updates
|
||||
* post db entry (if redmine_db is installed) updates
|
||||
* post password (if redmine_passwords is installed) updates
|
||||
* post contact (if redmine_contacts is installed) updates
|
||||
* Post information directly to users to be notified (users names should be the same in Redmine and chat). Tested with Rocket.Chat
|
||||
* overwrite messenger settings at project level
|
||||
* parent project support (inherit messenger settings from parent project)
|
||||
* multiple channel support (define one or more channels to deliver note)
|
||||
|
||||
## Installation
|
||||
Screenshot
|
||||
----------
|
||||
|
||||
From your Redmine plugins directory, clone this repository as `redmine_mattermost` (note
|
||||
the underscore!):
|
||||
Rocket.Chat output:
|
||||
|
||||
git clone https://github.com/altsol/redmine_mattermost.git redmine_mattermost
|
||||

|
||||
|
||||
You will also need the `httpclient` dependency, which can be installed by running
|
||||
Redmine configuration:
|
||||
|
||||
bundle install
|
||||

|
||||
|
||||
from the plugin directory.
|
||||
* **Convert names to mentions:** Automatically converts Redmine mentions into Slack mentions so a user is notified through Slack when mentioned in a Redmine note. Depends on Redmine Mentions plugin.
|
||||
|
||||
Restart Redmine, and you should see the plugin show up in the Plugins page.
|
||||
Under the configuration options, set the Mattermost API URL to the URL for an
|
||||
Incoming WebHook integration in your Mattermost account (see also the next two sections).
|
||||
* **Display watchers:** Issue watchers are included in notifications.
|
||||
|
||||
## Customized Routing
|
||||
* **Post issue updates:** All newly created notes on an issue generate a notification (does not include private issues).
|
||||
|
||||
You can also route messages to different channels on a per-project basis. To
|
||||
do this, create a project custom field (Administration > Custom fields > Project)
|
||||
named `Mattermost Channel`. If no custom channel is defined for a project, the parent
|
||||
project will be checked (or the default will be used). To prevent all notifications
|
||||
from being sent for a project, set the custom channel to `-`.
|
||||
* **Description in new issue:** Include the text description of a new issue in the notification.
|
||||
|
||||
For more information, see http://www.redmine.org/projects/redmine/wiki/Plugins (see also next section for an easy configuration demonstration).
|
||||
* **Description in update issue:** Include the text encompassed in a note upon updating the issue in the notification.
|
||||
|
||||
## Screenshot Guided Configuration
|
||||
* **Post updates for private issue:** Same as *Post issue updates* but for private issues.
|
||||
|
||||
Step 1: Create an Incoming Webhook in Mattermost (Account Settings > Integrations > Incoming Webhooks).
|
||||
* **Post private notes:** Same as *Description in update issue* but for private issues.
|
||||
|
||||

|
||||
* **Post wiki updates:** Generates a notification when a projects Wiki is updated.
|
||||
|
||||
Step 2: Install this Redmine plugin for Mattermost.
|
||||
Prepare your messenger service
|
||||
------------------------------
|
||||
|
||||

|
||||
### Slack
|
||||
|
||||
Step 3: Configure this Redmine plugin for Mattermost. For per-project customized routing, leave the `Mattermost Channel` field empty and follow the next steps, otherwise all Redmine projects will post to the same Mattermost channel. Be careful when filling the channel field, you need to input the channel's handle, not the display name visible to users. You can find each channel's handle by going inside the channel and click the down-arrow and selecting view info.
|
||||
Go to Slack documentation [Incoming Webhooks](https://api.slack.com/incoming-webhooks) for more information to set up Incoming WebHook
|
||||
|
||||

|
||||
### Mattermost
|
||||
|
||||
Step 4: For per-project customized routing, first create the project custom field (Administration > Custom fields > Project).
|
||||
Go to Mattermost documentation [Incoming Webhooks](https://docs.mattermost.com/developer/webhooks-incoming.html) for more information to set up Incoming WebHook
|
||||
|
||||

|
||||

|
||||
### Discord
|
||||
|
||||
Step 5: For per-project customized routing, configure the Mattermost channel handle inside your Redmine project.
|
||||
Go to Discord documentation [Intro to Webhooks ](https://support.discordapp.com/hc/en-us/articles/228383668) for more information to set up Incoming WebHook
|
||||
You have to add /slack after your webhook url.
|
||||
|
||||

|
||||
### Rocket.Chat
|
||||
|
||||
## Credits
|
||||
Go to Rocket.Chat documentation [Incoming WebHook Scripting](https://rocket.chat/docs/administrator-guides/integrations/) for more information to set up Incoming WebHook
|
||||
|
||||
The source code is forked from https://github.com/sciyoshi/redmine-slack. Special thanks to the original author and contributors for making this awesome hook for Redmine. This fork is just refactored to use Mattermost-namespaced configuration options in order to use both hooks (Mattermost and Slack) in a Redmine installation.
|
||||
Requirements
|
||||
------------
|
||||
|
||||
* Redmine version >= 4.1.0
|
||||
* Ruby version >= 2.5.0
|
||||
|
||||
### Older versions
|
||||
|
||||
* If you want to use it with Redmine 3.x, use git tag 1.0.5
|
||||
* If you want to use it with Redmine 4.0, use git tag 1.0.7
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install ``redmine_messenger`` plugin for `Redmine`
|
||||
|
||||
cd $REDMINE_ROOT
|
||||
git clone https://github.com/AlphaNodes/redmine_messenger.git plugins/redmine_messenger
|
||||
bundle update
|
||||
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
|
||||
|
||||
Make sure that the directory is named `redmine_messenger` (you cannot use another name for it)!
|
||||
Restart Redmine (application server) and you should see the plugin show up in the Plugins page.
|
||||
Under the configuration options, set the Messenger API URL to the URL for an
|
||||
Incoming WebHook integration in your Messenger account and also set the Messenger
|
||||
Channel to the channel's handle (be careful, this is not the channel's display name
|
||||
visible to users, you can find each channel's handle by navigating inside the channel
|
||||
and clicking the down-arrow and selecting view info).
|
||||
|
||||
Uninstall
|
||||
---------
|
||||
|
||||
Uninstall ``redmine_messenger``
|
||||
|
||||
cd $REDMINE_ROOT
|
||||
bundle exec rake redmine:plugins:migrate NAME=redmine_messenger VERSION=0 RAILS_ENV=production
|
||||
rm -rf plugins/redmine_messenger
|
||||
|
||||
Restart Redmine (application server)
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
The source code is forked from
|
||||
|
||||
* [redmine_rocketchat](https://github.com/phlegx/redmine_rocketchat)
|
||||
* [redmine_mattermost](https://github.com/altsol/redmine_mattermost)
|
||||
* [redmine-slack](https://github.com/sciyoshi/redmine-slack)
|
||||
|
||||
Special thanks to the original author and contributors for making this awesome hook for Redmine. This fork is just refactored to use Messenger-namespaced configuration options in order to use all hooks for Rocket.Chat, Mattermost AND Slack in a Redmine installation.
|
||||
|
||||
49
app/controllers/messenger_settings_controller.rb
Normal file
49
app/controllers/messenger_settings_controller.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MessengerSettingsController < ApplicationController
|
||||
before_action :find_project_by_project_id
|
||||
before_action :authorize
|
||||
|
||||
def update
|
||||
setting = MessengerSetting.find_or_create @project.id
|
||||
if setting.update allowed_params
|
||||
flash[:notice] = l :notice_successful_update
|
||||
redirect_to settings_project_path(@project, tab: 'messenger')
|
||||
else
|
||||
flash[:error] = setting.errors.full_messages.flatten.join "\n"
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default(settings_project_path(@project, tab: 'messenger')) }
|
||||
format.api { render_validation_errors setting }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def allowed_params
|
||||
params.require(:setting).permit :messenger_url,
|
||||
:messenger_icon,
|
||||
:messenger_channel,
|
||||
:messenger_username,
|
||||
:messenger_verify_ssl,
|
||||
:messenger_direct_users_messages,
|
||||
:auto_mentions,
|
||||
:default_mentions,
|
||||
:display_watchers,
|
||||
:post_updates,
|
||||
:new_include_description,
|
||||
:updated_include_description,
|
||||
:post_private_issues,
|
||||
:post_private_notes,
|
||||
:post_wiki,
|
||||
:post_wiki_updates,
|
||||
:post_db,
|
||||
:post_db_updates,
|
||||
:post_private_db,
|
||||
:post_contact,
|
||||
:post_contact_updates,
|
||||
:post_private_contacts,
|
||||
:post_password,
|
||||
:post_password_updates
|
||||
end
|
||||
end
|
||||
16
app/helpers/messenger_projects_helper.rb
Normal file
16
app/helpers/messenger_projects_helper.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module MessengerProjectsHelper
|
||||
def project_settings_tabs
|
||||
tabs = super
|
||||
|
||||
if User.current.allowed_to? :manage_messenger, @project
|
||||
tabs << { name: 'messenger',
|
||||
action: :show,
|
||||
partial: 'messenger_settings/show',
|
||||
label: :label_messenger }
|
||||
end
|
||||
|
||||
tabs
|
||||
end
|
||||
end
|
||||
307
app/models/messenger.rb
Normal file
307
app/models/messenger.rb
Normal file
@@ -0,0 +1,307 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
|
||||
class Messenger
|
||||
include Redmine::I18n
|
||||
|
||||
class << self
|
||||
def markup_format(text)
|
||||
# TODO: output format should be markdown, but at the moment there is no
|
||||
# solution without using pandoc (http://pandoc.org/), which requires
|
||||
# packages on os level
|
||||
#
|
||||
# Redmine::WikiFormatting.html_parser.to_text(text)
|
||||
|
||||
text = text.to_s.dup
|
||||
|
||||
# @see https://api.slack.com/reference/surfaces/formatting#escaping
|
||||
|
||||
text.gsub! '&', '&'
|
||||
text.gsub! '<', '<'
|
||||
text.gsub! '>', '>'
|
||||
|
||||
text
|
||||
end
|
||||
|
||||
def default_url_options
|
||||
{ only_path: true, script_name: Redmine::Utils.relative_url_root }
|
||||
end
|
||||
|
||||
def speak(msg, channels, url, options)
|
||||
url ||= RedmineMessenger.settings[:messenger_url]
|
||||
return if url.blank? || channels.blank?
|
||||
|
||||
params = { text: msg, link_names: 1 }
|
||||
username = textfield_for_project options[:project], :messenger_username
|
||||
params[:username] = username if username.present?
|
||||
params[:attachments] = options[:attachment]&.any? ? [options[:attachment]] : []
|
||||
icon = textfield_for_project options[:project], :messenger_icon
|
||||
if icon.present?
|
||||
if icon.start_with? ':'
|
||||
params[:icon_emoji] = icon
|
||||
else
|
||||
params[:icon_url] = icon
|
||||
end
|
||||
end
|
||||
|
||||
channels.each do |channel|
|
||||
uri = URI url
|
||||
params[:channel] = channel
|
||||
http_options = { use_ssl: uri.scheme == 'https' }
|
||||
http_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE unless RedmineMessenger.setting? :messenger_verify_ssl
|
||||
begin
|
||||
req = Net::HTTP::Post.new uri
|
||||
req.set_form_data payload: params.to_json
|
||||
Net::HTTP.start uri.hostname, uri.port, http_options do |http|
|
||||
response = http.request req
|
||||
Rails.logger.warn response.inspect unless [Net::HTTPSuccess, Net::HTTPRedirection, Net::HTTPOK].include? response
|
||||
end
|
||||
rescue StandardError => e
|
||||
Rails.logger.warn "cannot connect to #{url}"
|
||||
Rails.logger.warn e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def object_url(obj)
|
||||
if Setting.host_name.to_s =~ %r{\A(https?://)?(.+?)(:(\d+))?(/.+)?\z}i
|
||||
host = Regexp.last_match 2
|
||||
port = Regexp.last_match 4
|
||||
prefix = Regexp.last_match 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, script_name: '')
|
||||
end
|
||||
end
|
||||
|
||||
def url_for_project(proj)
|
||||
return if proj.blank?
|
||||
|
||||
# project based
|
||||
pm = MessengerSetting.find_by project_id: proj.id
|
||||
return pm.messenger_url if !pm.nil? && pm.messenger_url.present?
|
||||
|
||||
# parent project based
|
||||
parent_url = url_for_project proj.parent
|
||||
return parent_url if parent_url.present?
|
||||
# system based
|
||||
return RedmineMessenger.settings[:messenger_url] if RedmineMessenger.settings[:messenger_url].present?
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
def project_url_markdown(project)
|
||||
"[#{project.name}](#{object_url project})"
|
||||
end
|
||||
|
||||
def url_markdown(obj, name)
|
||||
"[#{name}](#{object_url obj})"
|
||||
end
|
||||
|
||||
def textfield_for_project(proj, config)
|
||||
return if proj.blank?
|
||||
|
||||
# project based
|
||||
pm = MessengerSetting.find_by project_id: proj.id
|
||||
return pm.send config if !pm.nil? && pm.send(config).present?
|
||||
|
||||
default_textfield proj, config
|
||||
end
|
||||
|
||||
def default_textfield(proj, config)
|
||||
# parent project based
|
||||
parent_field = textfield_for_project proj.parent, config
|
||||
return parent_field if parent_field.present?
|
||||
return RedmineMessenger.settings[config] if RedmineMessenger.settings[config].present?
|
||||
|
||||
''
|
||||
end
|
||||
|
||||
def channels_for_project(proj)
|
||||
return [] if proj.blank?
|
||||
|
||||
# project based
|
||||
pm = MessengerSetting.find_by project_id: proj.id
|
||||
if !pm.nil? && pm.messenger_channel.present?
|
||||
return [] if pm.messenger_channel == '-'
|
||||
|
||||
return pm.messenger_channel.split(',').map!(&:strip).uniq
|
||||
end
|
||||
default_project_channels proj
|
||||
end
|
||||
|
||||
def setting_for_project(proj, config)
|
||||
return false if proj.blank?
|
||||
|
||||
@setting_found = 0
|
||||
# project based
|
||||
pm = MessengerSetting.find_by project_id: proj.id
|
||||
unless pm.nil? || pm.send(config).zero?
|
||||
@setting_found = 1
|
||||
return false if pm.send(config) == 1
|
||||
return true if pm.send(config) == 2
|
||||
# 0 = use system based settings
|
||||
end
|
||||
default_project_setting proj, config
|
||||
end
|
||||
|
||||
def default_project_setting(proj, config)
|
||||
if proj.present? && proj.parent.present?
|
||||
parent_setting = setting_for_project proj.parent, config
|
||||
return parent_setting if @setting_found == 1
|
||||
end
|
||||
# system based
|
||||
return true if RedmineMessenger.settings[config].present? && RedmineMessenger.setting?(config)
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def attachment_text_from_journal(journal)
|
||||
obj = journal.details.detect { |j| j.prop_key == 'description' && j.property == 'attr' }
|
||||
text = obj.value if obj.present?
|
||||
text.present? ? markup_format(text) : nil
|
||||
end
|
||||
|
||||
def detail_to_field(detail, prj = nil)
|
||||
field_format = nil
|
||||
key = nil
|
||||
escape = true
|
||||
value = detail.value.to_s
|
||||
if detail.property == 'cf'
|
||||
key = CustomField.find(detail.prop_key)&.name
|
||||
unless key.nil?
|
||||
title = key
|
||||
field_format = CustomField.find(detail.prop_key)&.field_format
|
||||
|
||||
value = IssuesController.helpers.format_value detail.value, detail.custom_field if detail.value.present?
|
||||
end
|
||||
elsif detail.property == 'attachment'
|
||||
key = 'attachment'
|
||||
title = I18n.t :label_attachment
|
||||
value = detail.value.to_s
|
||||
elsif detail.property == 'attr' &&
|
||||
detail.prop_key == 'db_relation'
|
||||
return { short: true } unless setting_for_project prj, :post_db
|
||||
|
||||
title = I18n.t :field_db_relation
|
||||
if detail.value.present?
|
||||
entry = DbEntry.visible.find_by id: detail.value
|
||||
value = entry.present? ? entry.name : detail.value.to_s
|
||||
end
|
||||
elsif detail.property == 'attr' &&
|
||||
detail.prop_key == 'password_relation'
|
||||
return { short: true } unless setting_for_project prj, :post_password
|
||||
|
||||
title = I18n.t :field_password_relation
|
||||
if detail.value.present?
|
||||
entry = Password.visible.find_by id: detail.value
|
||||
value = entry.present? ? entry.name : detail.value.to_s
|
||||
end
|
||||
else
|
||||
key = detail.prop_key.to_s.sub '_id', ''
|
||||
title = case key
|
||||
when 'parent'
|
||||
I18n.t "field_#{key}_issue"
|
||||
when 'copied_from'
|
||||
I18n.t "label_#{key}"
|
||||
else
|
||||
I18n.t "field_#{key}"
|
||||
end
|
||||
value = detail.value.to_s
|
||||
end
|
||||
|
||||
short = true
|
||||
case key
|
||||
when 'title', 'subject'
|
||||
short = false
|
||||
when 'description'
|
||||
return
|
||||
when 'tracker'
|
||||
value = object_field_value Tracker, detail.value
|
||||
when 'estimated_hours'
|
||||
value = format_hours(value.is_a?(String) ? (value.to_hours || value) : value)
|
||||
when 'project'
|
||||
value = object_field_value Project, detail.value
|
||||
when 'status'
|
||||
value = object_field_value IssueStatus, detail.value
|
||||
when 'priority'
|
||||
value = object_field_value IssuePriority, detail.value
|
||||
when 'category'
|
||||
value = object_field_value IssueCategory, detail.value
|
||||
when 'assigned_to', 'author'
|
||||
value = object_field_value Principal, detail.value
|
||||
when 'fixed_version'
|
||||
value = object_field_value Version, detail.value
|
||||
when 'attachment'
|
||||
attachment = Attachment.find_by id: detail.prop_key
|
||||
value = if attachment.present?
|
||||
escape = false
|
||||
"<#{object_url attachment}|#{markup_format attachment.filename}>"
|
||||
else
|
||||
detail.prop_key.to_s
|
||||
end
|
||||
|
||||
when 'parent', 'copied_from'
|
||||
issue = Issue.find_by id: detail.value
|
||||
value = if issue.present?
|
||||
escape = false
|
||||
"<#{object_url issue}|#{markup_format issue}>"
|
||||
else
|
||||
detail.value.to_s
|
||||
end
|
||||
end
|
||||
|
||||
value = object_field_value Version, detail.value if detail.property == 'cf' && field_format == 'version'
|
||||
value = if value.present?
|
||||
if escape
|
||||
markup_format value
|
||||
else
|
||||
value
|
||||
end
|
||||
else
|
||||
'-'
|
||||
end
|
||||
|
||||
result = { title: title, value: value }
|
||||
result[:short] = true if short
|
||||
result
|
||||
end
|
||||
|
||||
def mentions(project, text)
|
||||
names = []
|
||||
textfield_for_project(project, :default_mentions).split(',').each { |m| names.push m.strip }
|
||||
names += extract_usernames text unless text.nil?
|
||||
names.present? ? " To: #{names.uniq.join ', '}" : nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def object_field_value(klass, id)
|
||||
obj = klass.find_by id: id
|
||||
obj.nil? ? id.to_s : obj.to_s
|
||||
end
|
||||
|
||||
def extract_usernames(text)
|
||||
return [] if text.blank?
|
||||
|
||||
# messenger usernames may only contain lowercase letters, numbers,
|
||||
# dashes, dots and underscores and must start with a letter or number.
|
||||
text.scan(/@[a-z0-9][a-z0-9_\-.]*/).uniq
|
||||
end
|
||||
|
||||
def default_project_channels(proj)
|
||||
# parent project based
|
||||
parent_channel = channels_for_project proj.parent
|
||||
return parent_channel if parent_channel.present?
|
||||
# system based
|
||||
if RedmineMessenger.settings[:messenger_channel].present? &&
|
||||
RedmineMessenger.settings[:messenger_channel] != '-'
|
||||
return RedmineMessenger.settings[:messenger_channel].split(',').map!(&:strip).uniq
|
||||
end
|
||||
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
18
app/models/messenger_setting.rb
Normal file
18
app/models/messenger_setting.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MessengerSetting < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
|
||||
validates :messenger_url, format: { with: URI::DEFAULT_PARSER.make_regexp(%w[http https]), allow_blank: true }
|
||||
|
||||
def self.find_or_create(p_id)
|
||||
setting = MessengerSetting.find_by project_id: p_id
|
||||
unless setting
|
||||
setting = MessengerSetting.new
|
||||
setting.project_id = p_id
|
||||
setting.save!
|
||||
end
|
||||
|
||||
setting
|
||||
end
|
||||
end
|
||||
7
app/views/messenger_settings/_messenger_select.html.slim
Normal file
7
app/views/messenger_settings/_messenger_select.html.slim
Normal file
@@ -0,0 +1,7 @@
|
||||
p
|
||||
= f.select mf, project_messenger_options(@messenger_setting.send(mf)), label: l("label_settings_#{mf}")
|
||||
'
|
||||
em.info style="display: inline;"
|
||||
= l :label_default
|
||||
' :
|
||||
= project_setting_messenger_default_value mf
|
||||
9
app/views/messenger_settings/_messenger_text.html.slim
Normal file
9
app/views/messenger_settings/_messenger_text.html.slim
Normal file
@@ -0,0 +1,9 @@
|
||||
p
|
||||
= f.text_field mf, size: size, label: l("label_settings_#{mf}")
|
||||
em.info
|
||||
= l :label_messenger_project_text_field_info
|
||||
| (
|
||||
= l :label_default
|
||||
' :
|
||||
= Messenger.default_textfield @project, mf
|
||||
| )
|
||||
78
app/views/messenger_settings/_show.html.slim
Normal file
78
app/views/messenger_settings/_show.html.slim
Normal file
@@ -0,0 +1,78 @@
|
||||
= error_messages_for 'messenger_setting'
|
||||
|
||||
- @messenger_setting = MessengerSetting.find_or_create @project.id
|
||||
= labelled_form_for :setting,
|
||||
@messenger_setting,
|
||||
url: project_messenger_setting_path(project_id: @project),
|
||||
method: :put,
|
||||
class: 'tabular' do |f|
|
||||
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :label_messenger_outgoing_webhook
|
||||
|
||||
- if User.current.admin?
|
||||
.contextual
|
||||
= link_to l(:label_administration), plugin_settings_path(id: 'redmine_messenger'), class: 'icon icon-settings'
|
||||
|
||||
.info = t :messenger_settings_project_intro
|
||||
br
|
||||
p
|
||||
= f.text_field :messenger_url, size: 60, label: l(:label_settings_messenger_url)
|
||||
em.info
|
||||
= l :label_messenger_project_text_field_info
|
||||
| (
|
||||
= l :label_messenger_default_not_visible
|
||||
| )
|
||||
= render partial: 'messenger_settings/messenger_text', locals: { f: f, mf: :messenger_icon, size: 60 }
|
||||
= render partial: 'messenger_settings/messenger_text', locals: { f: f, mf: :messenger_channel, size: 30 }
|
||||
= render partial: 'messenger_settings/messenger_text', locals: { f: f, mf: :messenger_username, size: 30 }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :messenger_verify_ssl }
|
||||
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :label_issue_plural
|
||||
.info = t :messenger_issue_intro
|
||||
br
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :auto_mentions }
|
||||
= render partial: 'messenger_settings/messenger_text', locals: { f: f, mf: :default_mentions, size: 30 }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :display_watchers }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_updates }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :new_include_description }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :updated_include_description }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_private_issues }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_private_notes }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :messenger_direct_users_messages }
|
||||
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :label_wiki
|
||||
.info = t :messenger_wiki_intro
|
||||
br
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_wiki }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_wiki_updates }
|
||||
|
||||
- if RedmineMessenger::REDMINE_DB_SUPPORT && User.current.allowed_to?(:view_db_entries, @project)
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :field_db_entries
|
||||
.info = t :messenger_db_intro
|
||||
br
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_db }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_db_updates }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_private_db }
|
||||
|
||||
- if RedmineMessenger::REDMINE_CONTACTS_SUPPORT && User.current.allowed_to?(:view_contacts, @project)
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :label_contact_plural
|
||||
.info = t :messenger_contacts_intro
|
||||
br
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_contact }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_contact_updates }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_private_contacts }
|
||||
|
||||
- if Redmine::Plugin.installed?('redmine_passwords') && User.current.allowed_to?(:view_passwords, @project)
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :field_passwords
|
||||
.info = t :messenger_passwords_intro
|
||||
br
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_password }
|
||||
= render partial: 'messenger_settings/messenger_select', locals: { f: f, mf: :post_password_updates }
|
||||
|
||||
= submit_tag l(:button_save)
|
||||
@@ -1,42 +0,0 @@
|
||||
<p>
|
||||
<label for="settings_mattermost_url">Mattermost URL</label>
|
||||
<input type="text" id="settings_mattermost_url" size=80 value="<%= settings['mattermost_url'] %>" name="settings[mattermost_url]" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The URL can be changed on a per-project basis by creating a
|
||||
<a href="/custom_fields/new?type=ProjectCustomField">project custom field</a> named "Mattermost URL" (without quotes).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="settings_channel">Mattermost Channel</label>
|
||||
<input type="text" id="settings_channel" value="<%= settings['channel'] %>" name="settings[channel]" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The channel can be changed on a per-project basis by creating a
|
||||
<a href="/custom_fields/new?type=ProjectCustomField">project custom field</a> named "Mattermost Channel" (without quotes).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="settings_icon">Mattermost Icon</label>
|
||||
<input type="text" id="settings_icon" value="<%= settings['icon'] %>" name="settings[icon]" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="settings_username">Mattermost Username</label>
|
||||
<input type="text" id="settings_username" value="<%= settings['username'] %>" name="settings[username]" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="settings_display_watchers">Display Watchers?</label>
|
||||
<select id="settings_display_watchers" value="<%= settings['display_watchers'] %>" name="settings[display_watchers]">
|
||||
<option value="yes">Yes</option>
|
||||
<option value="no" <%= settings['display_watchers'] != 'yes' ? %q(selected="selected") : '' %>>No</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="settings_post_updates">Post Issue Updates?</label>
|
||||
<input type="checkbox" id="settings_post_updates" value="1" name="settings[post_updates]" <%= settings['post_updates'] == '1' ? 'checked="checked"' : '' %> />
|
||||
</p>
|
||||
111
app/views/settings/_messenger_settings.html.slim
Normal file
111
app/views/settings/_messenger_settings.html.slim
Normal file
@@ -0,0 +1,111 @@
|
||||
.info = t :messenger_settings_intro
|
||||
br
|
||||
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :label_messenger_outgoing_webhook
|
||||
p
|
||||
label = l :label_settings_messenger_url
|
||||
= text_field_tag 'settings[messenger_url]', @settings[:messenger_url], size: 60, placeholder: 'https://webhook.url'
|
||||
em.info = t :messenger_url_info_html
|
||||
p
|
||||
label = l :label_settings_messenger_icon
|
||||
= text_field_tag 'settings[messenger_icon]', @settings[:messenger_icon], size: 60
|
||||
p
|
||||
label = l :label_settings_messenger_channel
|
||||
= text_field_tag 'settings[messenger_channel]', @settings[:messenger_channel], size: 30, placeholder: 'redmine'
|
||||
em.info = t :messenger_channel_info_html
|
||||
p
|
||||
label = l :label_settings_messenger_username
|
||||
= text_field_tag 'settings[messenger_username]', @settings[:messenger_username], size: 30
|
||||
p
|
||||
label = l :label_settings_messenger_verify_ssl
|
||||
= check_box_tag 'settings[messenger_verify_ssl]', 1, @settings[:messenger_verify_ssl].to_i == 1
|
||||
em.info = t :messenger_verify_ssl_info_html
|
||||
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :label_issue_plural
|
||||
.info = t :messenger_issue_intro
|
||||
br
|
||||
p
|
||||
label = l :label_settings_auto_mentions
|
||||
= check_box_tag 'settings[auto_mentions]', 1, @settings[:auto_mentions].to_i == 1
|
||||
p
|
||||
label = l :label_settings_default_mentions
|
||||
= text_field_tag 'settings[default_mentions]', @settings[:default_mentions], size: 30
|
||||
em.info = t :default_mentionsl_info
|
||||
p
|
||||
label = l :label_settings_display_watchers
|
||||
= check_box_tag 'settings[display_watchers]', 1, @settings[:display_watchers].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_updates
|
||||
= check_box_tag 'settings[post_updates]', 1, @settings[:post_updates].to_i == 1
|
||||
p
|
||||
label = l :label_settings_new_include_description
|
||||
= check_box_tag 'settings[new_include_description]', 1, @settings[:new_include_description].to_i == 1
|
||||
p
|
||||
label = l :label_settings_updated_include_description
|
||||
= check_box_tag 'settings[updated_include_description]', 1, @settings[:updated_include_description].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_private_issues
|
||||
= check_box_tag 'settings[post_private_issues]', 1, @settings[:post_private_issues].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_private_notes
|
||||
= check_box_tag 'settings[post_private_notes]', 1, @settings[:post_private_notes].to_i == 1
|
||||
|
||||
p
|
||||
label = l :label_settings_messenger_direct_users_messages
|
||||
= check_box_tag 'settings[messenger_direct_users_messages]', 1, @settings[:messenger_direct_users_messages].to_i == 1
|
||||
em.info = t :messenger_direct_users_messages_info_html
|
||||
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :label_wiki
|
||||
.info = t :messenger_wiki_intro
|
||||
br
|
||||
p
|
||||
label = l :label_settings_post_wiki
|
||||
= check_box_tag 'settings[post_wiki]', 1, @settings[:post_wiki].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_wiki_updates
|
||||
= check_box_tag 'settings[post_wiki_updates]', 1, @settings[:post_wiki_updates].to_i == 1
|
||||
|
||||
- if RedmineMessenger::REDMINE_DB_SUPPORT
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :field_db_entries
|
||||
.info = t :messenger_db_intro
|
||||
br
|
||||
p
|
||||
label = l :label_settings_post_db
|
||||
= check_box_tag 'settings[post_db]', 1, @settings[:post_db].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_db_updates
|
||||
= check_box_tag 'settings[post_db_updates]', 1, @settings[:post_db_updates].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_private_db
|
||||
= check_box_tag 'settings[post_private_db]', 1, @settings[:post_private_db].to_i == 1
|
||||
|
||||
- if RedmineMessenger::REDMINE_CONTACTS_SUPPORT
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :label_contact_plural
|
||||
.info = t :messenger_contacts_intro
|
||||
br
|
||||
p
|
||||
label = l :label_settings_post_contact
|
||||
= check_box_tag 'settings[post_contact]', 1, @settings[:post_contact].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_contact_updates
|
||||
= check_box_tag 'settings[post_contact_updates]', 1, @settings[:post_contact_updates].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_private_contacts
|
||||
= check_box_tag 'settings[post_private_contacts]', 1, @settings[:post_private_contacts].to_i == 1
|
||||
|
||||
- if Redmine::Plugin.installed? 'redmine_passwords'
|
||||
fieldset#messenger_settings.box.tabular
|
||||
legend = l :field_passwords
|
||||
.info = t :messenger_passwords_intro
|
||||
br
|
||||
p
|
||||
label = l :label_settings_post_password
|
||||
= check_box_tag 'settings[post_password]', 1, @settings[:post_password].to_i == 1
|
||||
p
|
||||
label = l :label_settings_post_password_updates
|
||||
= check_box_tag 'settings[post_password_updates]', 1, @settings[:post_password_updates].to_i == 1
|
||||
BIN
assets/images/icon.png
Normal file
BIN
assets/images/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
BIN
assets/images/screenshot_mattermost.png
Normal file
BIN
assets/images/screenshot_mattermost.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 87 KiB |
BIN
assets/images/screenshot_redmine_settings.png
Normal file
BIN
assets/images/screenshot_redmine_settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 129 KiB |
BIN
assets/images/screenshot_rocketchat.png
Normal file
BIN
assets/images/screenshot_rocketchat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
1
assets/javascripts/.eslintignore
Normal file
1
assets/javascripts/.eslintignore
Normal file
@@ -0,0 +1 @@
|
||||
# eslint ignore file
|
||||
1
assets/stylesheets/.stylelintignore
Normal file
1
assets/stylesheets/.stylelintignore
Normal file
@@ -0,0 +1 @@
|
||||
# stylelint ignore file
|
||||
55
config/locales/de.yml
Normal file
55
config/locales/de.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
# German strings
|
||||
de:
|
||||
default_mentionsl_info: Benutzer, die immer mit Mentions benachrichtet werden sollen. Mehrere Namen können mit Komma getrennt angegeben werden (z.B. @all, @here).
|
||||
label_messenger_contact_created: "%{project_url} - Kontakt %{url} erstellt von *%{user}*"
|
||||
label_messenger_contact_updated: "%{project_url} - Kontakt %{url} aktualisiert von *%{user}*"
|
||||
label_messenger_db_entry_created: "%{project_url} - DB Eintrag %{url} erstellt von *%{user}*"
|
||||
label_messenger_db_entry_updated: "%{project_url} - DB Eintrag %{url} aktualisiert von *%{user}*"
|
||||
label_messenger_default_not_visible: Standardeinstellung wird aus Sicherheitsgründen nicht angezeigt
|
||||
label_messenger_issue_created: "%{project_url} - Ticket %{url} erstellt von *%{user}*"
|
||||
label_messenger_issue_updated: "%{project_url} - Ticket %{url} aktualisiert von *%{user}*"
|
||||
label_messenger_outgoing_webhook: Ausgehender Webhook
|
||||
label_messenger_password_created: "%{project_url} - Kennwort %{url} erstellt von *%{user}*"
|
||||
label_messenger_password_updated: "%{project_url} - Kennwort %{url} aktualisiert von *%{user}*"
|
||||
label_messenger_project_text_field_info: Leer lassen für Systemstandard.
|
||||
label_messenger_setting: Messenger Einstellung
|
||||
label_messenger_settings_default: Standardeinstellung
|
||||
label_messenger_settings_disabled: Deaktiviert
|
||||
label_messenger_settings_enabled: Aktiviert
|
||||
label_messenger_wiki_created: "%{project_url} - Wiki %{url} erstellt von *%{user}*"
|
||||
label_messenger_wiki_updated: "%{project_url} - Wiki %{url} aktualisiert von *%{user}*"
|
||||
label_messenger: Messenger
|
||||
label_settings_auto_mentions: Namen für Mentions konvertiert?
|
||||
label_settings_default_mentions: Standardbenutzer für Mentions
|
||||
label_settings_display_watchers: Beobachter?
|
||||
label_settings_messenger_channel: Messenger Channel
|
||||
label_settings_messenger_icon: Messenger Icon
|
||||
label_settings_messenger_url: Messenger URL
|
||||
label_settings_messenger_username: Messenger Benutzer
|
||||
label_settings_messenger_verify_ssl: SSL verifiziert
|
||||
label_settings_new_include_description: Neue Ticketeschreibung?
|
||||
label_settings_post_contact_updates: Kontakt Updates?
|
||||
label_settings_post_contact: Neue Kontakte?
|
||||
label_settings_post_db_updates: DB Einträge Updates?
|
||||
label_settings_post_db: Neue DB Einträge?
|
||||
label_settings_post_password_updates: Passwort Updates?
|
||||
label_settings_post_password: Neue Passwörter?
|
||||
label_settings_post_private_contacts: Private Kontakte?
|
||||
label_settings_post_private_db: Private DB Einträge?
|
||||
label_settings_post_private_issues: Private Ticket Updates?
|
||||
label_settings_post_private_notes: Private Notizen?
|
||||
label_settings_post_updates: Ticket Updates?
|
||||
label_settings_post_wiki_updates: Wiki Updates?
|
||||
label_settings_post_wiki: Neue Wikis?
|
||||
label_settings_updated_include_description: Ticket Beschreibungsupdates?
|
||||
messenger_channel_info_html: 'Hier wird der Channel dem die Nachrichten gesendet werden sollen. Es können mehrere Channel angegeben werden, indem Sie mit Komma getrennt werden.'
|
||||
messenger_contacts_intro: Legen Sie fest welche Einträge oder Änderungen für Kontakte im angegebenen Messenger Channel versendet werden.
|
||||
messenger_db_intro: Legen Sie fest welche Einträge oder Änderungen für DB-Einträge im angegebenen Messenger Channel versendet werden.
|
||||
messenger_issue_intro: Legen Sie fest welche Einträge oder Änderungen für Tickets im angegebenen Messenger Channel versendet werden.
|
||||
messenger_passwords_intro: Legen Sie fest welche Einträge oder Änderungen für Passwörter im angegebenen Messenger Channel versendet werden.
|
||||
messenger_settings_intro: Ist die Messenger URL im Adminbereich leer werden keine Nachrichten von Redmine an den Messenger verschickt. Egal welche Angaben sonst hier durchgeführt werden. Ist der globale Versand von Nachrichten für alle Projekte gewünscht, trägt man hier die URL ein. Für alle Projekte werden dann in den entsprechenden Channel Nachrichten versendet. Will man jedoch nur für bestimmte Projekte etwas schicken lässt man die URL hier leer. Die entsprechenden Einstellungen müssen dann in den jeweiligen Projekten in der Projektkonfiguration durchgeführt werden.
|
||||
messenger_settings_project_intro: Wurde die Messenger URL im Administrationsbereich leer gelassen weil man Änderungen nur für bestimmte Projekte an den Messenger schicken will, trägt man in der jeweiligen Projektkonfiguration die Messenger URL ein.
|
||||
messenger_url_info_html: 'Generiere eine <a target="_blank" href="https://github.com/AlphaNodes/redmine_messenger#prepare-your-messenger-service">Incoming WebHook</a> URL vom Messenger Service. Um nur aus bestimmten Projekten Nachrichten zu versenden, kann diese URL leer bleiben und in den Projekteinstellungen gesetzt werden.'
|
||||
messenger_verify_ssl_info_html: 'Falls der Messenger Service ein ungültiges oder selbst erstelltes (self-signed) SSL Zertifikat verwendet bitte deaktivieren.'
|
||||
messenger_wiki_intro: Legen Sie fest welche Einträge oder Änderungen für Wikis im angegebenen Messenger Channel versendet werden.
|
||||
permission_manage_messenger: Messenger verwalten
|
||||
57
config/locales/en.yml
Normal file
57
config/locales/en.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
# English strings
|
||||
en:
|
||||
default_mentionsl_info: Default people to notify, comma separated (e.g. @all, @here)
|
||||
label_messenger_contact_created: "%{project_url} - Contact %{url} created by *%{user}*"
|
||||
label_messenger_contact_updated: "%{project_url} - Contact %{url} updated by *%{user}*"
|
||||
label_messenger_db_entry_created: "%{project_url} - DB entry %{url} created by *%{user}*"
|
||||
label_messenger_db_entry_updated: "%{project_url} - DB entry %{url} updated by *%{user}*"
|
||||
label_messenger_default_not_visible: Default setting is not visible for security reasons
|
||||
label_messenger_issue_created: "%{project_url} - Issue %{url} created by *%{user}*"
|
||||
label_messenger_issue_updated: "%{project_url} - Issue %{url} updated by *%{user}*"
|
||||
label_messenger_outgoing_webhook: Outgoing Webhook
|
||||
label_messenger_password_created: "%{project_url} - Password %{url} created by *%{user}*"
|
||||
label_messenger_password_updated: "%{project_url} - Password %{url} updated by *%{user}*"
|
||||
label_messenger_project_text_field_info: Leave it blank for system default.
|
||||
label_messenger_setting: Messenger Settings
|
||||
label_messenger_settings_default: System default
|
||||
label_messenger_settings_disabled: Disabled
|
||||
label_messenger_settings_enabled: Enabled
|
||||
label_messenger_wiki_created: "%{project_url} - Wiki %{url} created by *%{user}*"
|
||||
label_messenger_wiki_updated: "%{project_url} - Wiki %{url} updated by *%{user}*"
|
||||
label_messenger: Messenger
|
||||
label_settings_auto_mentions: Convert names to mentions?
|
||||
label_settings_default_mentions: Default people for mentions
|
||||
label_settings_display_watchers: Display watchers?
|
||||
label_settings_messenger_channel: Messenger Channel
|
||||
label_settings_messenger_icon: Messenger Icon
|
||||
label_settings_messenger_url: Messenger URL
|
||||
label_settings_messenger_username: Messenger username
|
||||
label_settings_messenger_verify_ssl: Verify SSL
|
||||
label_settings_messenger_direct_users_messages: Send direct messages
|
||||
label_settings_new_include_description: New issue description?
|
||||
label_settings_post_contact_updates: Contact updates?
|
||||
label_settings_post_contact: Contact added?
|
||||
label_settings_post_db_updates: DB entry updates?
|
||||
label_settings_post_db: DB entry added?
|
||||
label_settings_post_password_updates: Password updates?
|
||||
label_settings_post_password: Password added?
|
||||
label_settings_post_private_contacts: Private contacts?
|
||||
label_settings_post_private_db: Private DB entries?
|
||||
label_settings_post_private_issues: Private issue updates?
|
||||
label_settings_post_private_notes: Private notes updates?
|
||||
label_settings_post_updates: Issue updates?
|
||||
label_settings_post_wiki_updates: Wiki updates?
|
||||
label_settings_post_wiki: Post Wiki added?
|
||||
label_settings_updated_include_description: Description in update issue?
|
||||
messenger_channel_info_html: 'Here you have to specify the channel, which should be used. You can define multible channels, seperated by comma'
|
||||
messenger_contacts_intro: Activate the changes for Issues that should be sent to the pre-defined Messenger channel.
|
||||
messenger_db_intro: Activate the changes for DB that should be sent to the pre-defined Messenger channel.
|
||||
messenger_issue_intro: Activate the changes for Issues that should be sent to the pre-defined Messenger channel.
|
||||
messenger_passwords_intro: Activate the changes for Passwords that should be sent to the pre-defined Messenger channel.
|
||||
messenger_settings_intro: "Leave the Messenger URL in the administration area empty in order to send no messages from Redmine to the Messenger. No matter what else you have configured here. In case you wish to send messages of all Redmine projects to the Messenger fill out the URL. The messages will be sent to the specific channel. If you want only to be notified by some of the projects (not all) leave the messenger URL here blank and go to the specific project configuration."
|
||||
messenger_settings_project_intro: "If you left empty the Messenger URL in the administration area in case to be not globally notified by all project changes you can configure your Messenger URL in the project settings."
|
||||
messenger_url_info_html: 'Generate an <a target="_blank" href="https://github.com/AlphaNodes/redmine_messenger#prepare-your-messenger-service">Incoming WebHook</a> URL from the messenger service. Leave it empty, if you only want to activate specific projects with project based settings'
|
||||
messenger_verify_ssl_info_html: 'If your Messenger service uses an invalid or self-signed SSL certificate, disable it.'
|
||||
messenger_direct_users_messages_info_html: 'If enabled Messenger will post http requests to each user as channel(direct message in RocketChat) along with post in channel'
|
||||
messenger_wiki_intro: Activate the changes for Wikis that should be sent to the pre-defined Messenger channel.
|
||||
permission_manage_messenger: Manage messenger
|
||||
55
config/locales/fr.yml
Normal file
55
config/locales/fr.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
# French strings
|
||||
fr:
|
||||
default_mentionsl_info: Personnes à notifier par défaut, séparées par des virgules (@all, @here)
|
||||
label_messenger_contact_created: "%{project_url} - Le contact %{url} créé par *%{user}*"
|
||||
label_messenger_contact_updated: "%{project_url} - Le contact %{url} mis à jour par *%{user}*"
|
||||
label_messenger_db_entry_created: "%{project_url} - Entrée de base de données %{url} créée par *%{user}*"
|
||||
label_messenger_db_entry_updated: "%{project_url} - Entrée de base de données %{url} mis à jour par *%{user}*"
|
||||
label_messenger_default_not_visible: Le paramètre par défaut n'est pas visible pour des raisons de sécurité
|
||||
label_messenger_issue_created: "%{project_url} - Ticket %{url} créé par *%{user}*"
|
||||
label_messenger_issue_updated: "%{project_url} - Ticket %{url} mis à jour par *%{user}*"
|
||||
label_messenger_outgoing_webhook: Webhook sortant
|
||||
label_messenger_password_created: "%{project_url} - Mot de passe %{url} créé par *%{user}*"
|
||||
label_messenger_password_updated: "%{project_url} - Mot de passe %{url} mis à jour par *%{user}*"
|
||||
label_messenger_project_text_field_info: Laissez ce champ vide pour le système par défaut.
|
||||
label_messenger_setting: Paramètres de messagerie
|
||||
label_messenger_settings_default: Choix de l'option
|
||||
label_messenger_settings_disabled: Désactivé
|
||||
label_messenger_settings_enabled: Activé
|
||||
label_messenger_wiki_created: "%{project_url} - Wiki %{url} créé par *%{user}*"
|
||||
label_messenger_wiki_updated: "%{project_url} - Wiki %{url} mis à jour par *%{user}*"
|
||||
label_messenger: Messenger
|
||||
label_settings_auto_mentions: Convertir les noms en mentions
|
||||
label_settings_default_mentions: Personnes mentionnées par défaut
|
||||
label_settings_display_watchers: Afficher l'utilisateur assigné au ticket
|
||||
label_settings_messenger_channel: Nom du salon
|
||||
label_settings_messenger_icon: Icône affiché
|
||||
label_settings_messenger_url: URL WebHook entrant
|
||||
label_settings_messenger_username: Nom du robot
|
||||
label_settings_messenger_verify_ssl: Vérifier SSL
|
||||
label_settings_new_include_description: Inclure la description des nouveaux tickets
|
||||
label_settings_post_contact_updates: Mises à jour de contact ?
|
||||
label_settings_post_contact: Contact ajouté ?
|
||||
label_settings_post_db_updates: Mises à jour des entrées de base de données ?
|
||||
label_settings_post_db: Entrée de base de données ajoutée ?
|
||||
label_settings_post_password_updates: Mises à jour du mot de passe ?
|
||||
label_settings_post_password: Mot de passe ajouté ?
|
||||
label_settings_post_private_contacts: Contacts privés ?
|
||||
label_settings_post_private_db: Entrées de base de données privées ?
|
||||
label_settings_post_private_issues: Inclure les mises à jour des tickets privés
|
||||
label_settings_post_private_notes: Inclure les mises à jour des notes privées
|
||||
label_settings_post_updates: Inclure toutes les mises à jour
|
||||
label_settings_post_wiki_updates: Inclure les mises à jour du wiki
|
||||
label_settings_post_wiki: Inclure les publications du wiki
|
||||
label_settings_updated_include_description: Inclure la description suite à une mise à jour
|
||||
messenger_channel_info_html: 'Spécifier le canal à utiliser. Vous pouvez définir plusieurs canaux, séparés par une virgule.'
|
||||
messenger_contacts_intro: Activer les modifications pour les contacts à envoyer au canal Messenger prédéfini.
|
||||
messenger_db_intro: Activer les modifications pour la base de données à envoyer au canal Messenger prédéfini.
|
||||
messenger_issue_intro: Activer les modifications pour les tickets à envoyer au canal Messenger prédéfini.
|
||||
messenger_passwords_intro: Activez les modifications pour les mots de passe devant être envoyés au canal Messenger prédéfini.
|
||||
messenger_settings_intro: "Laisser l'URL de Messenger dans la zone d'administration vide pour ne pas envoyer de messages de Redmine à Messenger. Peu importe ce que vous avez configuré ici. Si vous souhaitez envoyer des messages de tous les projets Redmine à Messenger, renseignez l’URL. Les messages seront envoyés au canal spécifique. Si vous souhaitez uniquement être averti par certains des projets (pas tous), laissez l'URL du messager ici vide et accédez à la configuration du projet spécifique."
|
||||
messenger_settings_project_intro: "Si vous laissez vide l'URL de Messenger dans la zone d'administration au cas où vous ne seriez pas averti globalement de toutes les modifications apportées au projet, vous pouvez configurer votre URL Messenger dans les paramètres du projet."
|
||||
messenger_url_info_html: 'Générer une adresse <a target="_blank" href="https://github.com/AlphaNodes/redmine_messenger#prepare-your-messenger-service">Incoming WebHook</a> pour le service global de Messenger. Laisser ce champ vide pour activer uniquement des projets spécifiques avec des paramètres personnalisés pour chaque projet.'
|
||||
messenger_verify_ssl_info_html: 'Désactiver cette vérification si votre service Messenger utilise un certificat SSL non valide ou auto-signé.'
|
||||
messenger_wiki_intro: Activer les notifications a envoyer au canal Messenger pour l'ensemble des wikis.
|
||||
permission_manage_messenger: Gérer Messenger
|
||||
55
config/locales/ja.yml
Normal file
55
config/locales/ja.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
# Japanese strings
|
||||
ja:
|
||||
default_mentionsl_info: Default people to notify, comma separated (e.g. @all, @here)
|
||||
label_messenger_contact_created: "%{project_url} - コンタクト %{url} が *%{user}* によって作成されました。"
|
||||
label_messenger_contact_updated: "%{project_url} - コンタクト %{url} が*%{user}* によって更新されました。"
|
||||
label_messenger_db_entry_created: "%{project_url} - DB entry %{url} created by *%{user}*"
|
||||
label_messenger_db_entry_updated: "%{project_url} - DB entry %{url} updated by *%{user}*"
|
||||
label_messenger_default_not_visible: デフォルトの設定はセキュリティ上の理由により表示されません。
|
||||
label_messenger_issue_created: "%{project_url} - チケット %{url} が *%{user}* によって作成されました。"
|
||||
label_messenger_issue_updated: "%{project_url} - チケット %{url} が *%{user}* によって更新されました。"
|
||||
label_messenger_outgoing_webhook: Outgoing Webhook
|
||||
label_messenger_password_created: "%{project_url} - Password %{url} created by *%{user}*"
|
||||
label_messenger_password_updated: "%{project_url} - Password %{url} updated by *%{user}*"
|
||||
label_messenger_project_text_field_info: デフォルトの設定を使う場合空欄にしてください。
|
||||
label_messenger_setting: メッセンジャーの設定
|
||||
label_messenger_settings_default: デフォルト
|
||||
label_messenger_settings_disabled: 無効
|
||||
label_messenger_settings_enabled: 有効
|
||||
label_messenger_wiki_created: "%{project_url} - Wiki %{url} が by *%{user}* によって作成されました。"
|
||||
label_messenger_wiki_updated: "%{project_url} - Wiki %{url} が *%{user}* によって更新されました。"
|
||||
label_messenger: メッセンジャー
|
||||
label_settings_auto_mentions: ユーザー名をその人についての投稿(@ユーザー名)に変換する
|
||||
label_settings_default_mentions: Default people for mentions
|
||||
label_settings_display_watchers: ウォッチャーを表示する
|
||||
label_settings_messenger_channel: メッセンジャーのチャンネル
|
||||
label_settings_messenger_icon: メッセンジャーのアイコン
|
||||
label_settings_messenger_url: メッセンジャーのURL
|
||||
label_settings_messenger_username: メッセンジャーのユーザー名
|
||||
label_settings_messenger_verify_ssl: SSL証明書の検証
|
||||
label_settings_new_include_description: チケット作成時に説明を含める
|
||||
label_settings_post_contact_updates: コンタクトの更新
|
||||
label_settings_post_contact: コンタクトの作成
|
||||
label_settings_post_db_updates: DB entry updates?
|
||||
label_settings_post_db: DB entry added?
|
||||
label_settings_post_password_updates: Password updates?
|
||||
label_settings_post_password: Password added?
|
||||
label_settings_post_private_contacts: Private contacts?
|
||||
label_settings_post_private_db: Private DB entries?
|
||||
label_settings_post_private_issues: プライベートチケットの更新
|
||||
label_settings_post_private_notes: プライベート注記の更新
|
||||
label_settings_post_updates: チケットの更新
|
||||
label_settings_post_wiki_updates: Wikiの更新
|
||||
label_settings_post_wiki: Wikiの作成
|
||||
label_settings_updated_include_description: チケット更新時に説明を含める
|
||||
messenger_channel_info_html: チャンネルを指定する必要があります。複数のチャンネルを指定する場合は,(カンマ)で区切って下さい。
|
||||
messenger_contacts_intro: メッセンジャーに送信するチケットのイベントにチェックを入れて下さい。
|
||||
messenger_db_intro: Activate the changes for DB that should be sent to the pre-defined Messenger channel.
|
||||
messenger_issue_intro: メッセンジャーに送信するチケットのイベントにチェックを入れて下さい。
|
||||
messenger_passwords_intro: Activate the changes for Passwords that should be sent to the pre-defined Messenger channel.
|
||||
messenger_settings_intro: 管理画面でメッセンジャーのURLを指定した場合、全てのプロジェクトのデフォルトの送信先になります。プロジェクト毎の送信先を設定する場合はプロジェクトの設定画面で設定して下さい。
|
||||
messenger_settings_project_intro: メッセンジャーのURLを指定しない場合、管理者が指定したチャンネルにメッセージが送信されます。(管理者がチャンネルを指定していない場合は、空欄にすると機能は無効になります)
|
||||
messenger_url_info_html: 'メッセンジャー サービスで <a target="_blank" href="https://github.com/AlphaNodes/redmine_messenger#prepare-your-messenger-service">内向きのウェブフック</a>のURLを作成して下さい。プロジェクト毎に設定を変えたい場合は空欄として下さい。'
|
||||
messenger_verify_ssl_info_html: 'メッセンジャー サービスが自己署名証明書や不正な証明書を使っている場合、無効として下さい。'
|
||||
messenger_wiki_intro: メッセンジャーに送信するWikiのイベントにチェックを入れて下さい。
|
||||
permission_manage_messenger: メッセンジャーの管理
|
||||
55
config/locales/ko.yml
Normal file
55
config/locales/ko.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
# Korean strings
|
||||
ko:
|
||||
default_mentionsl_info: 알림을 받을 기본 사용자를 나타내며, 쉼표로 구분 (e.g. @all, @here)
|
||||
label_messenger_contact_created: "%{project_url} - *%{user}*님이 연락처(%{url})를 만들었습니다."
|
||||
label_messenger_contact_updated: "%{project_url} - *%{user}*님이 연락처(%{url})를 수정했습니다."
|
||||
label_messenger_db_entry_created: "%{project_url} - *%{user}*님이 데이터베이스 항목(%{url})을 만들었습니다."
|
||||
label_messenger_db_entry_updated: "%{project_url} - *%{user}*님이 데이터베이스 항목(%{url})을 수정했습니다."
|
||||
label_messenger_default_not_visible: 보안 상의 이유로 기본값이 보여지지 않습니다.
|
||||
label_messenger_issue_created: "%{project_url} - *%{user}*님이 일감(%{url})을 만들었습니다."
|
||||
label_messenger_issue_updated: "%{project_url} - *%{user}*님이 일감(%{url})을 수정했습니다."
|
||||
label_messenger_outgoing_webhook: 웹훅 발신
|
||||
label_messenger_password_created: "%{project_url} - *%{user}*님이 암호(%{url})를 만들었습니다."
|
||||
label_messenger_password_updated: "%{project_url} - *%{user}*님이 암호(%{url})를 수정했습니다."
|
||||
label_messenger_project_text_field_info: 시스템 기본값을 사용하려면 빈 값으로 두세요.
|
||||
label_messenger_setting: 메신저 설정
|
||||
label_messenger_settings_default: 시스템 기본값
|
||||
label_messenger_settings_disabled: 비활성화
|
||||
label_messenger_settings_enabled: 활성화
|
||||
label_messenger_wiki_created: "%{project_url} - *%{user}*님이 위키(%{url})를 만들었습니다."
|
||||
label_messenger_wiki_updated: "%{project_url} - *%{user}*님이 위키(%{url})를 수정했습니다."
|
||||
label_messenger: 메신저
|
||||
label_settings_auto_mentions: 이름을 멘션으로 변환
|
||||
label_settings_default_mentions: 멘션될 기본 사용자
|
||||
label_settings_display_watchers: 지켜보는 사용자들을 보여줌
|
||||
label_settings_messenger_channel: 메신저 채널
|
||||
label_settings_messenger_icon: 메신저 아이콘
|
||||
label_settings_messenger_url: 메신저 URL
|
||||
label_settings_messenger_username: 메신저 사용자 이름
|
||||
label_settings_messenger_verify_ssl: SSL
|
||||
label_settings_new_include_description: 새로운 이슈의 설명을 포함
|
||||
label_settings_post_contact_updates: 연락처 수정
|
||||
label_settings_post_contact: 연락처 추가
|
||||
label_settings_post_db_updates: 데이터베이스 항목 수정
|
||||
label_settings_post_db: 데이터베이스 항목 추가
|
||||
label_settings_post_password_updates: 암호 수정
|
||||
label_settings_post_password: 암호 추가
|
||||
label_settings_post_private_contacts: 비공개 연락처를 포함
|
||||
label_settings_post_private_db: 비공개 데이터베이스 항목을 포함
|
||||
label_settings_post_private_issues: 비공개 일감을 포함
|
||||
label_settings_post_private_notes: 비공개 노트를 포함
|
||||
label_settings_post_updates: 일감 수정
|
||||
label_settings_post_wiki_updates: 위키 수정
|
||||
label_settings_post_wiki: 위키 추가
|
||||
label_settings_updated_include_description: 수정된 일감의 설명을 포함
|
||||
messenger_channel_info_html: '메시지를 보낼 채널들을 선택합니다. 쉼표로 구분하여 여러 채널을 선택할 수 있습니다.'
|
||||
messenger_contacts_intro: 사전에 정의된 메신저 채널로 연락처의 변경 사항을 보냅니다.
|
||||
messenger_db_intro: 사전에 정의된 메신저 채널로 데이터베이스의 변경 사항을 보냅니다.
|
||||
messenger_issue_intro: 사전에 정의된 메신저 채널로 일감의 변경 사항을 보냅니다.
|
||||
messenger_passwords_intro: 사전에 정의된 메신저 채널로 암호의 변경 사항을 보냅니다.
|
||||
messenger_settings_intro: "레드마인에서 메신저로 메시지를 보내지 않으려면 플러그인 관리 페이지에서 메신저 URL을 빈 값으로 둡니다. 여기에서 설정을 하면 모든 레드마인 프로젝트의 메시지들이 여기에서 설정된 URL의 지정된 채널로 전달됩니다. 일부 프로젝트에 대해서만 전달되게 하고 싶다면 여기에선 URL을 빈 값으로 두고 각 프로젝트에서 설정합니다."
|
||||
messenger_settings_project_intro: "플러그인 관리 페이지에서 메신저 URL을 빈 값으로 두면 각 프로젝트 설정에서 메신저 URL을 설정함으로써 모든 프로젝트의 변경을 전역적으로 수신하지 않게 됩니다."
|
||||
messenger_url_info_html: '메신저 서비스에서 <a target="_blank" href="https://github.com/AlphaNodes/redmine_messenger#prepare-your-messenger-service">Incoming WebHook</a> URL을 만드세요. 전역 설정을 따르려면 빈 값으로 둡니다.'
|
||||
messenger_verify_ssl_info_html: '메신저 서비스가 유효하지 않거나 자가 서명된 SSL 인증서를 사용한다면 비활성화하세요.'
|
||||
messenger_wiki_intro: 사전에 정의된 메신저 채널로 위키의 변경 사항을 보냅니다.
|
||||
permission_manage_messenger: 메신저 관리
|
||||
57
config/locales/pt-BR.yml
Normal file
57
config/locales/pt-BR.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
# Brazilian Portuguese strings
|
||||
pt-BR:
|
||||
default_mentionsl_info: "Pessoas a notificar, separadas por vírgula (ex: @all, @here)"
|
||||
label_messenger_contact_created: "%{project_url} - Contato %{url} criado por *%{user}*"
|
||||
label_messenger_contact_updated: "%{project_url} - Contato %{url} atualizado por *%{user}*"
|
||||
label_messenger_db_entry_created: "%{project_url} - Entrada de dado %{url} criada por *%{user}*"
|
||||
label_messenger_db_entry_updated: "%{project_url} - Entrada de dado %{url} editada por *%{user}*"
|
||||
label_messenger_default_not_visible: Configuração padrão não é viível por razões de segurança.
|
||||
label_messenger_issue_created: "%{project_url} - Tarefa %{url} criada por *%{user}*"
|
||||
label_messenger_issue_updated: "%{project_url} - Tarefa %{url} editada por *%{user}*"
|
||||
label_messenger_outgoing_webhook: Webhook de saída
|
||||
label_messenger_password_created: "%{project_url} - Senha %{url} criada por *%{user}*"
|
||||
label_messenger_password_updated: "%{project_url} - Password %{url} updated by *%{user}*"
|
||||
label_messenger_project_text_field_info: Deixe em branco para usar o padrão.
|
||||
label_messenger_setting: Configurações do Messenger
|
||||
label_messenger_settings_default: Configurações Padrão
|
||||
label_messenger_settings_disabled: Desabilitado
|
||||
label_messenger_settings_enabled: Habilitado
|
||||
label_messenger_wiki_created: "%{project_url} - Wiki %{url} criado por *%{user}*"
|
||||
label_messenger_wiki_updated: "%{project_url} - Wiki %{url} criado por *%{user}*"
|
||||
label_messenger: Messenger
|
||||
label_settings_auto_mentions: Converter nomes em menções?
|
||||
label_settings_default_mentions: Pessoas padrão para menções
|
||||
label_settings_display_watchers: Mostrar observadores?
|
||||
label_settings_messenger_channel: Messenger - Canal
|
||||
label_settings_messenger_icon: Messenger - Ícone
|
||||
label_settings_messenger_url: Messenger - URL
|
||||
label_settings_messenger_username: Messenger - nome de usuário
|
||||
label_settings_messenger_verify_ssl: Verificar SSL
|
||||
label_settings_messenger_direct_users_messages: Enviar mensagens diretas
|
||||
label_settings_new_include_description: Descrição de novas tarefas?
|
||||
label_settings_post_contact_updates: Edições de contato?
|
||||
label_settings_post_contact: Contato adicionado?
|
||||
label_settings_post_db_updates: Modificações de entrada BD?
|
||||
label_settings_post_db: Nova entrada no BD?
|
||||
label_settings_post_password_updates: Modificações de senha?
|
||||
label_settings_post_password: Nova senha?
|
||||
label_settings_post_private_contacts: Contatos privados?
|
||||
label_settings_post_private_db: Entradas privadas BD?
|
||||
label_settings_post_private_issues: Modificações em tarefas privadas?
|
||||
label_settings_post_private_notes: Modificações em notas privadas?
|
||||
label_settings_post_updates: Atualizações de tarefa?
|
||||
label_settings_post_wiki_updates: Atualizações de Wiki?
|
||||
label_settings_post_wiki: Novo post no Wiki?
|
||||
label_settings_updated_include_description: Descrição em atualização de tarefa?
|
||||
messenger_channel_info_html: 'Aqui você precisa especificar o canal a ser usado. Você pode definir múltiplos canais, separados por vírgula'
|
||||
messenger_contacts_intro: Ative as modificações de Tarefas que devem ser enviadas para o canal predefinido no Messenger.
|
||||
messenger_db_intro: Ative as modificações de Tarefas que devem ser enviadas para o canal predefinido no Messenger.
|
||||
messenger_issue_intro: Ative as modificações de Tarefas que devem ser enviadas para o canal predefinido no Messenger.
|
||||
messenger_passwords_intro: Ative as modificações de Senha que devem ser enviadas para o canal predefinido no Messenger.
|
||||
messenger_settings_intro: "Deixe o campo Messenger URL vazio na área de administração para não enviar mensagens do Redmine para o Messenger, independente do que mais você tenha configurado. Caso deseje enviar mensagens de todos projetos do Redmine para o Messenger, informe a URL. As mensagens serão enviadas para o canal especificado. Se você só deseja ser notificado sobre algum(ns) projeto(s) (não todos) deixe o campo URL vazio aqui e vá para as configurações específicas do(s) projeto(s)."
|
||||
messenger_settings_project_intro: "Se você deixar o campo Messenger URL vazio na área de administração para não ser notificado globalmente sobre todos os projetos, você pode configurar a Messenger URL nas configurações do(s) projeto(s)."
|
||||
messenger_url_info_html: 'Gere uma URL <a target="_blank" href="https://github.com/AlphaNodes/redmine_messenger#prepare-your-messenger-service">Incoming WebHook</a> a partir do serviço de mensagens. Deixe em branco se você deseja ativar somente projetos específicos, com base nas configurações de projeto'
|
||||
messenger_verify_ssl_info_html: 'Se o seu serviço Messenger usa um ceftificado SSL inválido ou auto assinado, desabilite.'
|
||||
messenger_direct_users_messages_info_html: 'Se habilitado, o Messenger fará requisições http post para cada usuário como como um canal (mensagem direta no RocketChat) juntamente ao post no canal'
|
||||
messenger_wiki_intro: Ative as modificações de Wikis que devem ser enviadas para o canal predefinido no Messenger.
|
||||
permission_manage_messenger: Gerenciar messenger
|
||||
7
config/routes.rb
Normal file
7
config/routes.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.routes.draw do
|
||||
resources :projects, only: [] do
|
||||
resource :messenger_setting, only: %i[show update]
|
||||
end
|
||||
end
|
||||
29
db/migrate/001_create_messenger_settings.rb
Normal file
29
db/migrate/001_create_messenger_settings.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateMessengerSettings < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :messenger_settings do |t|
|
||||
t.references :project, null: false, index: true
|
||||
t.string :messenger_url
|
||||
t.string :messenger_icon
|
||||
t.string :messenger_channel
|
||||
t.string :messenger_username
|
||||
t.integer :messenger_verify_ssl, default: 0, null: false
|
||||
t.integer :auto_mentions, default: 0, null: false
|
||||
t.integer :display_watchers, default: 0, null: false
|
||||
t.integer :post_updates, default: 0, null: false
|
||||
t.integer :new_include_description, default: 0, null: false
|
||||
t.integer :updated_include_description, default: 0, null: false
|
||||
t.integer :post_private_issues, default: 0, null: false
|
||||
t.integer :post_private_notes, default: 0, null: false
|
||||
t.integer :post_wiki, default: 0, null: false
|
||||
t.integer :post_wiki_updates, default: 0, null: false
|
||||
t.integer :post_db, default: 0, null: false
|
||||
t.integer :post_db_updates, default: 0, null: false
|
||||
t.integer :post_contact, default: 0, null: false
|
||||
t.integer :post_contact_updates, default: 0, null: false
|
||||
t.integer :post_password, default: 0, null: false
|
||||
t.integer :post_password_updates, default: 0, null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
7
db/migrate/002_add_default_mentions.rb
Normal file
7
db/migrate/002_add_default_mentions.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddDefaultMentions < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :messenger_settings, :default_mentions, :string
|
||||
end
|
||||
end
|
||||
8
db/migrate/003_add_private_settings.rb
Normal file
8
db/migrate/003_add_private_settings.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddPrivateSettings < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :messenger_settings, :post_private_contacts, :integer, default: 0, null: false
|
||||
add_column :messenger_settings, :post_private_db, :integer, default: 0, null: false
|
||||
end
|
||||
end
|
||||
7
db/migrate/004_add_direct_messages.rb
Normal file
7
db/migrate/004_add_direct_messages.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddDirectMessages < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :messenger_settings, :messenger_direct_users_messages, :integer, default: 0, null: false
|
||||
end
|
||||
end
|
||||
61
init.rb
61
init.rb
@@ -1,24 +1,47 @@
|
||||
require 'redmine'
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_dependency 'redmine_mattermost/listener'
|
||||
raise "\n\033[31mredmine_messenger requires ruby 2.5 or newer. Please update your ruby version.\033[0m" if RUBY_VERSION < '2.4'
|
||||
|
||||
Redmine::Plugin.register :redmine_mattermost do
|
||||
name 'Redmine Mattermost'
|
||||
author 'AltSol'
|
||||
url 'https://github.com/altsol/redmine_mattermost'
|
||||
author_url 'http://altsol.gr'
|
||||
description 'Mattermost chat integration'
|
||||
version '0.2'
|
||||
Redmine::Plugin.register :redmine_messenger do
|
||||
name 'Redmine Messenger'
|
||||
author 'AlphaNodes GmbH'
|
||||
url 'https://github.com/alphanodes/redmine_messenger'
|
||||
author_url 'https://alphanodes.com/'
|
||||
description 'Messenger integration for Slack, Discord, Rocketchat and Mattermost support'
|
||||
version RedmineMessenger::VERSION
|
||||
|
||||
requires_redmine :version_or_higher => '2.0.0'
|
||||
requires_redmine version_or_higher: '4.1.0'
|
||||
|
||||
settings \
|
||||
:default => {
|
||||
'callback_url' => 'http://example.com/callback/',
|
||||
'channel' => nil,
|
||||
'icon' => 'https://raw.githubusercontent.com/altsol/redmine_mattermost/assets/icon.png',
|
||||
'username' => 'redmine',
|
||||
'display_watchers' => 'no'
|
||||
},
|
||||
:partial => 'settings/mattermost_settings'
|
||||
permission :manage_messenger, projects: :settings, messenger_settings: :update
|
||||
|
||||
settings default: {
|
||||
messenger_url: '',
|
||||
messenger_icon: 'https://raw.githubusercontent.com/alphanodes/redmine_messenger/master/assets/images/icon.png',
|
||||
messenger_channel: 'redmine',
|
||||
messenger_username: 'robot',
|
||||
messenger_verify_ssl: '1',
|
||||
messenger_direct_users_messages: '0',
|
||||
auto_mentions: '0',
|
||||
default_mentions: '',
|
||||
display_watchers: '0',
|
||||
post_updates: '1',
|
||||
new_include_description: '1',
|
||||
updated_include_description: '1',
|
||||
post_private_contacts: '0',
|
||||
post_private_db: '0',
|
||||
post_private_issues: '0',
|
||||
post_private_notes: '0',
|
||||
post_wiki: '0',
|
||||
post_wiki_updates: '0',
|
||||
post_db: '0',
|
||||
post_db_updates: '0',
|
||||
post_contact: '0',
|
||||
post_contact_updates: '0',
|
||||
post_password: '0',
|
||||
post_password_updates: '0'
|
||||
}, partial: 'settings/messenger_settings'
|
||||
end
|
||||
|
||||
Rails.configuration.to_prepare do
|
||||
RedmineMessenger.setup
|
||||
end
|
||||
|
||||
@@ -1,245 +0,0 @@
|
||||
require 'httpclient'
|
||||
|
||||
class MattermostListener < Redmine::Hook::Listener
|
||||
def controller_issues_new_after_save(context={})
|
||||
issue = context[:issue]
|
||||
|
||||
channel = channel_for_project issue.project
|
||||
url = url_for_project issue.project
|
||||
|
||||
return unless channel and url
|
||||
return if issue.is_private?
|
||||
|
||||
msg = "[#{escape issue.project}] #{escape issue.author} created <#{object_url issue}|#{escape issue}>#{mentions issue.description}"
|
||||
|
||||
attachment = {}
|
||||
attachment[:text] = escape issue.description if issue.description
|
||||
attachment[:fields] = [{
|
||||
:title => I18n.t("field_status"),
|
||||
:value => escape(issue.status.to_s),
|
||||
:short => true
|
||||
}, {
|
||||
:title => I18n.t("field_priority"),
|
||||
:value => escape(issue.priority.to_s),
|
||||
:short => true
|
||||
}, {
|
||||
:title => I18n.t("field_assigned_to"),
|
||||
:value => escape(issue.assigned_to.to_s),
|
||||
:short => true
|
||||
}]
|
||||
|
||||
attachment[:fields] << {
|
||||
:title => I18n.t("field_watcher"),
|
||||
:value => escape(issue.watcher_users.join(', ')),
|
||||
:short => true
|
||||
} if Setting.plugin_redmine_mattermost[:display_watchers] == 'yes'
|
||||
|
||||
speak msg, channel, attachment, url
|
||||
end
|
||||
|
||||
def controller_issues_edit_after_save(context={})
|
||||
issue = context[:issue]
|
||||
journal = context[:journal]
|
||||
|
||||
channel = channel_for_project issue.project
|
||||
url = url_for_project issue.project
|
||||
|
||||
return unless channel and url and Setting.plugin_redmine_mattermost[:post_updates] == '1'
|
||||
return if issue.is_private?
|
||||
|
||||
msg = "[#{escape issue.project}] #{escape journal.user.to_s} updated <#{object_url issue}|#{escape issue}>#{mentions journal.notes}"
|
||||
|
||||
attachment = {}
|
||||
attachment[:text] = escape journal.notes if journal.notes
|
||||
attachment[:fields] = journal.details.map { |d| detail_to_field d }
|
||||
|
||||
speak msg, channel, attachment, url
|
||||
end
|
||||
|
||||
def model_changeset_scan_commit_for_issue_ids_pre_issue_update(context={})
|
||||
issue = context[:issue]
|
||||
journal = issue.current_journal
|
||||
changeset = context[:changeset]
|
||||
|
||||
channel = channel_for_project issue.project
|
||||
url = url_for_project issue.project
|
||||
|
||||
return unless channel and url and issue.save
|
||||
return if issue.is_private?
|
||||
|
||||
msg = "[#{escape issue.project}] #{escape journal.user.to_s} updated <#{object_url issue}|#{escape issue}>"
|
||||
|
||||
repository = changeset.repository
|
||||
|
||||
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}>")
|
||||
attachment[:fields] = journal.details.map { |d| detail_to_field d }
|
||||
|
||||
speak msg, channel, attachment, url
|
||||
end
|
||||
|
||||
def speak(msg, channel, attachment=nil, url=nil)
|
||||
url = Setting.plugin_redmine_mattermost[:mattermost_url] if not url
|
||||
username = Setting.plugin_redmine_mattermost[:username]
|
||||
icon = Setting.plugin_redmine_mattermost[:icon]
|
||||
|
||||
params = {
|
||||
:text => msg,
|
||||
:link_names => 1,
|
||||
}
|
||||
|
||||
params[:username] = username if username
|
||||
params[:channel] = channel if channel
|
||||
|
||||
params[:attachments] = [attachment] if attachment
|
||||
|
||||
if icon and not icon.empty?
|
||||
if icon.start_with? ':'
|
||||
params[:icon_emoji] = icon
|
||||
else
|
||||
params[:icon_url] = icon
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
client = HTTPClient.new
|
||||
client.ssl_config.cert_store.set_default_paths
|
||||
client.ssl_config.ssl_version = "SSLv23"
|
||||
client.post_async url, {:payload => params.to_json}
|
||||
rescue
|
||||
# Bury exception if connection error
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def escape(msg)
|
||||
msg.to_s.gsub("&", "&").gsub("<", "<").gsub(">", ">")
|
||||
end
|
||||
|
||||
def object_url(obj)
|
||||
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)
|
||||
return nil if proj.blank?
|
||||
|
||||
cf = ProjectCustomField.find_by_name("Mattermost URL")
|
||||
|
||||
return [
|
||||
(proj.custom_value_for(cf).value rescue nil),
|
||||
(url_for_project proj.parent),
|
||||
Setting.plugin_redmine_mattermost[:mattermost_url],
|
||||
].find{|v| v.present?}
|
||||
end
|
||||
|
||||
def channel_for_project(proj)
|
||||
return nil if proj.blank?
|
||||
|
||||
cf = ProjectCustomField.find_by_name("Mattermost Channel")
|
||||
|
||||
val = [
|
||||
(proj.custom_value_for(cf).value rescue nil),
|
||||
(channel_for_project proj.parent),
|
||||
Setting.plugin_redmine_mattermost[:channel],
|
||||
].find{|v| v.present?}
|
||||
|
||||
# Channel name '-' is reserved for NOT notifying
|
||||
return nil if val.to_s == '-'
|
||||
val
|
||||
end
|
||||
|
||||
def detail_to_field(detail)
|
||||
if detail.property == "cf"
|
||||
key = CustomField.find(detail.prop_key).name rescue nil
|
||||
title = key
|
||||
elsif detail.property == "attachment"
|
||||
key = "attachment"
|
||||
title = I18n.t :label_attachment
|
||||
else
|
||||
key = detail.prop_key.to_s.sub("_id", "")
|
||||
title = I18n.t "field_#{key}"
|
||||
end
|
||||
|
||||
short = true
|
||||
value = escape detail.value.to_s
|
||||
|
||||
case key
|
||||
when "title", "subject", "description"
|
||||
short = false
|
||||
when "tracker"
|
||||
tracker = Tracker.find(detail.value) rescue nil
|
||||
value = escape tracker.to_s
|
||||
when "project"
|
||||
project = Project.find(detail.value) rescue nil
|
||||
value = escape project.to_s
|
||||
when "status"
|
||||
status = IssueStatus.find(detail.value) rescue nil
|
||||
value = escape status.to_s
|
||||
when "priority"
|
||||
priority = IssuePriority.find(detail.value) rescue nil
|
||||
value = escape priority.to_s
|
||||
when "category"
|
||||
category = IssueCategory.find(detail.value) rescue nil
|
||||
value = escape category.to_s
|
||||
when "assigned_to"
|
||||
user = User.find(detail.value) rescue nil
|
||||
value = escape user.to_s
|
||||
when "fixed_version"
|
||||
version = Version.find(detail.value) rescue nil
|
||||
value = escape version.to_s
|
||||
when "attachment"
|
||||
attachment = Attachment.find(detail.prop_key) rescue nil
|
||||
value = "<#{object_url attachment}|#{escape attachment.filename}>" if attachment
|
||||
when "parent"
|
||||
issue = Issue.find(detail.value) rescue nil
|
||||
value = "<#{object_url issue}|#{escape issue}>" if issue
|
||||
end
|
||||
|
||||
value = "-" if value.empty?
|
||||
|
||||
result = { :title => title, :value => value }
|
||||
result[:short] = true if short
|
||||
result
|
||||
end
|
||||
|
||||
def mentions text
|
||||
names = extract_usernames text
|
||||
names.present? ? "\nTo: " + names.join(', ') : nil
|
||||
end
|
||||
|
||||
def extract_usernames text = ''
|
||||
# mattermost usernames may only contain lowercase letters, numbers,
|
||||
# dashes and underscores and must start with a letter or number.
|
||||
text.scan(/@[a-z0-9][a-z0-9_\-]*/).uniq
|
||||
end
|
||||
end
|
||||
43
lib/redmine_messenger.rb
Normal file
43
lib/redmine_messenger.rb
Normal file
@@ -0,0 +1,43 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'redmine_messenger/version'
|
||||
|
||||
module RedmineMessenger
|
||||
REDMINE_CONTACTS_SUPPORT = Redmine::Plugin.installed? 'redmine_contacts'
|
||||
REDMINE_DB_SUPPORT = Redmine::Plugin.installed? 'redmine_db'
|
||||
|
||||
class << self
|
||||
def setup
|
||||
# Patches
|
||||
Issue.include RedmineMessenger::Patches::IssuePatch
|
||||
WikiPage.include RedmineMessenger::Patches::WikiPagePatch
|
||||
ProjectsController.send :helper, MessengerProjectsHelper
|
||||
Contact.include RedmineMessenger::Patches::ContactPatch if RedmineMessenger::REDMINE_CONTACTS_SUPPORT
|
||||
DbEntry.include RedmineMessenger::Patches::DbEntryPatch if RedmineMessenger::REDMINE_DB_SUPPORT
|
||||
Password.include RedmineMessenger::Patches::PasswordPatch if Redmine::Plugin.installed? 'redmine_passwords'
|
||||
|
||||
# Global helpers
|
||||
ActionView::Base.include RedmineMessenger::Helpers
|
||||
|
||||
# Hooks
|
||||
require_dependency 'redmine_messenger/hooks'
|
||||
end
|
||||
|
||||
def settings
|
||||
if Setting[:plugin_redmine_messenger].is_a? Hash
|
||||
new_settings = ActiveSupport::HashWithIndifferentAccess.new Setting[:plugin_redmine_messenger]
|
||||
Setting.plugin_redmine_messenger = new_settings
|
||||
new_settings
|
||||
else
|
||||
# Rails 5 uses ActiveSupport::HashWithIndifferentAccess
|
||||
Setting[:plugin_redmine_messenger]
|
||||
end
|
||||
end
|
||||
|
||||
def setting?(value)
|
||||
return true if settings[value].to_i == 1
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
19
lib/redmine_messenger/helpers.rb
Normal file
19
lib/redmine_messenger/helpers.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RedmineMessenger
|
||||
module Helpers
|
||||
def project_messenger_options(active)
|
||||
options_for_select({ l(:label_messenger_settings_default) => '0',
|
||||
l(:label_messenger_settings_disabled) => '1',
|
||||
l(:label_messenger_settings_enabled) => '2' }, active)
|
||||
end
|
||||
|
||||
def project_setting_messenger_default_value(value)
|
||||
if Messenger.default_project_setting @project, value
|
||||
l :label_messenger_settings_enabled
|
||||
else
|
||||
l :label_messenger_settings_disabled
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
57
lib/redmine_messenger/hooks.rb
Normal file
57
lib/redmine_messenger/hooks.rb
Normal file
@@ -0,0 +1,57 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RedmineMessenger
|
||||
class MessengerListener < Redmine::Hook::Listener
|
||||
def model_changeset_scan_commit_for_issue_ids_pre_issue_update(context = {})
|
||||
issue = context[:issue]
|
||||
journal = issue.current_journal
|
||||
changeset = context[:changeset]
|
||||
|
||||
channels = Messenger.channels_for_project issue.project
|
||||
url = Messenger.url_for_project issue.project
|
||||
|
||||
return unless channels.present? && url && issue.changes.any? && Messenger.setting_for_project(issue.project, :post_updates)
|
||||
return if issue.is_private? && !Messenger.setting_for_project(issue.project, :post_private_issues)
|
||||
|
||||
msg = "[#{Messenger.markup_format issue.project}]" \
|
||||
" #{Messenger.markup_format journal.user.to_s} updated <#{Messenger.object_url issue}|#{Messenger.markup_format issue}>"
|
||||
|
||||
repository = changeset.repository
|
||||
|
||||
if Setting.host_name.to_s =~ %r{/\A(https?://)?(.+?)(:(\d+))?(/.+)?\z/i}
|
||||
host = Regexp.last_match 2
|
||||
port = Regexp.last_match 4
|
||||
prefix = Regexp.last_match 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}|#{Messenger.markup_format changeset.comments}>")
|
||||
attachment[:fields] = journal.details.map { |d| Messenger.detail_to_field d }
|
||||
|
||||
Messenger.speak msg, channels, url, attachment: attachment, project: repository.project
|
||||
end
|
||||
end
|
||||
end
|
||||
54
lib/redmine_messenger/patches/contact_patch.rb
Normal file
54
lib/redmine_messenger/patches/contact_patch.rb
Normal file
@@ -0,0 +1,54 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RedmineMessenger
|
||||
module Patches
|
||||
module ContactPatch
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include InstanceMethods
|
||||
|
||||
after_create_commit :send_messenger_create
|
||||
after_update_commit :send_messenger_update
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def send_messenger_create
|
||||
return unless Messenger.setting_for_project project, :post_contact
|
||||
return if is_private? && !Messenger.setting_for_project(project, :post_private_contacts)
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
return unless channels.present? && url
|
||||
|
||||
Messenger.speak l(:label_messenger_contact_created,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: Messenger.url_markdown(self, name),
|
||||
user: User.current),
|
||||
channels, url, project: project
|
||||
end
|
||||
|
||||
def send_messenger_update
|
||||
return unless Messenger.setting_for_project project, :post_contact_updates
|
||||
return if is_private? && !Messenger.setting_for_project(project, :post_private_contacts)
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
return unless channels.present? && url
|
||||
|
||||
Messenger.speak l(:label_messenger_contact_updated,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: Messenger.url_markdown(self, name),
|
||||
user: User.current),
|
||||
channels, url, project: project
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
54
lib/redmine_messenger/patches/db_entry_patch.rb
Normal file
54
lib/redmine_messenger/patches/db_entry_patch.rb
Normal file
@@ -0,0 +1,54 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RedmineMessenger
|
||||
module Patches
|
||||
module DbEntryPatch
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include InstanceMethods
|
||||
|
||||
after_create_commit :send_messenger_create
|
||||
after_update_commit :send_messenger_update
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def send_messenger_create
|
||||
return unless Messenger.setting_for_project project, :post_db
|
||||
return if is_private? && !Messenger.setting_for_project(project, :post_private_db)
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
return unless channels.present? && url
|
||||
|
||||
Messenger.speak l(:label_messenger_db_entry_created,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: Messenger.url_markdown(self, name),
|
||||
user: User.current),
|
||||
channels, url, project: project
|
||||
end
|
||||
|
||||
def send_messenger_update
|
||||
return unless Messenger.setting_for_project project, :post_db_updates
|
||||
return if is_private? && !Messenger.setting_for_project(project, :post_private_db)
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
return unless channels.present? && url
|
||||
|
||||
Messenger.speak l(:label_messenger_db_entry_updated,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: Messenger.url_markdown(self, name),
|
||||
user: User.current),
|
||||
channels, url, project: project
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
131
lib/redmine_messenger/patches/issue_patch.rb
Normal file
131
lib/redmine_messenger/patches/issue_patch.rb
Normal file
@@ -0,0 +1,131 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RedmineMessenger
|
||||
module Patches
|
||||
module IssuePatch
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include InstanceMethods
|
||||
|
||||
after_create_commit :send_messenger_create
|
||||
after_update_commit :send_messenger_update
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def send_messenger_create
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
if Messenger.setting_for_project project, :messenger_direct_users_messages
|
||||
messenger_to_be_notified.each do |user|
|
||||
channels.append "@#{user.login}" unless user == author
|
||||
end
|
||||
end
|
||||
|
||||
return unless channels.present? && url
|
||||
return if is_private? && !Messenger.setting_for_project(project, :post_private_issues)
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
attachment = {}
|
||||
if description.present? && Messenger.setting_for_project(project, :new_include_description)
|
||||
attachment[:text] = Messenger.markup_format description
|
||||
end
|
||||
attachment[:fields] = [{ title: I18n.t(:field_status),
|
||||
value: Messenger.markup_format(status.to_s),
|
||||
short: true },
|
||||
{ title: I18n.t(:field_priority),
|
||||
value: Messenger.markup_format(priority.to_s),
|
||||
short: true }]
|
||||
if assigned_to.present?
|
||||
attachment[:fields] << { title: I18n.t(:field_assigned_to),
|
||||
value: Messenger.markup_format(assigned_to.to_s),
|
||||
short: true }
|
||||
end
|
||||
|
||||
attachments.each do |att|
|
||||
attachment[:fields] << { title: I18n.t(:label_attachment),
|
||||
value: "<#{Messenger.object_url att}|#{ERB::Util.html_escape att.filename}>",
|
||||
short: true }
|
||||
end
|
||||
|
||||
if RedmineMessenger.setting?(:display_watchers) && watcher_users.count.positive?
|
||||
attachment[:fields] << {
|
||||
title: I18n.t(:field_watcher),
|
||||
value: Messenger.markup_format(watcher_users.join(', ')),
|
||||
short: true
|
||||
}
|
||||
end
|
||||
|
||||
Messenger.speak l(:label_messenger_issue_created,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: send_messenger_mention_url(project, description),
|
||||
user: author),
|
||||
channels, url, attachment: attachment, project: project
|
||||
end
|
||||
|
||||
def send_messenger_update
|
||||
return if current_journal.nil?
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
if Messenger.setting_for_project project, :messenger_direct_users_messages
|
||||
messenger_to_be_notified.each do |user|
|
||||
channels.append "@#{user.login}" unless user == current_journal.user
|
||||
end
|
||||
end
|
||||
|
||||
return unless channels.present? && url && Messenger.setting_for_project(project, :post_updates)
|
||||
return if is_private? && !Messenger.setting_for_project(project, :post_private_issues)
|
||||
return if current_journal.private_notes? && !Messenger.setting_for_project(project, :post_private_notes)
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
attachment = {}
|
||||
if Messenger.setting_for_project project, :updated_include_description
|
||||
attachment_text = Messenger.attachment_text_from_journal current_journal
|
||||
attachment[:text] = attachment_text if attachment_text.present?
|
||||
end
|
||||
|
||||
fields = current_journal.details.map { |d| Messenger.detail_to_field d, project }
|
||||
if current_journal.notes.present?
|
||||
fields << { title: I18n.t(:label_comment),
|
||||
value: Messenger.markup_format(current_journal.notes),
|
||||
short: false }
|
||||
end
|
||||
fields << { title: I18n.t(:field_is_private), short: true } if current_journal.private_notes?
|
||||
fields.compact!
|
||||
attachment[:fields] = fields if fields.any?
|
||||
|
||||
Messenger.speak l(:label_messenger_issue_updated,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: send_messenger_mention_url(project, description),
|
||||
user: current_journal.user),
|
||||
channels, url, attachment: attachment, project: project
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def messenger_to_be_notified
|
||||
to_be_notified = (notified_users + notified_watchers).compact
|
||||
to_be_notified.uniq
|
||||
end
|
||||
|
||||
def send_messenger_mention_url(project, text)
|
||||
mention_to = ''
|
||||
if Messenger.setting_for_project(project, :auto_mentions) ||
|
||||
Messenger.textfield_for_project(project, :default_mentions).present?
|
||||
mention_to = Messenger.mentions project, text
|
||||
end
|
||||
if current_journal.nil?
|
||||
"<#{Messenger.object_url self}|#{Messenger.markup_format self}>#{mention_to}"
|
||||
else
|
||||
"<#{Messenger.object_url self}#change-#{current_journal.id}|#{Messenger.markup_format self}>#{mention_to}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
54
lib/redmine_messenger/patches/password_patch.rb
Normal file
54
lib/redmine_messenger/patches/password_patch.rb
Normal file
@@ -0,0 +1,54 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RedmineMessenger
|
||||
module Patches
|
||||
module PasswordPatch
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include InstanceMethods
|
||||
|
||||
after_create_commit :send_messenger_create
|
||||
after_update_commit :send_messenger_update
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def send_messenger_create
|
||||
return unless Messenger.setting_for_project project, :post_password
|
||||
return if is_private?
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
return unless channels.present? && url
|
||||
|
||||
Messenger.speak l(:label_messenger_password_created,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: Messenger.url_markdown(self, name),
|
||||
user: User.current),
|
||||
channels, url, project: project
|
||||
end
|
||||
|
||||
def send_messenger_update
|
||||
return unless Messenger.setting_for_project project, :post_password_updates
|
||||
return if is_private?
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
return unless channels.present? && url
|
||||
|
||||
Messenger.speak l(:label_messenger_password_updated,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: Messenger.url_markdown(self, name),
|
||||
user: User.current),
|
||||
channels, url, project: project
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
58
lib/redmine_messenger/patches/wiki_page_patch.rb
Normal file
58
lib/redmine_messenger/patches/wiki_page_patch.rb
Normal file
@@ -0,0 +1,58 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RedmineMessenger
|
||||
module Patches
|
||||
module WikiPagePatch
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include InstanceMethods
|
||||
|
||||
after_create_commit :send_messenger_create
|
||||
after_update_commit :send_messenger_update
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def send_messenger_create
|
||||
return unless Messenger.setting_for_project project, :post_wiki
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
return unless channels.present? && url
|
||||
|
||||
Messenger.speak l(:label_messenger_wiki_created,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: Messenger.url_markdown(self, title),
|
||||
user: User.current),
|
||||
channels, url, project: project
|
||||
end
|
||||
|
||||
def send_messenger_update
|
||||
return unless Messenger.setting_for_project project, :post_wiki_updates
|
||||
|
||||
set_language_if_valid Setting.default_language
|
||||
|
||||
channels = Messenger.channels_for_project project
|
||||
url = Messenger.url_for_project project
|
||||
|
||||
return unless channels.present? && url
|
||||
|
||||
attachment = nil
|
||||
if !content.nil? && content.comments.present?
|
||||
attachment = {}
|
||||
attachment[:text] = Messenger.markup_format content.comments.to_s
|
||||
end
|
||||
|
||||
Messenger.speak l(:label_messenger_wiki_updated,
|
||||
project_url: Messenger.project_url_markdown(project),
|
||||
url: Messenger.url_markdown(self, title),
|
||||
user: content.author),
|
||||
channels, url, project: project, attachment: attachment
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
5
lib/redmine_messenger/version.rb
Normal file
5
lib/redmine_messenger/version.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RedmineMessenger
|
||||
VERSION = '1.0.9'
|
||||
end
|
||||
39
test/integration/common_views_test.rb
Normal file
39
test/integration/common_views_test.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class CommonViewsTest < Redmine::IntegrationTest
|
||||
fixtures :projects,
|
||||
:users,
|
||||
:roles,
|
||||
:members,
|
||||
:member_roles,
|
||||
:trackers,
|
||||
:projects_trackers,
|
||||
:enabled_modules,
|
||||
:issue_statuses,
|
||||
:issues,
|
||||
:enumerations,
|
||||
:custom_fields,
|
||||
:custom_values,
|
||||
:custom_fields_trackers
|
||||
|
||||
def setup
|
||||
RedmineMessenger::TestCase.prepare
|
||||
end
|
||||
|
||||
test 'View user' do
|
||||
log_user 'admin', 'admin'
|
||||
get '/users/2'
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test 'View issue' do
|
||||
log_user 'admin', 'admin'
|
||||
EnabledModule.create project_id: 1, name: 'issue_tracking'
|
||||
issue = Issue.where(id: 1).first
|
||||
issue.save
|
||||
get '/issues/1'
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
10
test/integration/routing_test.rb
Normal file
10
test/integration/routing_test.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class RoutingTest < Redmine::RoutingTest
|
||||
test 'routing messenger' do
|
||||
should_route 'GET /projects/1/settings/messenger' => 'projects#settings', id: '1', tab: 'messenger'
|
||||
should_route 'PUT /projects/1/messenger_setting' => 'messenger_settings#update', project_id: '1'
|
||||
end
|
||||
end
|
||||
6
test/support/configuration.yml
Normal file
6
test/support/configuration.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
# = Redmine configuration file
|
||||
|
||||
# default configuration options for all environments
|
||||
default:
|
||||
sudo_mode: false
|
||||
sudo_mode_timeout: 1
|
||||
8
test/support/database-mysql.yml
Normal file
8
test/support/database-mysql.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
test:
|
||||
adapter: mysql2
|
||||
database: redmine
|
||||
port: <%= ENV["MYSQL_PORT"] %>
|
||||
host: 127.0.0.1
|
||||
username: root
|
||||
password: BestPasswordEver
|
||||
encoding: utf8mb4
|
||||
23
test/support/database-postgres.yml
Normal file
23
test/support/database-postgres.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
production:
|
||||
adapter: postgresql
|
||||
host: localhost
|
||||
database: redmine
|
||||
username: postgres
|
||||
password: postgres
|
||||
encoding: utf8
|
||||
|
||||
development:
|
||||
adapter: postgresql
|
||||
host: localhost
|
||||
database: redmine
|
||||
username: postgres
|
||||
password: postgres
|
||||
encoding: utf8
|
||||
|
||||
test:
|
||||
adapter: postgresql
|
||||
host: localhost
|
||||
database: redmine
|
||||
username: postgres
|
||||
password: postgres
|
||||
encoding: utf8
|
||||
28
test/test_helper.rb
Normal file
28
test/test_helper.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
if ENV['JENKINS']
|
||||
require 'simplecov'
|
||||
SimpleCov.start :rails do
|
||||
add_filter 'init.rb'
|
||||
root File.expand_path "#{File.dirname __FILE__}/.."
|
||||
end
|
||||
end
|
||||
|
||||
require File.expand_path "#{File.dirname __FILE__}/../../../test/test_helper"
|
||||
|
||||
module RedmineMessenger
|
||||
class TestCase
|
||||
include ActionDispatch::TestProcess
|
||||
|
||||
def self.prepare
|
||||
Role.where(id: [1, 2]).each do |r|
|
||||
r.permissions << :view_issues
|
||||
r.save
|
||||
end
|
||||
|
||||
Project.where(id: [1, 2]).each do |project|
|
||||
EnabledModule.create project: project, name: 'issue_tracking'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
37
test/unit/i18n_test.rb
Normal file
37
test/unit/i18n_test.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class I18nTest < ActiveSupport::TestCase
|
||||
include Redmine::I18n
|
||||
|
||||
def setup
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
def teardown
|
||||
set_language_if_valid 'en'
|
||||
end
|
||||
|
||||
def test_valid_languages
|
||||
assert valid_languages.is_a?(Array)
|
||||
assert valid_languages.first.is_a?(Symbol)
|
||||
end
|
||||
|
||||
def test_locales_validness
|
||||
lang_files_count = Dir[Rails.root.join('plugins/redmine_messenger/config/locales/*.yml')].size
|
||||
|
||||
assert_equal 6, lang_files_count
|
||||
valid_languages.each do |lang|
|
||||
assert set_language_if_valid(lang)
|
||||
case lang.to_s
|
||||
when 'en'
|
||||
assert_equal 'Messenger username', l(:label_settings_messenger_username)
|
||||
when 'de', 'fr', 'ja', 'ko', 'pt-BR'
|
||||
assert_not l(:label_settings_messenger_username) == 'Messenger username', lang
|
||||
end
|
||||
end
|
||||
|
||||
set_language_if_valid 'en'
|
||||
end
|
||||
end
|
||||
31
test/unit/issue_test.rb
Normal file
31
test/unit/issue_test.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class IssueTest < ActiveSupport::TestCase
|
||||
fixtures :projects, :users, :members, :member_roles, :roles,
|
||||
:trackers, :projects_trackers,
|
||||
:enabled_modules,
|
||||
:issue_statuses, :issue_categories, :workflows,
|
||||
:enumerations,
|
||||
:issues, :journals, :journal_details,
|
||||
:custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values,
|
||||
:time_entries
|
||||
|
||||
include Redmine::I18n
|
||||
|
||||
def setup
|
||||
set_language_if_valid 'en'
|
||||
end
|
||||
|
||||
def teardown
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
def test_create
|
||||
issue = Issue.new project_id: 1, tracker_id: 1, author_id: 3, subject: 'test_create'
|
||||
assert_save issue
|
||||
assert_equal issue.tracker.default_status, issue.status
|
||||
assert issue.description.nil?
|
||||
end
|
||||
end
|
||||
39
test/unit/project_test.rb
Normal file
39
test/unit/project_test.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class ProjectTest < ActiveSupport::TestCase
|
||||
fixtures :projects, :trackers, :issue_statuses, :issues,
|
||||
:journals, :journal_details,
|
||||
:enumerations, :users, :issue_categories,
|
||||
:projects_trackers,
|
||||
:custom_fields,
|
||||
:custom_fields_projects,
|
||||
:custom_fields_trackers,
|
||||
:custom_values,
|
||||
:roles,
|
||||
:member_roles,
|
||||
:members,
|
||||
:enabled_modules,
|
||||
:versions,
|
||||
:wikis, :wiki_pages, :wiki_contents, :wiki_content_versions,
|
||||
:groups_users,
|
||||
:time_entries,
|
||||
:news, :comments,
|
||||
:documents,
|
||||
:workflows
|
||||
|
||||
def setup
|
||||
User.current = User.find 1
|
||||
end
|
||||
|
||||
def test_create_project
|
||||
Project.delete_all
|
||||
Project.create! name: 'Project Messenger', identifier: 'project-messenger'
|
||||
assert_equal 1, Project.count
|
||||
end
|
||||
|
||||
def test_load_project
|
||||
Project.find 1
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user