File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,14 @@ module RedmineGttPrint
6
6
# server.
7
7
#
8
8
class IssueToJson
9
+ include Rails . application . routes . url_helpers
10
+
11
+ # what works in the mailer is good enough for the image URL generation as
12
+ # well
13
+ def default_url_options
14
+ ::Mailer . default_url_options
15
+ end
16
+
9
17
def initialize ( issue , layout , other_attributes = { } )
10
18
@issue = issue
11
19
@layout = layout
@@ -34,7 +42,7 @@ def call
34
42
def image_urls ( issue )
35
43
issue . attachments . map do |a |
36
44
if a . image?
37
- " #{ Setting . protocol } :// #{ Setting . host_name } /attachments/download/ #{ a . id } / #{ a . filename } "
45
+ download_named_attachment_url ( a , a . filename , key : User . current . api_key )
38
46
end
39
47
end . compact
40
48
end
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ class IssueToJsonTest < ActiveSupport::TestCase
43
43
assert j = RedmineGttPrint ::IssueToJson . ( i , 'layout' )
44
44
assert h = JSON . parse ( j )
45
45
assert_equal i . subject , h [ 'attributes' ] [ 'subject' ]
46
+ assert h [ 'attributes' ] [ 'image_url_1' ] . present?
46
47
assert_nil h [ 'attributes' ] [ 'map' ]
47
48
end
48
49
You can’t perform that action at this time.
0 commit comments