GRN2-217: Fixes issues with recording rows and localization (fixed #703-#705) (#707)

* Fixes issues with recording rows

* Fixed small typo related to logs
This commit is contained in:
farhatahmad 2019-07-31 11:45:15 -04:00 committed by Jesus Federico
parent d123d5add0
commit 02b342b157
8 changed files with 23 additions and 20 deletions

View File

@ -24,7 +24,7 @@ class UsersController < ApplicationController
include Recorder
before_action :find_user, only: [:edit, :update, :destroy]
before_action :ensure_unauthenticated, only: [:new, :create]
before_action :ensure_unauthenticated, only: [:new, :create, :signin]
# POST /u
def create

View File

@ -21,7 +21,7 @@ module RecordingsHelper
# Helper for converting BigBlueButton dates into the desired format.
def recording_date(date)
date.strftime("%B #{date.day.ordinalize}, %Y.")
I18n.l date, format: "%B %d, %Y"
end
# Helper for converting BigBlueButton dates into a nice length string.
@ -32,7 +32,7 @@ module RecordingsHelper
len = valid_playbacks.first[:length]
if len > 60
"#{(len / 60).to_i} hrs #{len % 60} mins"
"#{(len / 60).to_i} h #{len % 60} min"
elsif len.zero?
"< 1 min"
else

View File

@ -29,7 +29,7 @@
</div>
</td>
<% if recording_thumbnails? %>
<td>
<td class="overflow-hidden">
<% p = recording[:playbacks].find do |p| p.key?(:preview) end %>
<% if p %>
<% p[:preview][:images][:image].each do |img| %>
@ -39,15 +39,9 @@
</td>
<% end %>
<td id="recording-length" class="text-left" data-full-length="<%=recording[:playbacks].first[:length]%>">
<div class="small text-muted text-uppercase">
<%= t("recording.table.length") %>
</div>
<%= recording_length(recording[:playbacks]) %>
</td>
<td id="recording-users" class="text-left">
<div class="small text-muted text-uppercase">
<%= t("recording.table.users") %>
</div>
<%= recording[:participants] %>
</td>
<td class="text-left">

View File

@ -30,7 +30,7 @@
</div>
</td>
<% if recording_thumbnails? %>
<td>
<td class="overflow-hidden">
<% p = recording[:playbacks].find do |p| p.key?(:preview) end %>
<% if p %>
<% safe_recording_images(p[:preview][:images][:image]).each do |img| %>

View File

@ -51,13 +51,6 @@ Rails.application.configure do
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = (ENV["ENABLE_SSL"] == "true")
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
# Don't wrap form components in field_with_error divs
ActionView::Base.field_error_proc = proc do |html_tag|
html_tag.html_safe
@ -107,8 +100,12 @@ Rails.application.configure do
config.log_formatter = proc do |severity, _time, _progname, msg|
"#{severity}: #{msg} \n"
end
config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
if ENV["RAILS_LOG_TO_STDOUT"] == "true"
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter

View File

@ -113,6 +113,8 @@ en:
cookie_button: I Agree
copied: Copied
copy: Copy
date:
month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
default_admin: You are still using the default password for this account. Please click <a href="%{edit_link}">here</a> to change it
delete: Delete
delivery_error: An error occured during email delivery. Please contact an administrator!

View File

@ -62,6 +62,16 @@ describe UsersController, type: :controller do
end
end
describe "GET #signin" do
it "redirects to main room if already authenticated" do
user = create(:user)
@request.session[:user_id] = user.id
post :signin
expect(response).to redirect_to(room_path(user.main_room))
end
end
describe "GET #edit" do
it "renders the edit template" do
user = create(:user)

View File

@ -22,14 +22,14 @@ describe RecordingsHelper do
describe "#recording_date" do
it "formats the date" do
date = DateTime.parse("2019-03-28 19:35:15 UTC")
expect(helper.recording_date(date)).to eql("March 28th, 2019.")
expect(helper.recording_date(date)).to eql("March 28, 2019")
end
end
describe "#recording_length" do
it "returns the time if length > 60" do
playbacks = [{ type: "test", length: 85 }]
expect(helper.recording_length(playbacks)).to eql("1 hrs 25 mins")
expect(helper.recording_length(playbacks)).to eql("1 h 25 min")
end
it "returns the time if length == 0" do