Skip to content

Commit

Permalink
Merge branch 'master' into add-roles-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jfederico authored Jul 31, 2019
2 parents cafabf3 + 02b342b commit 6fc3e1c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/recordings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -32,7 +32,7 @@ def recording_length(playbacks)

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
Expand Down
8 changes: 1 addition & 7 deletions app/views/shared/components/_public_recording_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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| %>
Expand All @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/components/_recording_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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| %>
Expand Down
11 changes: 4 additions & 7 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@
# 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
Expand Down Expand Up @@ -107,8 +100,12 @@
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
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,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!
Expand Down
10 changes: 10 additions & 0 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ def random_valid_user_params
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)
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/recordings_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
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
Expand Down

0 comments on commit 6fc3e1c

Please sign in to comment.