Project

General

Profile

Actions

Defect #38182

closed

Exporting users query does not use the query name as file name

Added by Go MAEDA almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Accounts / authentication
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

#16207 implemented a feature that uses the query name as a file name when exporting a query, but the fixed name "users.csv" is still used when exporting a users query.

diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index a6cad6b2f..77ec1a601 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -61,7 +61,7 @@ class UsersController < ApplicationController
         format.csv do
           # Export all entries
           @entries = scope.to_a
-          send_data(query_to_csv(@entries, @query, params), :type => 'text/csv; header=present', :filename => 'users.csv')
+          send_data(query_to_csv(@entries, @query, params), :type => 'text/csv; header=present', :filename => "#{filename_for_export(@query, 'users')}.csv")
         end
         format.api do
           @offset, @limit = api_offset_and_limit

Files

38182-with-test.patch (1.71 KB) 38182-with-test.patch Takenori TAKAKI, 2023-02-01 04:06

Related issues

Related to Redmine - Feature #16207: Use query name as the file name when exporting queries ClosedGo MAEDA

Actions
Related to Redmine - Feature #37674: Upgrade Admin/Users list to use the query systemClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA almost 2 years ago

  • Related to Feature #16207: Use query name as the file name when exporting queries added
Actions #2

Updated by Go MAEDA almost 2 years ago

  • Related to Feature #37674: Upgrade Admin/Users list to use the query system added
Actions #3

Updated by Takenori TAKAKI almost 2 years ago

It's a nice improvement that adds consistency to the download file names.
Attached is a patch with test code.

Actions #4

Updated by Go MAEDA almost 2 years ago

  • Target version set to 5.1.0

Setting the target version to 5.1.0.

Actions #5

Updated by Go MAEDA almost 2 years ago

  • Status changed from New to Closed
  • Target version deleted (5.1.0)
  • Resolution set to Fixed

Committed the fix as a part of #37674.

Actions

Also available in: Atom PDF