Skip to content

Commit

Permalink
Merge branch 'main' into sp23-main
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead authored Feb 13, 2024
2 parents 9da4771 + 8d45808 commit aed239e
Show file tree
Hide file tree
Showing 61 changed files with 371 additions and 315 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/next-rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
echo "BUNDLE_CACHE_PATH=vendor/cache.next" >> $GITHUB_ENV
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.3
ruby-version: 3.2.2
bundler-cache: true
- name: Prepare spec
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.3
ruby-version: 3.2.2
bundler-cache: true
# - name: Run Pronto
# run: bundle exec pronto run
Expand All @@ -39,7 +39,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.3
ruby-version: 3.2.2
bundler-cache: true
- name: Use Node.js
uses: actions/setup-node@v1
Expand Down
16 changes: 4 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,17 @@ capybara-*.html
**.orig
rerun.txt
pickle-email-*.html
*~
/public/assets
/bundle
/doc/app
.vagrant/
.env
.env.production
.env.development
.env.test
.env.local
.envrc
.env*
docker-compose.override.yml
.DS_Store

.byebug_history
.buildconfig
osem_development
osem_test
config/local_env.yml

# From GitHub, for Ruby
# https://github.com/github/gitignore/blob/master/Ruby.gitignore
Expand All @@ -77,10 +70,9 @@ config/local_env.yml
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env
# ensure the folder exists for puma
!tmp/pids/.keep

# Ignore Byebug command history file.
.byebug_history
Expand Down
2 changes: 2 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Metrics/AbcSize:
# IgnoredMethods: refine
Metrics/BlockLength:
Max: 226
Exclude:
- 'config/routes.rb'

# Offense count: 14
# Configuration parameters: CountComments, CountAsOne.
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.3
3.2.2
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ruby 3.2.2
nodejs latest:12
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end

source 'https://rubygems.org'

ruby ENV.fetch('OSEM_RUBY_VERSION', '3.1.3')
ruby ENV.fetch('OSEM_RUBY_VERSION', '3.2.2')

# rails-assets requires >= 1.8.4
abort 'Bundler version >= 1.8.4 is required' if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4')
Expand Down Expand Up @@ -291,8 +291,8 @@ end
group :development, :test, :linters do
# as debugger
gem 'byebug'
gem 'pry'
gem 'pry-byebug'
# gem 'pry'
# gem 'pry-byebug'

# Linters and static analysis.
gem 'faraday-retry', require: false
Expand Down
34 changes: 15 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ GEM
awesome_nested_set (>= 3.0)
acts_as_list (1.0.4)
activerecord (>= 4.2)
addressable (2.8.1)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
afm (0.2.2)
ajax-datatables-rails (1.3.1)
Expand Down Expand Up @@ -141,7 +141,7 @@ GEM
uniform_notifier (~> 1.11)
byebug (11.1.3)
cancancan (3.3.0)
capybara (3.37.1)
capybara (3.39.2)
addressable
matrix
mini_mime (>= 0.1.3)
Expand Down Expand Up @@ -427,12 +427,12 @@ GEM
netrc (0.11.0)
next_rails (1.1.0)
colorize (>= 0.8.1)
nio4r (2.5.8)
nokogiri (1.14.3-arm64-darwin)
nio4r (2.5.9)
nokogiri (1.15.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-darwin)
nokogiri (1.15.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-linux)
nokogiri (1.15.3-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
Expand Down Expand Up @@ -517,20 +517,17 @@ GEM
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
public_suffix (5.0.1)
puma (5.6.4)
public_suffix (5.0.3)
puma (6.3.0)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.4)
racc (1.7.1)
rack (2.2.7)
rack-openid (1.4.2)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-protection (2.2.0)
rack
rack-test (2.0.2)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.4.2)
actioncable (= 7.0.4.2)
Expand Down Expand Up @@ -574,7 +571,7 @@ GEM
json
redcarpet (3.5.1)
redis (4.7.1)
regexp_parser (2.5.0)
regexp_parser (2.8.1)
request_store (1.5.1)
rack (>= 1.4)
responders (3.0.1)
Expand Down Expand Up @@ -750,7 +747,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.7.0)
webrick (1.8.1)
websocket (1.2.9)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
Expand All @@ -763,6 +760,7 @@ GEM

