remove issue auto watch, because it is a feature of Redmine 5
This commit is contained in:
parent
5cdba293c9
commit
e411d3f3d5
@ -5,6 +5,7 @@ Changelog
|
||||
+++++
|
||||
|
||||
- D3 7.4.0 support
|
||||
- Remove issue autowatch (this feature comes with Redmine 5)
|
||||
|
||||
3.0.5.2
|
||||
+++++++
|
||||
|
@ -13,8 +13,6 @@ p
|
||||
= additionals_settings_checkbox :issue_assign_to_me
|
||||
p
|
||||
= additionals_settings_checkbox :issue_change_status_in_sidebar
|
||||
p
|
||||
= additionals_settings_checkbox :issue_autowatch_involved
|
||||
p
|
||||
= additionals_settings_checkbox :issue_freezed_with_close
|
||||
em.info = t :rule_issue_freezed_with_close_info
|
||||
|
@ -1,4 +0,0 @@
|
||||
- if Additionals.setting?(:issue_autowatch_involved) && User.current.allowed_to?(:view_issues, nil, global: true)
|
||||
= labelled_fields_for :pref, @user.pref do |pref_fields|
|
||||
p
|
||||
= pref_fields.check_box :autowatch_involved_issue
|
@ -37,7 +37,6 @@ cs:
|
||||
error_query_statement_invalid: "Při provádění dotazu došlo k chybě a bylo zaznamenáno. Nahlaste tuto chybu administrátorovi Redmine."
|
||||
errors_no_or_invalid_arguments: "Žádné nebo neplatné argumenty"
|
||||
field_always_expose: "Vždy zobrazit název palubní desky"
|
||||
field_autowatch_involved_issue: "Problémy s automatickým sledováním"
|
||||
field_color: Barva
|
||||
field_enable_sidebar: Enable sidebar
|
||||
field_hide: "Skrýt"
|
||||
@ -96,7 +95,6 @@ cs:
|
||||
label_invalid_feed_data: "Neplatná data zdroje nebo adresa URL"
|
||||
label_issue_assign_to_me: Show "Assign to me" on issue
|
||||
label_issue_auto_assign: "If \"Assigned to\" is not assigned to a user and the new issue status is x then the issue is auto assigned to the first group with users of the pre-defined role."
|
||||
label_issue_autowatch_involved: "Automaticky přidejte zúčastněné uživatele jako sledovatele"
|
||||
label_issue_change_status_in_sidebar: "Stav vydání na postranním panelu"
|
||||
label_issue_change_status: "Změnit stav"
|
||||
label_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
|
@ -37,7 +37,6 @@ de:
|
||||
error_query_statement_invalid: Beim Ausführen der Query ist ein Fehler aufgetreten und wurde protokolliert. Bitte melden Sie diesen Fehler Ihrem Redmine-Administrator.
|
||||
errors_no_or_invalid_arguments: Kein oder ungültiger Parameter
|
||||
field_always_expose: Dashboard Name immer anzeigen
|
||||
field_autowatch_involved_issue: Involvierte Tickets automatisch beobachten
|
||||
field_color: Farbe
|
||||
field_enable_sidebar: Sidebar aktivieren
|
||||
field_hide: Verstecken
|
||||
@ -96,7 +95,6 @@ de:
|
||||
label_invalid_feed_data: Ungültige Feed Daten oder URL
|
||||
label_issue_assign_to_me: Ticket "Mir zuweisen" anzeigen
|
||||
label_issue_auto_assign: "Wird \"Zugewiesen an\" nicht zugewiesen und der neue Ticketstatus ist x, dann wird die ersten Gruppe mit Benutzern der festgelegten Rolle das Ticket zugewiesen."
|
||||
label_issue_autowatch_involved: Involvierte Benutzer automatisch als Beobachter hinzufügen
|
||||
label_issue_change_status_in_sidebar: Ticketstatus über Sidebar
|
||||
label_issue_change_status: Status ändern
|
||||
label_issue_current_user_status: "Der Ticketstatus x ist nur erlaubt, wenn \"Zugewiesen an\" der aktuelle Benutzer zugewiesen wird."
|
||||
|
@ -37,7 +37,6 @@ en:
|
||||
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
|
||||
errors_no_or_invalid_arguments: No or invalid arguments
|
||||
field_always_expose: Always show dashboard name
|
||||
field_autowatch_involved_issue: Autowatch involved issues
|
||||
field_color: Color
|
||||
field_enable_sidebar: Enable sidebar
|
||||
field_hide: Hide
|
||||
@ -96,7 +95,6 @@ en:
|
||||
label_invalid_feed_data: "Invalid feed data or URL"
|
||||
label_issue_assign_to_me: Show "Assign to me" on issue
|
||||
label_issue_auto_assign: "If \"Assigned to\" is not assigned to a user and the new issue status is x then the issue is auto assigned to the first group with users of the pre-defined role."
|
||||
label_issue_autowatch_involved: Add involved users as watcher automatically
|
||||
label_issue_change_status_in_sidebar: Issue status on sidebar
|
||||
label_issue_change_status: Change status
|
||||
label_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
@ -194,4 +192,4 @@ en:
|
||||
label_show_closed_issues: Show closed issues
|
||||
max_live_search_results_info: "Number of maximum search results for LiveSearch. Note: Setting only affects plugins that support LiveSearch."
|
||||
label_max_live_search_results: "Maximum number of LiveSearch results"
|
||||
info_live_search_result_restriction: "LiveSearch results are limited to %{value} entries. Try to filter your search a better way."
|
||||
info_live_search_result_restriction: "LiveSearch results are limited to %{value} entries. Try to filter your search a better way."
|
||||
|
@ -37,7 +37,6 @@ es:
|
||||
error_query_statement_invalid: Ocurrió un error ejecutando la consulta y fue registrado. Por favor informe este error al administrador de Redmine.
|
||||
errors_no_or_invalid_arguments: Parámetros inválidos
|
||||
field_always_expose: "Mostrar siempre el nombre del salpicadero"
|
||||
field_autowatch_involved_issue: Automonitorear las peticiones en las que estoy involucrado
|
||||
field_color: Color
|
||||
field_enable_sidebar: Enable sidebar
|
||||
field_hide: "Ocultar"
|
||||
@ -96,7 +95,6 @@ es:
|
||||
label_invalid_feed_data: "Datos o URL de alimentación inválidos"
|
||||
label_issue_assign_to_me: Mostrar "Asignar a mi mismo" en las peticiones
|
||||
label_issue_auto_assign: "Si \"Asignado a\" no es asignado a un usuario y el estado de la nueva petición es x, entonces la petición es auto asignada al primer grupo con usuarios del rol predefinido."
|
||||
label_issue_autowatch_involved: Agregar a los usuarios involucrados como Monitorizadores automáticamente
|
||||
label_issue_change_status_in_sidebar: Estado de las peticiones en la barra lateral
|
||||
label_issue_change_status: Cambiar estado
|
||||
label_issue_current_user_status: "Estado de la petición actual x solo está permitido si la petición está asignada al usuario actual."
|
||||
|
@ -37,7 +37,6 @@ fr:
|
||||
error_query_statement_invalid: "Une erreur s'est produite lors de l'exécution de la requête et a été enregistrée. Veuillez signaler cette erreur à votre administrateur Redmine."
|
||||
errors_no_or_invalid_arguments: "Pas d'arguments ou arguments invalides"
|
||||
field_always_expose: "Toujours afficher le nom du tableau de bord"
|
||||
field_autowatch_involved_issue: "Problèmes liés à la surveillance automatique"
|
||||
field_color: Couleur
|
||||
field_enable_sidebar: Activer le menu latéral
|
||||
field_hide: "Cacher"
|
||||
@ -96,7 +95,6 @@ fr:
|
||||
label_invalid_feed_data: "Données d'alimentation ou URL invalides"
|
||||
label_issue_assign_to_me: Voir "M'affecter" sur les tâches
|
||||
label_issue_auto_assign: "If \"Assigned to\" is not assigned to a user and the new issue status is x then the issue is auto assigned to the first group with users of the pre-defined role."
|
||||
label_issue_autowatch_involved: "Ajout automatique des utilisateurs impliqués en tant qu'observateurs"
|
||||
label_issue_change_status_in_sidebar: Statuts des tâches dans la bare latérale
|
||||
label_issue_change_status: Modifier le statut
|
||||
label_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
|
@ -37,7 +37,6 @@ it:
|
||||
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
|
||||
errors_no_or_invalid_arguments: No o non valido argomenti
|
||||
field_always_expose: "Mostra sempre il nome del portale"
|
||||
field_autowatch_involved_issue: Autowatch involved issues
|
||||
field_color: Colore
|
||||
field_enable_sidebar: Enable sidebar
|
||||
field_hide: "Nascondi"
|
||||
@ -96,7 +95,6 @@ it:
|
||||
label_invalid_feed_data: "Dati di alimentazione o URL non validi"
|
||||
label_issue_assign_to_me: Show "Assign to me" on issue
|
||||
label_issue_auto_assign: "If \"Assigned to\" is not assigned to a user and the new issue status is x then the issue is auto assigned to the first group with users of the pre-defined role."
|
||||
label_issue_autowatch_involved: Add involved users as watcher automatically
|
||||
label_issue_change_status_in_sidebar: Issue status on sidebar
|
||||
label_issue_change_status: Modifica issue stato
|
||||
label_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
|
@ -37,7 +37,6 @@ ja:
|
||||
error_query_statement_invalid: "クエリの実行中にエラーが発生し、ログに記録されました。このエラーをRedmine管理者に報告してください。"
|
||||
errors_no_or_invalid_arguments: "引数がない、または無効な引数"
|
||||
field_always_expose: "ダッシュボード名を常に表示する"
|
||||
field_autowatch_involved_issue: Autowatch involved issues
|
||||
field_color: Color
|
||||
field_enable_sidebar: Enable sidebar
|
||||
field_hide: Hide
|
||||
@ -96,7 +95,6 @@ ja:
|
||||
label_invalid_feed_data: "無効なフィードデータまたはURL"
|
||||
label_issue_assign_to_me: Show "Assign to me" on issue
|
||||
label_issue_auto_assign: "If \"Assigned to\" is not assigned to a user and the new issue status is x then the issue is auto assigned to the first group with users of the pre-defined role."
|
||||
label_issue_autowatch_involved: Add involved users as watcher automatically
|
||||
label_issue_change_status_in_sidebar: Issue status on sidebar
|
||||
label_issue_change_status: Change status
|
||||
label_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
|
@ -37,7 +37,6 @@ ko:
|
||||
error_query_statement_invalid: "쿼리를 실행하는 동안 오류가 발생하여 기록되었습니다. 이 오류를 Redmine 관리자에게보고하십시오."
|
||||
errors_no_or_invalid_arguments: "인수가 없거나 유효하지 않습니다"
|
||||
field_always_expose: "항상 대시보드 이름 표시"
|
||||
field_autowatch_involved_issue: "오토 워치 관련 문제"
|
||||
field_color: 색깔
|
||||
field_enable_sidebar: 사이드바 표시
|
||||
field_hide: 숨는 장소
|
||||
@ -96,7 +95,6 @@ ko:
|
||||
label_invalid_feed_data: "Invalid feed data or URL"
|
||||
label_issue_assign_to_me: Show "Assign to me" on issue
|
||||
label_issue_auto_assign: "If \"Assigned to\" is not assigned to a user and the new issue status is x then the issue is auto assigned to the first group with users of the pre-defined role."
|
||||
label_issue_autowatch_involved: 관련 사용자를 감시자로 자동 추가
|
||||
label_issue_change_status_in_sidebar: 사이드 바의 발행 상태
|
||||
label_issue_change_status: 상태 변경
|
||||
label_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
|
@ -37,7 +37,6 @@ pl:
|
||||
error_query_statement_invalid: "Wystąpił błąd podczas wykonywania zapytania i został zarejestrowany. Proszę zgłosić ten błąd administratorowi Redmine."
|
||||
errors_no_or_invalid_arguments: "Brak lub nieważne argumenty"
|
||||
field_always_expose: "Zawsze pokazuj nazwę pulpitu"
|
||||
field_autowatch_involved_issue: Autowatch involved issues
|
||||
field_color: Kolor
|
||||
field_enable_sidebar: Enable sidebar
|
||||
field_hide: "Ukryć się"
|
||||
@ -96,7 +95,6 @@ pl:
|
||||
label_invalid_feed_data: "Invalid feed data or URL"
|
||||
label_issue_assign_to_me: Show "Assign to me" on issue
|
||||
label_issue_auto_assign: "If \"Assigned to\" is not assigned to a user and the new issue status is x then the issue is auto assigned to the first group with users of the pre-defined role."
|
||||
label_issue_autowatch_involved: "Dodawanie zaangażowanych użytkowników jako obserwatorów automatycznie"
|
||||
label_issue_change_status_in_sidebar: "Status Issue na pasku bocznym"
|
||||
label_issue_change_status: "Zmiana statusu"
|
||||
label_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
|
@ -37,7 +37,6 @@ pt-BR:
|
||||
error_query_statement_invalid: "Ocorreu um erro durante a execução da consulta e foi registrado. Favor reportar este erro ao seu administrador Redmine."
|
||||
errors_no_or_invalid_arguments: "Nenhum argumento ou argumentos inválidos"
|
||||
field_always_expose: "Mostrar sempre o nome do painel de bordo"
|
||||
field_autowatch_involved_issue: "Tarefa envolvida no Autowatch"
|
||||
field_color: "Cor"
|
||||
field_enable_sidebar: "Habilitar barra lateral"
|
||||
field_hide: "Esconder"
|
||||
@ -96,7 +95,6 @@ pt-BR:
|
||||
label_invalid_feed_data: "Dados de alimentação inválidos ou URL"
|
||||
label_issue_assign_to_me: "Mostrar \"Designar para mim\" em questão"
|
||||
label_issue_auto_assign: "Se \"Atribuído a\" não é atribuído a um usuário e o novo status de emissão é x então a emissão é automaticamente atribuída ao primeiro grupo com usuários da função pré-definida."
|
||||
label_issue_autowatch_involved: "Adicionar automaticamente os usuários envolvidos como observadores"
|
||||
label_issue_change_status_in_sidebar: "Status da tarefa na barra lateral"
|
||||
label_issue_change_status: "Mudança de status"
|
||||
label_issue_current_user_status: "O status atual de tarifa x só é permitido se \"Assignee\" for o usuário atual."
|
||||
|
@ -37,7 +37,6 @@ ru:
|
||||
error_query_statement_invalid: "Во время выполнения запроса возникла ошибка, которая была зарегистрирована в журнале. Пожалуйста, сообщите об этой ошибке своему администратору Redmine."
|
||||
errors_no_or_invalid_arguments: "Нет или недействительные аргументы"
|
||||
field_always_expose: "Всегда показать название приборной панели"
|
||||
field_autowatch_involved_issue: "Автонаблюдение включало в себя задачу"
|
||||
field_color: Color
|
||||
field_enable_sidebar: Enable sidebar
|
||||
field_hide: "Спрятать"
|
||||
@ -96,7 +95,6 @@ ru:
|
||||
label_invalid_feed_data: "Недействительные данные корма или URL-адрес"
|
||||
label_issue_assign_to_me: Show "Assign to me" on issue
|
||||
label_issue_auto_assign: "If \"Assigned to\" is not assigned to a user and the new issue status is x then the issue is auto assigned to the first group with users of the pre-defined role."
|
||||
label_issue_autowatch_involved: "Автоматическое добавление привлеченных пользователей в качестве наблюдателя"
|
||||
label_issue_change_status_in_sidebar: Issue status on sidebar
|
||||
label_issue_change_status: "Изменить статус"
|
||||
label_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
|
@ -37,7 +37,6 @@
|
||||
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
|
||||
errors_no_or_invalid_arguments: "參數無效或不存在。"
|
||||
field_always_expose: "始终显示仪表盘名称"
|
||||
field_autowatch_involved_issue: "自動監看參與的議題"
|
||||
field_color: 顏色
|
||||
field_enable_sidebar: Enable sidebar
|
||||
field_hide: Hide
|
||||
@ -96,7 +95,6 @@
|
||||
label_invalid_feed_data: "Invalid feed data or URL"
|
||||
label_issue_assign_to_me: Show "Assign to me" on issue
|
||||
label_issue_auto_assign: "若建立新議題的 \"被分派者\" 未設定,且狀態為 X 時,將被自動分派給指定角色。"
|
||||
label_issue_autowatch_involved: "自動設定參與者為監看者"
|
||||
label_issue_change_status_in_sidebar: Issue status on sidebar
|
||||
label_issue_change_status: Change status
|
||||
label_issue_current_user_status: " \"被分派者\"為目前用戶時,議題狀態只能被設定為 X 。"
|
||||
|
@ -37,7 +37,6 @@ zh:
|
||||
error_query_statement_invalid: 执行查询时出错且已被记录。请向你的 Redmine 管理员报告此错误。
|
||||
errors_no_or_invalid_arguments: 参数无效或不存在。
|
||||
field_always_expose: 始终显示仪表盘名称
|
||||
field_autowatch_involved_issue: 自动关注参与的问题
|
||||
field_color: 颜色
|
||||
field_enable_sidebar: 启用侧边栏
|
||||
field_hide: 隐藏
|
||||
@ -96,7 +95,6 @@ zh:
|
||||
label_invalid_feed_data: "无效的 feed 数据或 URL"
|
||||
label_issue_assign_to_me: 在问题页显示“指派给我”
|
||||
label_issue_auto_assign: "若 \"指派给\" 的值未设置为具体用户,且新建问题的状态为 X, 那么问题将自动指派给预定义角色用户的对应组。"
|
||||
label_issue_autowatch_involved: 自动添加涉及到的用户为关注者
|
||||
label_issue_change_status_in_sidebar: 在侧边栏显示更新问题状态
|
||||
label_issue_change_status: 更新问题状态
|
||||
label_issue_current_user_status: "当前问题状态 X 仅在 \"指派给\" 的值设置为当前用户时生效。"
|
||||
|
@ -14,7 +14,6 @@ issue_assign_to_x: ''
|
||||
issue_auto_assign_role: ''
|
||||
issue_auto_assign_status: ''
|
||||
issue_auto_assign: 0
|
||||
issue_autowatch_involved: 0
|
||||
issue_change_status_in_sidebar: 0
|
||||
issue_current_user_status: 0
|
||||
issue_freezed_with_close: 0
|
||||
|
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RemoveAutowatchInvolvedIssueFromUser < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
remove_column :user_preferences, :autowatch_involved_issue, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
@ -150,7 +150,6 @@ Features
|
||||
* anonymize referrer for external urls
|
||||
* hide role in project memberbox
|
||||
* change issue author
|
||||
* add involved issue users as watcher automatically
|
||||
* create issue on user profile
|
||||
* "assign to me" link on issue
|
||||
* change issue state on sidebar
|
||||
|
@ -99,8 +99,7 @@ module Additionals
|
||||
RenderAsync.configuration.jquery = true
|
||||
|
||||
loader.incompatible? %w[redmine_editauthor
|
||||
redmine_changeauthor
|
||||
redmine_auto_watch]
|
||||
redmine_changeauthor]
|
||||
|
||||
loader.add_patch %w[ApplicationController
|
||||
AutoCompletesController
|
||||
|
@ -17,8 +17,6 @@ module Additionals
|
||||
render_on :view_issues_new_top, partial: 'new_ticket_message'
|
||||
render_on :view_issues_sidebar_issues_bottom, partial: 'issues/additionals_sidebar_issues'
|
||||
render_on :view_issues_sidebar_queries_bottom, partial: 'issues/additionals_sidebar_queries'
|
||||
render_on :view_my_account_preferences, partial: 'users/autowatch_involved_issue'
|
||||
render_on :view_users_form_preferences, partial: 'users/autowatch_involved_issue'
|
||||
render_on :view_users_show_contextual, partial: 'users/additionals_contextual'
|
||||
render_on :view_wiki_show_sidebar_bottom, partial: 'wiki/additionals_sidebar'
|
||||
|
||||
|
@ -13,8 +13,7 @@ module Additionals
|
||||
validate :validate_timelog_required
|
||||
validate :validate_current_user_status
|
||||
before_validation :auto_assigned_to
|
||||
before_save :change_status_with_assigned_to_change,
|
||||
:autowatch_involved
|
||||
before_save :change_status_with_assigned_to_change
|
||||
|
||||
safe_attributes 'author_id',
|
||||
if: proc { |issue, user|
|
||||
@ -64,21 +63,6 @@ module Additionals
|
||||
add_watcher user
|
||||
end
|
||||
|
||||
def autowatch_involved
|
||||
return unless Additionals.setting?(:issue_autowatch_involved) &&
|
||||
User.current.pref.autowatch_involved_issue
|
||||
return if AdditionalsPlugin.active_automation? && author_id == RedmineAutomation.bot_user_id
|
||||
|
||||
add_autowatcher User.current
|
||||
add_autowatcher author if (new_record? || author_id != author_id_was) && author != User.current
|
||||
|
||||
if !assigned_to_id.nil? && assigned_to_id != User.current.id && (new_record? || assigned_to_id != assigned_to_id_was)
|
||||
add_autowatcher assigned_to
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def log_time_allowed?(user = User.current)
|
||||
!status_was.is_closed || user.allowed_to?(:log_time_on_closed_issues, project)
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ module Additionals
|
||||
|
||||
included do
|
||||
include InstanceMethods
|
||||
safe_attributes 'autowatch_involved_issue', 'recently_used_dashboards'
|
||||
safe_attributes 'recently_used_dashboards'
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
|
@ -151,20 +151,23 @@ module Additionals
|
||||
assert_equal list1.sort, list2.sort
|
||||
end
|
||||
|
||||
def assert_query_sort_order(table_css, column, action: nil, list_columns: [])
|
||||
def assert_query_sort_order(table_css, column, action: nil, list_columns: [], params: {})
|
||||
action = :index if action.blank?
|
||||
column = column.to_s
|
||||
column_css = column.tr('_', '-').gsub('.', '\.')
|
||||
columns = (list_columns << column).uniq
|
||||
|
||||
get action,
|
||||
params: { sort: "#{column}:asc", c: columns }
|
||||
params[:sort] = "#{column}:asc"
|
||||
params[:c] = columns
|
||||
|
||||
get action, params: params
|
||||
|
||||
assert_response :success
|
||||
assert_select "table.list.#{table_css}.sort-by-#{column_css}.sort-asc"
|
||||
|
||||
get action,
|
||||
params: { set_filter: 1, sort: "#{column}:desc", c: columns }
|
||||
params[:sort] = "#{column}:desc"
|
||||
|
||||
get action, params: params
|
||||
|
||||
assert_response :success
|
||||
assert_select "table.list.#{table_css}.sort-by-#{column_css}.sort-desc"
|
||||
|
@ -1,106 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class WatcherTest < Additionals::TestCase
|
||||
fixtures :projects, :users, :email_addresses, :members, :member_roles, :roles, :enabled_modules,
|
||||
:issues, :issue_statuses, :enumerations, :trackers, :projects_trackers,
|
||||
:boards, :messages,
|
||||
:wikis, :wiki_pages,
|
||||
:watchers
|
||||
|
||||
def setup
|
||||
prepare_tests
|
||||
@author = users :users_001
|
||||
@assigned_user = users :users_002
|
||||
@changing_user = users :users_004
|
||||
end
|
||||
|
||||
def test_new_issue_with_no_autowatch
|
||||
with_plugin_settings 'additionals', issue_autowatch_involved: 0 do
|
||||
User.current = @author
|
||||
issue = Issue.generate author_id: @author.id
|
||||
issue.save
|
||||
assert_equal 0, issue.watchers.count
|
||||
assert_not issue.watched_by?(@author)
|
||||
end
|
||||
end
|
||||
|
||||
def test_new_issue_with_no_autowatch_by_user
|
||||
with_plugin_settings 'additionals', issue_autowatch_involved: 1 do
|
||||
User.current = @author
|
||||
User.current.pref.update_attribute :autowatch_involved_issue, false
|
||||
|
||||
issue = Issue.generate author_id: @author.id
|
||||
issue.save
|
||||
assert_equal 0, issue.watchers.count
|
||||
assert_not issue.watched_by?(@author)
|
||||
end
|
||||
end
|
||||
|
||||
def test_new_issue_with_author_watch_only
|
||||
with_plugin_settings 'additionals', issue_autowatch_involved: 1 do
|
||||
User.current = @author
|
||||
issue = Issue.generate author_id: @author.id
|
||||
issue.save
|
||||
assert_equal 1, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
end
|
||||
end
|
||||
|
||||
def test_new_issue_with_author_and_assigned_to_watchers
|
||||
with_plugin_settings 'additionals', issue_autowatch_involved: 1 do
|
||||
User.current = @author
|
||||
issue = Issue.generate author_id: @author.id, assigned_to: @assigned_user
|
||||
issue.save
|
||||
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
assert issue.watched_by?(@assigned_user)
|
||||
end
|
||||
end
|
||||
|
||||
def test_issue_do_not_add_author_with_user_change
|
||||
with_plugin_settings 'additionals', issue_autowatch_involved: 1 do
|
||||
User.current = @author
|
||||
|
||||
issue = Issue.generate author_id: @author.id, assigned_to: @assigned_user
|
||||
issue.save
|
||||
assert_equal 2, issue.watchers.count
|
||||
|
||||
issue.remove_watcher @author
|
||||
issue.reload
|
||||
assert_equal 1, issue.watchers.count
|
||||
|
||||
User.current = @changing_user
|
||||
issue.subject = 'Changing....'
|
||||
issue.save
|
||||
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@changing_user)
|
||||
assert issue.watched_by?(@assigned_user)
|
||||
end
|
||||
end
|
||||
|
||||
def test_issue_do_not_add_assigned_to_with_user_change
|
||||
with_plugin_settings 'additionals', issue_autowatch_involved: 1 do
|
||||
User.current = @author
|
||||
|
||||
issue = Issue.generate author_id: @author.id, assigned_to: @assigned_user
|
||||
issue.save
|
||||
assert_equal 2, issue.watchers.count
|
||||
|
||||
issue.remove_watcher @assigned_user
|
||||
issue.reload
|
||||
assert_equal 1, issue.watchers.count
|
||||
|
||||
User.current = @changing_user
|
||||
issue.subject = 'Changing....'
|
||||
issue.save
|
||||
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
assert issue.watched_by?(@changing_user)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user