Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/views/permissions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<th>Account</th>
<th>Intended use</th>
<th>Granted by</th>
<th>First granted</th>
<th>Access until</th>
<th></th>
</tr>
Expand All @@ -38,6 +39,13 @@
</td>
<td><%= permission.intended_use %></td>
<td><%= permission.granted_by&.email %></td>
<td>
<% if permission.created_at %>
<time datetime='<%= permission.created_at.iso8601 %>' title='<%= permission.created_at.to_date.to_fs(:long) %>'>
<%= time_ago_in_words(permission.created_at) %> ago
</time>
<% end %>
</td>
<td>
<% if permission.expires_on.nil? %>
No expiry
Expand Down
6 changes: 4 additions & 2 deletions spec/requests/permissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ def grant(email, expires_in: nil)

it 'shows requests and grants on the datatable page' do
PermissionRequest.create!(user: FactoryBot.create(:user, email: 'asker@example.org'), datatable:)
Permission.create!(datatable:, user: reader, granted_by: admin, expires_on: Date.new(2030, 5, 1))
Permission.create!(datatable:, user: reader, granted_by: admin, expires_on: Date.new(2030, 5, 1),
created_at: 3.months.ago)

get permission_path(datatable)

expect(response.body).to include('asker@example.org has asked', 'reader@example.org', 'May 01, 2030')
expect(response.body).to include('asker@example.org has asked', 'reader@example.org', 'May 01, 2030',
'3 months ago')
end
end

Expand Down