PLATFORMS
arm64-darwin-22
arm64-darwin-23
x86_64-darwin-21
x86_64-darwin-22
x86_64-linux
Expand Down Expand Up @@ -842,8 +840,6 @@ DEPENDENCIES
pronto
pronto-haml
pronto-rubocop
pry
pry-byebug
puma
rails (~> 7.0)
rails-assets-bootstrap!
Expand Down Expand Up @@ -899,7 +895,7 @@ DEPENDENCIES
whenever

RUBY VERSION
ruby 3.1.3
ruby 3.2.2

BUNDLED WITH
2.3.26
2 changes: 1 addition & 1 deletion Gemfile.next.lock
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ DEPENDENCIES
whenever

RUBY VERSION
ruby 3.1.3p185
ruby 3.2.2p185

BUNDLED WITH
2.3.26
4 changes: 3 additions & 1 deletion INSTALL_SNAPCON.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ To run Snap!Con, using [Overmind](https://github.com/DarthSim/overmind) or [Fore
## Heroku Deployment
**TODO:** Update this section...
When deploying to Heroku, the `heroku/nodejs` buildpack must be run before the `heroku/ruby` buildpack. Since Snap!Con runs on PostgreSQL, the Postgres add-on must also be added to the Heroku deployment.
Finally, it may be necessary to downgrade the Heroku stack to `heroku-22`. Details on how to downgrade can be found [in this Heroku article](https://devcenter.heroku.com/articles/heroku-18-stack#using-heroku-18).
Heroku Stack: `heroku-22`
### Example Data
Example data can easily be generated by running `rake data:demo`. Please note that this command can fail if the database is not fresh.
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/osem-schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function starClicked(e) {
if (e.stopPropagation) e.stopPropagation();

var callback = function(data) {
$(e.target).toggleClass('fa-star fa-star-o');
$(e.target).toggleClass('fa-solid fa-regular');
}

var params = { favourite_user_id: $(e.target).data('user') };
Expand Down Expand Up @@ -159,7 +159,7 @@ function updateFavouriteStatus(options) {
}

options.events.forEach(function (id) {
$(`#eventFavourite-${id}`).removeClass('fa-star-o').addClass('fa-star');
$(`#eventFavourite-${id}`).removeClass('fa-regular').addClass('fa-solid');
});
}

Expand Down
5 changes: 5 additions & 0 deletions app/assets/stylesheets/osem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,8 @@ p.comment-body {
.word_break {
word-wrap: break-word;
}

// Override bootstrap 3...
hr {
border-top: 1px solid #333;
}
10 changes: 8 additions & 2 deletions app/controllers/admin/ticket_scannings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ module Admin
class TicketScanningsController < Admin::BaseController
before_action :authenticate_user!
load_resource :physical_ticket, find_by: :token
# We authorize manually in these actions
skip_authorize_resource only: [:create]

def create
if !@physical_ticket && params[:physical_ticket]
@physical_ticket = PhysicalTicket.find_by(token: params[:physical_ticket][:token])
end
@ticket_scanning = TicketScanning.new(physical_ticket: @physical_ticket)
authorize! :create, @ticket_scanning
@ticket_scanning.save
redirect_to conferences_path,
dest_path = conferences_path
if request.referer&.match?(%r{admin/conferences})
dest_path = admin_conference_physical_tickets_path(conference_id: @conference.short_title)
end
redirect_to dest_path,
notice: "Ticket with token #{@physical_ticket.token} successfully scanned."
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/proposals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def join
if can_view_event
current_user.mark_attendance_for_conference(@conference)
current_user.mark_attendance_for_event(@event)
redirect_to @event.url
redirect_to @event.url, allow_other_host: true
else
redirect_to conference_program_proposal_path(@conference, @event),
error: 'You cannot join this event yet. Please try again closer to the start of the event.'
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/ticket_purchases_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ def index
@unpaid_ticket_purchases = current_user.ticket_purchases.by_conference(@conference).unpaid
end

def destroy
@ticket_purchase = TicketPurchase.find(params[:id])
authorize! :delete, @ticket_purchase
@ticket_purchase.delete
redirect_to admin_conference_ticket_path(@conference, @ticket_purchase.ticket.id),
notice: "Ticket for user #{@ticket_purchase.user.name} successfully removed."
end

private

def ticket_purchase_params
Expand Down
5 changes: 5 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,9 @@ def inyourtz(time, timezone, &block)
block.call
end
end

def visible_conference_links
@visible_conference_links ||=
Conference.all.select(:id, :organization_id, :title, :short_title, :start_date).includes(:splashpage, :organization).select { |conf| can?(:show, conf) }.group_by(&:organization)
end
end
8 changes: 8 additions & 0 deletions app/helpers/date_time_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ def length_timestamp(length)
def format_datetime(obj)
return unless obj

obj = DateTime.parse(obj) unless obj.respond_to?(:strftime)

obj.strftime('%Y-%m-%d %H:%M')
end

def format_all_timestamps(lst, conference)
lst.map do |ts|
"#{format_datetime(ts.in_time_zone(conference.timezone))} #{timezone_text(conference)}"
end.to_sentence
end

def show_time(length)
return '0 h 0 min' if length.blank?

Expand Down
40 changes: 29 additions & 11 deletions app/helpers/events_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,28 +213,44 @@ def convert_timezone(date, old_timezone, new_timezone)
end

def join_event_link(event, event_schedule, current_user, small: false)
return unless current_user && event_schedule && event_schedule.room_url.present?
return if event.ended?
return if !event_schedule || event.ended?

unless event_schedule.room_url.present?
return content_tag :span, 'In-person only', class: 'label label-default'
end

unless current_user
return content_tag :span, 'Log in to view join link', class: 'label label-default'
end

conference = event.conference
is_now = event_schedule.happening_now? # 30 minute threshold.
is_registered = conference.user_registered?(current_user)
admin = current_user.roles.where(id: conference.roles).any?
admin = current_user.roles.where(id: conference.roles).any? || current_user.is_admin
# is_presenter = event.speakers.include?(current_user) || event.volunteers.include?(current_user)

if admin || (is_now && is_registered)
link_to("Join Event Now #{'(Early)' unless is_now}",
join_conference_program_proposal_path(conference, event),
target: '_blank', class: "btn btn-primary #{'btn-xs' if small}",
'aria-label': "Join #{event.title}", rel: 'noopener')
join_btn = link_to("Join Event Now #{'(Early)' unless is_now}",
join_conference_program_proposal_path(conference, event),
target: '_blank', class: "btn btn-primary #{'btn-xs' if small}",
'aria-label': "Join #{event.title}", rel: 'noopener')
if event_schedule.room.discussion_url.present?
discussion_link = link_to('Open Chat',
event_schedule.room.discussion_url,
target: '_blank', class: "btn btn-info #{'btn-xs' if small}",
'aria-label': "Join #{event.title}", rel: 'noopener')
content_tag(:span, join_btn + discussion_link, class: 'btn-group')
else
join_btn
end
elsif is_registered
content_tag :span, class: 'btn btn-default btn-xs disabled' do
'Click to Join During Event'
content_tag :span, class: 'label label-primary' do
'Click to Join Online During Event'
end
else
link_to('Register for the conference to join this event.',
conference_conference_registration_path(conference),
class: 'btn btn-default btn-xs',
class: 'btn btn-info btn-xs',
'aria-label': "Register for #{event.title}")
end
end
Expand Down Expand Up @@ -272,8 +288,10 @@ def user_options_for_dropdown(event, column)
end

def committee_only_actions(user, conference, roles: %i[organizer cfp], &block)
return unless user

role_map = roles.map { |role| { name: role, resource: conference } }
return unless user&.has_any_role?(:admin, *role_map)
return unless user.is_admin || user.has_any_role?(*role_map)

content_tag(:div, class: 'panel panel-info') do
concat content_tag(:div, 'Conference Organizers', class: 'panel-heading')
Expand Down
Loading

0 comments on commit aed239e

Please sign in to comment.