プロジェクト

全般

プロフィール

Vote #76488

完了

Disallow users to delete a version referenced by a custom field

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Project settings_43
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
43
version_id:
90
issue_org_id:
20159
author_id:
79606
assigned_to_id:
1
comments:
1
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Redmine disallows users to delete a version targeted on an issue. However, verification is not done if the version is referenced throw a custom field. It results on a crash trying to show an issue that "uses" the deleted target.

  • Bug seen in version 2.5.1.
  • Patch applied on:

    commit 0cac2b85b325e00c861b2c9a0e94407ed0bb077b
    Author: Toshi MARUYAMA 
    Date:   Sun Jun 21 09:51:52 2015 +0000
    
    Merged r14360 from trunk to 2.6-stable (#20142)
    
    update Gemfile to require rbpdf ~>1.18.6.
    
    git-svn-id: http://svn.redmine.org/redmine/branches/2.6-stable@14362 e93f8b46-1217-0410-a6f0-8f06a7374b81
    
  • diff:


    diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
    index bc3852f..b8056ec 100644
    --- a/app/controllers/versions_controller.rb
    +++ b/app/controllers/versions_controller.rb
    @@ -146,7 +146,7 @@ class VersionsController < ApplicationController
    end

def destroy

  • if @version.fixed_issues.empty?
  • if @version.fixed_issues.empty? and !@version.referenced_by_a_custom_field?
    @version.destroy
    respond_to do |format|
    format.html { redirect_back_or_default settings_project_path(@project, :tab => 'versions') }
    diff --git a/app/models/version.rb b/app/models/version.rb
    index ed5b628..3df4caa 100644
    --- a/app/models/version.rb
    +++ b/app/models/version.rb
    @@ -168,6 +168,13 @@ class Version < ActiveRecord::Base
    @closed_issues_count
    end

  • def referenced_by_a_custom_field?

  • !CustomValue.where("custom_field_id IN (SELECT id

  •                                        FROM #{CustomField.table_name}
    
  •                                        WHERE field_format='version')
    
  •                    AND value = ?", id).empty?
    
  • end
    +
    def wiki_page
    if project.wiki && !wiki_page_title.blank?
    @wiki_page ||= project.wiki.find_page(wiki_page_title)


journals

Fixed in r14376. The patch was refactored a bit and tests were added.
Thanks for pointing this out.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリProject settings_43 にセット
  • 対象バージョン3.1.0_90 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0