Add is_private support for db and contacts

This commit is contained in:
Alexander Meindl
2018-01-25 17:05:28 +01:00
parent 4d447f75ab
commit 7339e9e382
11 changed files with 36 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ Changelog
- 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)
1.0.1
-----

View File

@@ -23,8 +23,10 @@ class MessengerSetting < ActiveRecord::Base
'post_wiki_updates',
'post_db',
'post_db_updates',
'post_private_db',
'post_contact',
'post_contact_updates',
'post_private_contacts',
'post_password',
'post_password_updates'

View File

@@ -49,6 +49,7 @@
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)
br
@@ -57,6 +58,7 @@
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)
br

View File

@@ -72,6 +72,9 @@ p
p
= content_tag(:label, l(:label_settings_post_db_updates))
= check_box_tag 'settings[post_db_updates]', 1, @settings[:post_db_updates].to_i == 1
p
= content_tag(: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
br
@@ -84,6 +87,9 @@ p
p
= content_tag(:label, l(:label_settings_post_contact_updates))
= check_box_tag 'settings[post_contact_updates]', 1, @settings[:post_contact_updates].to_i == 1
p
= content_tag(: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')
br

View File

@@ -28,10 +28,12 @@ de:
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 entry Updates?
label_settings_post_db: Neue DB entries?
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_db: Private DB Einträge?
label_settings_post_private_contacts: Private Kontakte?
label_settings_post_private_issues: Private Ticket Updates?
label_settings_post_private_notes: Private Notizen?
label_settings_post_updates: Ticket Updates?

View File

@@ -32,6 +32,8 @@ en:
label_settings_post_db: DB entry added?
label_settings_post_password_updates: Password updates?
label_settings_post_password: Password added?
label_settings_post_private_db: Private DB entries?
label_settings_post_private_contacts: Private contacts?
label_settings_post_private_issues: Private issue updates?
label_settings_post_private_notes: Private notes updates?
label_settings_post_updates: Issue updates?

View File

@@ -32,6 +32,8 @@ ja:
label_settings_post_db: DB entry added?
label_settings_post_password_updates: Password updates?
label_settings_post_password: Password added?
label_settings_post_private_db: Private DB entries?
label_settings_post_private_contacts: Private contacts?
label_settings_post_private_issues: プライベートチケットの更新
label_settings_post_private_notes: プライベート注記の更新
label_settings_post_updates: チケットの更新

View File

@@ -0,0 +1,8 @@
# Redmine Messenger plugin for Redmine
class AddPrivateSettings < ActiveRecord::Migration
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

View File

@@ -27,8 +27,10 @@ Redmine::Plugin.register :redmine_messenger do
post_updates: '1',
new_include_description: '1',
updated_include_description: '1',
post_private_issues: '1',
post_private_notes: '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',

View File

@@ -14,6 +14,7 @@ module RedmineMessenger
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
@@ -29,6 +30,7 @@ module RedmineMessenger
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

View File

@@ -14,6 +14,8 @@ module RedmineMessenger
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
@@ -29,6 +31,7 @@ module RedmineMessenger
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