diff --git a/app/assets/stylesheets/rooms.scss b/app/assets/stylesheets/rooms.scss index edcbbffb..0be50823 100644 --- a/app/assets/stylesheets/rooms.scss +++ b/app/assets/stylesheets/rooms.scss @@ -74,3 +74,12 @@ align-items: center; justify-content: center; } + +.avatar-xxxl{ + width: 8rem; + height: 8rem; + line-height: 8rem; + max-width: 8rem; + margin-top: -6rem; + font-size: 5rem; +} diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 06e3262d..1c0867cf 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -66,6 +66,7 @@ class RoomsController < ApplicationController @pagy, @recordings = pagy_array(recs) else + @recent_rooms = Room.where(id: cookies.encrypted["#{current_user.uid}_recently_joined_rooms"]) render :cant_create_rooms end else @@ -130,6 +131,13 @@ class RoomsController < ApplicationController # create or update cookie with join name cookies.encrypted[:greenlight_name] = @join_name unless cookies.encrypted[:greenlight_name] == @join_name + if current_user + # create or update cookie to track the three most recent rooms a user joined + recently_joined_rooms = cookies.encrypted["#{current_user.uid}_recently_joined_rooms"].to_a + cookies.encrypted["#{current_user.uid}_recently_joined_rooms"] = recently_joined_rooms.prepend(@room.id) + .uniq[0..2] + end + join_room(opts) end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ce0b5fa2..ba652695 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -303,8 +303,8 @@ class UsersController < ApplicationController end # Send promoted/demoted emails - added_roles.each { |role| send_user_promoted_email(@user, role.name) if role.send_promoted_email } - removed_roles.each { |role| send_user_demoted_email(@user, role.name) if role.send_demoted_email } + added_roles.each { |role| send_user_promoted_email(@user, role) if role.send_promoted_email } + removed_roles.each { |role| send_user_demoted_email(@user, role) if role.send_demoted_email } # Update the roles @user.roles.delete(removed_roles) diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index b080fd83..125108b7 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -17,6 +17,8 @@ # with BigBlueButton; if not, see . class UserMailer < ApplicationMailer + include ApplicationHelper + default from: Rails.configuration.smtp_sender def verify_email(user, url, image, color) @@ -40,8 +42,8 @@ class UserMailer < ApplicationMailer @admin_url = url + "admins" @image = image @color = color - @role = role - mail to: user.email, subject: t('mailer.user.promoted.subtitle', role: role) + @role = role.name + mail to: user.email, subject: t('mailer.user.promoted.subtitle', role: translated_role_name(role)) end def user_demoted(user, role, url, image, color) @@ -49,8 +51,8 @@ class UserMailer < ApplicationMailer @root_url = url @image = image @color = color - @role = role - mail to: user.email, subject: t('mailer.user.demoted.subtitle', role: role) + @role = role.name + mail to: user.email, subject: t('mailer.user.demoted.subtitle', role: translated_role_name(role)) end def invite_email(name, email, url, image, color) diff --git a/app/views/rooms/cant_create_rooms.html.erb b/app/views/rooms/cant_create_rooms.html.erb index dd314f88..12747d60 100644 --- a/app/views/rooms/cant_create_rooms.html.erb +++ b/app/views/rooms/cant_create_rooms.html.erb @@ -18,25 +18,59 @@
-
-
-
-
-

<%= t("room.no_room.title") %>

+
+
+
+
+
+
+ <% if current_user.image.blank? %> + <%= current_user.name.first %> + <% else %> + <%= image_tag(current_user.image, class: "avatar avatar-xxxl card-profile-img") %> + <% end %> +

<%= current_user.name %>

+ <%= link_to edit_user_path(current_user), class: "btn btn-outline-primary mt-2" do %> + <%= t("room.no_room.edit_profile") %> + <% end %> +
+
-
-

<%= t("room.no_room.description") %>

- <%= form_for(:join_room, url: join_room_path) do |f| %> -
- - - - <%= f.text_field :url, class: "form-control", value: "", placeholder: t("room.no_room.placeholder"), required: "" %> +
+
+
+
+

<%= t("room.no_room.title") %>

-
- <%= f.submit t("room.join"), class:"btn btn-primary btn-block" %> +
+

<%= t("room.no_room.description") %>

+ <%= form_for(:join_room, url: join_room_path, html: {class: "w-75"}) do |f| %> +
+ + + + <%= f.text_field :url, class: "form-control", value: "", placeholder: t("room.no_room.placeholder"), required: "" %> +
+
+ <%= f.submit t("room.no_room.go_to"), class:"btn btn-primary btn-block" %> +
+ <% end %>
- <% end %> +
+
+
    +
  • <%= t("room.no_room.recent_rooms") %>
  • + <% @recent_rooms.each do |room| %> + <%= link_to room_path(room), class: "list-group-item list-group-item-action dropdown-item" do %> + <%= room.owner.name + " " + room.name %> + <% end %> + <% end %> + <% if @recent_rooms.count == 0 %> +
  • <%= t("room.no_room.no_recent_rooms") %>
  • + <% end %> +
+
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index f4212d47..fbf15dce 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -412,10 +412,14 @@ en: login: Enter owner: Owner no_room: - title: Join a Room description: Enter the room url or the room id for the room you want to join. + edit_profile: Edit User Profile + go_to: Go to the Room invalid_room_uid: The room url/uid you entered was invalid. placeholder: Room url/uid + no_recent_rooms: You don't have any recently joined rooms + recent_rooms: Go To a Recently Joined Room + title: Join a Room no_sessions: This room has no sessions, yet! recordings: Room Recordings room_limit: You have reached the maximum number of rooms allowed diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb index 00e6fcae..ae8d1d33 100644 --- a/test/mailers/previews/user_mailer_preview.rb +++ b/test/mailers/previews/user_mailer_preview.rb @@ -53,7 +53,7 @@ class UserMailerPreview < ActionMailer::Preview # http://localhost:3000/rails/mailers/user_mailer/user_promoted def user_promoted user = User.first - role = Role.first.name + role = Role.first url = "http://example.com" logo_image = "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png" user_color = "#467fcf" @@ -64,7 +64,7 @@ class UserMailerPreview < ActionMailer::Preview # http://localhost:3000/rails/mailers/user_mailer/user_demoted def user_demoted user = User.first - role = Role.first.name + role = Role.first url = "http://example.com" logo_image = "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png" user_color = "#467fcf"