finish settings and public recordings

This commit is contained in:
Josh
2018-06-12 17:28:02 -04:00
parent 39b687a58f
commit 8390e075e1
14 changed files with 72 additions and 72 deletions

View File

@ -25,9 +25,10 @@ class RoomsController < ApplicationController
# GET /r/:room_uid
def show
if current_user && @room.owned_by?(current_user)
@is_running = @room.is_running?
@recordings = @room.recordings
@is_running = @room.is_running?
else
@recordings = @room.public_recordings
render :join
end
end
@ -97,10 +98,8 @@ class RoomsController < ApplicationController
meta = {
"meta_#{META_LISTED}": (params[:state] == "public")
}
puts '-------------'
puts params[:record_id]
res = @room.update_recording(params[:record_id], meta)
puts res
redirect_to @room if res[:updated]
end

View File

@ -42,6 +42,10 @@ class UsersController < ApplicationController
# Update account information if passed.
@user.name = user_params[:name] if user_params[:name]
@user.email = user_params[:email] if user_params[:email]
@user.image = user_params[:image] if user_params[:image]
# Custom errors not generated by validations.
errors = {}
# Verify that the provided password is correct.
if user_params[:password] && @user.authenticate(user_params[:password])
@ -50,17 +54,20 @@ class UsersController < ApplicationController
@user.password = user_params[:new_password]
else
# New passwords don't match.
errors[:password_confirmation] = "'s don't match"
end
else
# Original password is incorrect, can't update.
errors[:password] = "is incorrect"
end
if @user.save
# Notify the use that their account has been updated.
redirect_to edit_user_path(@user), notice: "Information successfully updated."
else
# Append custom errors.
errors.each do |k, v| @user.errors.add(k, v) end
# Handle validation errors.
render :edit
end
@ -82,6 +89,6 @@ class UsersController < ApplicationController
end
def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation, :new_password, :provider)
params.require(:user).permit(:name, :email, :image, :password, :password_confirmation, :new_password, :provider)
end
end