diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index 9cc37000..7bcb33d4 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -657,4 +657,4 @@ linters: # Offense count: 38 InlineStyles: - enabled: false \ No newline at end of file + enabled: false diff --git a/app/models/ability.rb b/app/models/ability.rb index e7916e82..6e322cc3 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -155,17 +155,20 @@ class Ability can :manage, Registration, conference_id: conf_ids_for_organizer # To access conference/proposals can :manage, Event, program: { conference_id: conf_ids_for_organizer } - can :manage, Comment # To access comment link in menu bar - # can :index, Comment, commentable_type: 'Event', - # commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id) + can :index, Comment, commentable_type: 'Event', + commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id) + can :index, Comment, commentable_type: 'Track', + commentable_id: Track.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id) end if conf_ids_for_cfp # To access comment link in menu bar - can :manage, Comment - # can :index, Comment, commentable_type: 'Event', - # commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id) + can :index, Comment, commentable_type: 'Event', + commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id) + can :index, Comment, commentable_type: 'Track', + commentable_id: Track.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id) + # To access conference/proposals can :manage, Event, program: { conference_id: conf_ids_for_cfp } end diff --git a/app/models/admin_ability.rb b/app/models/admin_ability.rb index 85580053..5eb58272 100644 --- a/app/models/admin_ability.rb +++ b/app/models/admin_ability.rb @@ -193,7 +193,7 @@ class AdminAbility commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id) can :index, Comment, commentable_type: 'Track', - commentable_id: Track.where(program_id: Program.where(conference_id: conf_ids).pluck(:id)).pluck(:id) + commentable_id: Track.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id) # Abilities for Role (Conference resource) can [:index, :show], Role do |role| role.resource_type == 'Conference' || role.resource_type == 'Track' diff --git a/config/database.yml b/config/database.yml index d203295e..dd8ac693 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,25 +1,32 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# +<% + encoding = 'unicode' + if ENV['OSEM_DB_ADAPTER'] == 'mysql2' + encoding = 'utf8' + end +%> + + default: &default - adapter: sqlite3 + adapter: <%= ENV['OSEM_DB_ADAPTER'] || 'postgresql' %> + encoding: <%= encoding %> + host: <%= ENV['OSEM_DB_HOST'] || 'database' %> + port: <%= ENV['OSEM_DB_PORT'] || '5432' %> + username: <%= ENV['OSEM_DB_USER'] || 'postgres' %> + password: <%= ENV['OSEM_DB_PASSWORD'] || 'mysecretpassword' %> + database: <%= ENV['OSEM_DB_NAME'] || 'postgres' %> pool: 5 timeout: 5000 development: <<: *default - database: db/development.sqlite3 + database: osem_development # Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". +# re-generated when you run "rake". # Do not set this db to the same as development or production. test: <<: *default - database: db/test.sqlite3 + database: osem_test production: <<: *default - database: db/production.sqlite3 \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index e05f019f..f6df9906 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,11 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -<<<<<<< HEAD -ActiveRecord::Schema.define(version: 2019_06_03_143107) do -======= ActiveRecord::Schema.define(version: 20190720062321) do ->>>>>>> Add comment functionality to tracks create_table "answers", force: :cascade do |t| t.string "title" @@ -553,10 +549,7 @@ ActiveRecord::Schema.define(version: 20190720062321) do t.date "end_date" t.text "relevance" t.integer "selected_schedule_id" -<<<<<<< HEAD -======= t.integer "comments_count", default: 0, null: false ->>>>>>> Add comment functionality to tracks t.index ["room_id"], name: "index_tracks_on_room_id" t.index ["selected_schedule_id"], name: "index_tracks_on_selected_schedule_id" t.index ["submitter_id"], name: "index_tracks_on_submitter_id" @@ -595,7 +588,6 @@ ActiveRecord::Schema.define(version: 20190720062321) do t.boolean "is_admin", default: false t.string "username" t.boolean "is_disabled", default: false -<<<<<<< HEAD t.string "invitation_token" t.datetime "invitation_created_at" t.datetime "invitation_sent_at" @@ -604,8 +596,6 @@ ActiveRecord::Schema.define(version: 20190720062321) do t.string "invited_by_type" t.integer "invited_by_id" t.integer "invitations_count", default: 0 -======= ->>>>>>> Add comment functionality to tracks t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["email"], name: "index_users_on_email", unique: true t.index ["invitation_token"], name: "index_users_on_invitation_token", unique: true