diff --git a/CHANGELOG.md b/CHANGELOG.md index c167d1e678..15f119d495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,22 @@ - Implemented openid_connection SSO with CILogon + - Create GET "/api/ca_dashboard/stats" endpoint to fetch Plan, User, and Org-related statistics [#852](https://github.com/portagenetwork/roadmap/pull/852) + +### Changed + + - Update Favicons and Associated HTML Code [#873](https://github.com/portagenetwork/roadmap/pull/873) + + - Drop Sessions Table and Delete `lib/tasks/sessions.rake` [#859](https://github.com/portagenetwork/roadmap/pull/859) + +### Fixed + + - Fix triggering and title of autosent email when a user's admin privileges are changed [#858](https://github.com/portagenetwork/roadmap/pull/858) + + - Fix flaky tests / Optimize Checking Of `plan.title` Within `spec/features/plans/exports_spec.rb` [#871](https://github.com/portagenetwork/roadmap/pull/871) + +## [4.1.1+portage-4.1.3] - 2024-08-08 + ### Changed - Bump rexml from 3.2.8 to 3.3.3 [#839](https://github.com/portagenetwork/roadmap/pull/839) diff --git a/app/controllers/api/ca_dashboard/stats_controller.rb b/app/controllers/api/ca_dashboard/stats_controller.rb new file mode 100644 index 0000000000..92efb460ab --- /dev/null +++ b/app/controllers/api/ca_dashboard/stats_controller.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +module Api + module CaDashboard + # Handles CRUD operations for "/api/ca_dashboard/stats" + class StatsController < Api::V1::BaseApiController + # Allow public access / bypass JWT authentication via "POST /api/v1/authenticate" + skip_before_action :authorize_request, only: [:index] + + # GET /api/ca_dashboard/stats + def index + base_hash = { + 'plans' => Plan.all, + 'orgs' => Org.where(managed: true).all, + 'users' => User.all + } + @totals = { + 'all_time' => all_time_counts(base_hash), + 'last_30_days' => last_30_days_counts(base_hash) + } + begin + @totals['custom_range'] = custom_range_counts(base_hash) if date_params_present? + render 'api/ca_dashboard/stats/index', status: :ok + rescue ArgumentError + error_msg = _('Invalid date format. please use YYYY-MM-DD when supplying `start` or `end` params.') + render_error(errors: [error_msg], status: :bad_request) + end + end + + private + + def all_time_counts(base_hash) + base_hash.transform_values(&:count) + end + + def last_30_days_counts(base_hash) + base_hash.transform_values do |scope| + scope.where('created_at >= ?', 30.days.ago).count + end + end + + def custom_range_counts(base_hash) + start_date = parse_date(params[:start]) + end_date = parse_date(params[:end]) + base_hash.transform_values do |scope| + scope.where(created_at: start_date..end_date).count + end + end + + def date_params_present? + params[:start].present? || params[:end].present? + end + + def parse_date(date_string) + Date.strptime(date_string, '%Y-%m-%d') if date_string.present? + end + end + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index def9e66356..1e241f5fbf 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -85,10 +85,8 @@ def admin_update_permissions end elsif perms.include? perm @user.perms << perm - if perm.id == Perm.use_api.id - @user.keep_or_generate_token! - privileges_changed = true - end + @user.keep_or_generate_token! if perm.id == Perm.use_api.id + privileges_changed = true end end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index e863a2ba2b..b7c6e21f48 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -195,7 +195,7 @@ def admin_privileges(user) I18n.with_locale I18n.locale do mail(to: user.email, - subject: format(_('Administrator privileges granted in %{tool_name}'), + subject: format(_('Administrator privileges updated in %{tool_name}'), tool_name: tool_name)) end end diff --git a/app/views/api/ca_dashboard/stats/index.json.jbuilder b/app/views/api/ca_dashboard/stats/index.json.jbuilder new file mode 100644 index 0000000000..29ce2c4fba --- /dev/null +++ b/app/views/api/ca_dashboard/stats/index.json.jbuilder @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +json.partial! 'api/v1/standard_response' +json.stats do + json.totals @totals +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 58eaf24d05..89788fcccd 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -32,7 +32,7 @@ <%= content_for?(:title) ? yield(:title) : _('%{application_name}') % { :application_name => ApplicationService.application_name } %> - + diff --git a/config/routes.rb b/config/routes.rb index 2d63c59536..df1b14542b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -204,6 +204,10 @@ resources :plans, only: %i[create show index] resources :templates, only: [:index] end + + namespace :ca_dashboard do + resources :stats, only: [:index] + end end namespace :paginable do diff --git a/db/migrate/20240820190548_drop_sessions_table.rb b/db/migrate/20240820190548_drop_sessions_table.rb new file mode 100644 index 0000000000..5026e7b645 --- /dev/null +++ b/db/migrate/20240820190548_drop_sessions_table.rb @@ -0,0 +1,11 @@ +class DropSessionsTable < ActiveRecord::Migration[6.1] + def up + drop_table :sessions + end + + def down + # rollback will the execute the initial migration code written to create the sessions table + require Rails.root.join('db/migrate/20181024120747_add_sessions_table.rb') + AddSessionsTable.new.change + end +end diff --git a/db/schema.rb b/db/schema.rb index 5cf36f45cb..466b1fbda9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,20 +2,23 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_03_15_104737) do +ActiveRecord::Schema.define(version: 2024_08_20_190548) do - create_table "annotations", id: :integer, force: :cascade do |t| + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "annotations", id: :serial, force: :cascade do |t| t.integer "question_id" t.integer "org_id" - t.text "text", limit: 16777215 + t.text "text" t.integer "type", default: 0, null: false t.datetime "created_at" t.datetime "updated_at" @@ -25,8 +28,8 @@ t.index ["versionable_id"], name: "index_annotations_on_versionable_id" end - create_table "answers", id: :integer, force: :cascade do |t| - t.text "text", limit: 16777215 + create_table "answers", id: :serial, force: :cascade do |t| + t.text "text" t.integer "plan_id" t.integer "user_id" t.integer "question_id" @@ -51,7 +54,7 @@ t.index ["question_option_id"], name: "fk_rails_01ba00b569" end - create_table "api_clients", id: :integer, force: :cascade do |t| + create_table "api_clients", id: :serial, force: :cascade do |t| t.string "name", null: false t.string "description" t.string "homepage" @@ -66,7 +69,7 @@ t.index ["name"], name: "index_api_clients_on_name" end - create_table "comments", id: :integer, force: :cascade do |t| + create_table "comments", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "question_id" t.text "text" @@ -77,7 +80,7 @@ t.integer "archived_by" end - create_table "conditions", id: :integer, force: :cascade do |t| + create_table "conditions", id: :serial, force: :cascade do |t| t.integer "question_id" t.text "option_list" t.integer "action_type" @@ -89,7 +92,7 @@ t.index ["question_id"], name: "index_conditions_on_question_id" end - create_table "contributors", id: :integer, force: :cascade do |t| + create_table "contributors", id: :serial, force: :cascade do |t| t.string "name" t.string "email" t.string "phone" @@ -104,7 +107,7 @@ t.index ["roles"], name: "index_contributors_on_roles" end - create_table "departments", id: :integer, force: :cascade do |t| + create_table "departments", id: :serial, force: :cascade do |t| t.string "name" t.string "code" t.integer "org_id" @@ -113,18 +116,18 @@ t.index ["org_id"], name: "index_departments_on_org_id" end - create_table "dmptemplate_translations", id: :integer, force: :cascade do |t| + create_table "dmptemplate_translations", id: :serial, force: :cascade do |t| t.integer "dmptemplate_id" t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.index ["dmptemplate_id"], name: "index_dmptemplate_translations_on_dmptemplate_id" t.index ["locale"], name: "index_dmptemplate_translations_on_locale" end - create_table "dmptemplates", id: :integer, force: :cascade do |t| + create_table "dmptemplates", id: :serial, force: :cascade do |t| t.string "title" t.text "description" t.boolean "published" @@ -141,7 +144,7 @@ t.integer "guidance_group_id" end - create_table "exported_plans", id: :integer, force: :cascade do |t| + create_table "exported_plans", id: :serial, force: :cascade do |t| t.integer "plan_id" t.integer "user_id" t.string "format" @@ -150,7 +153,7 @@ t.integer "phase_id" end - create_table "file_types", id: :integer, force: :cascade do |t| + create_table "file_types", id: :serial, force: :cascade do |t| t.string "name" t.string "icon_name" t.integer "icon_size" @@ -159,7 +162,7 @@ t.datetime "updated_at", null: false end - create_table "file_uploads", id: :integer, force: :cascade do |t| + create_table "file_uploads", id: :serial, force: :cascade do |t| t.string "name" t.string "title" t.text "description" @@ -171,7 +174,7 @@ t.datetime "updated_at", null: false end - create_table "friendly_id_slugs", id: :integer, force: :cascade do |t| + create_table "friendly_id_slugs", id: :serial, force: :cascade do |t| t.string "slug", null: false t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 40 @@ -181,7 +184,7 @@ t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" end - create_table "guidance_groups", id: :integer, force: :cascade do |t| + create_table "guidance_groups", id: :serial, force: :cascade do |t| t.string "name" t.integer "org_id" t.datetime "created_at", null: false @@ -197,18 +200,18 @@ t.index ["guidance_id", "guidance_group_id"], name: "index_guidance_in_group_on_guidance_id_and_guidance_group_id" end - create_table "guidance_translations", id: :integer, force: :cascade do |t| + create_table "guidance_translations", id: :serial, force: :cascade do |t| t.integer "guidance_id" t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.text "text", limit: 16777215 + t.text "text" t.index ["guidance_id"], name: "index_guidance_translations_on_guidance_id" t.index ["locale"], name: "index_guidance_translations_on_locale" end - create_table "guidances", id: :integer, force: :cascade do |t| - t.text "text", limit: 16777215 + create_table "guidances", id: :serial, force: :cascade do |t| + t.text "text" t.integer "guidance_group_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -216,18 +219,18 @@ t.index ["guidance_group_id"], name: "index_guidances_on_guidance_group_id" end - create_table "identifier_schemes", id: :integer, force: :cascade do |t| + create_table "identifier_schemes", id: :serial, force: :cascade do |t| t.string "name" t.string "description" t.boolean "active" t.datetime "created_at" t.datetime "updated_at" - t.text "logo_url", limit: 16777215 - t.text "identifier_prefix", limit: 16777215 + t.text "logo_url" + t.text "identifier_prefix" t.integer "context" end - create_table "identifiers", id: :integer, force: :cascade do |t| + create_table "identifiers", id: :serial, force: :cascade do |t| t.string "value", null: false t.text "attrs" t.integer "identifier_scheme_id" @@ -240,7 +243,7 @@ t.index ["identifier_scheme_id", "value"], name: "index_identifiers_on_identifier_scheme_id_and_value" end - create_table "languages", id: :integer, force: :cascade do |t| + create_table "languages", id: :serial, force: :cascade do |t| t.string "abbreviation" t.string "description" t.string "name" @@ -278,9 +281,9 @@ t.index ["research_output_id"], name: "metadata_research_outputs_on_ro" end - create_table "notes", id: :integer, force: :cascade do |t| + create_table "notes", id: :serial, force: :cascade do |t| t.integer "user_id" - t.text "text", limit: 16777215 + t.text "text" t.boolean "archived", default: false, null: false t.integer "answer_id" t.integer "archived_by" @@ -290,7 +293,7 @@ t.index ["user_id"], name: "fk_rails_7f2323ad43" end - create_table "notification_acknowledgements", id: :integer, force: :cascade do |t| + create_table "notification_acknowledgements", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "notification_id" t.datetime "created_at" @@ -299,11 +302,11 @@ t.index ["user_id"], name: "index_notification_acknowledgements_on_user_id" end - create_table "notifications", id: :integer, force: :cascade do |t| + create_table "notifications", id: :serial, force: :cascade do |t| t.integer "notification_type" t.string "title" t.integer "level" - t.text "body", limit: 16777215 + t.text "body" t.boolean "dismissable" t.date "starts_at" t.date "expires_at" @@ -312,7 +315,7 @@ t.boolean "enabled", default: true end - create_table "option_warnings", id: :integer, force: :cascade do |t| + create_table "option_warnings", id: :serial, force: :cascade do |t| t.integer "organisation_id" t.integer "option_id" t.text "text" @@ -320,7 +323,7 @@ t.datetime "updated_at", null: false end - create_table "options", id: :integer, force: :cascade do |t| + create_table "options", id: :serial, force: :cascade do |t| t.integer "question_id" t.string "text" t.integer "number" @@ -329,7 +332,7 @@ t.datetime "updated_at", null: false end - create_table "org_token_permissions", id: :integer, force: :cascade do |t| + create_table "org_token_permissions", id: :serial, force: :cascade do |t| t.integer "org_id" t.integer "token_permission_type_id" t.datetime "created_at" @@ -338,14 +341,14 @@ t.index ["token_permission_type_id"], name: "fk_rails_2aa265f538" end - create_table "organisation_types", id: :integer, force: :cascade do |t| + create_table "organisation_types", id: :serial, force: :cascade do |t| t.string "name" t.text "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "organisations", id: :integer, force: :cascade do |t| + create_table "organisations", id: :serial, force: :cascade do |t| t.string "name" t.string "abbreviation" t.string "target_url" @@ -370,7 +373,7 @@ t.string "contact_email" end - create_table "orgs", id: :integer, force: :cascade do |t| + create_table "orgs", id: :serial, force: :cascade do |t| t.string "name" t.string "abbreviation" t.string "target_url" @@ -386,36 +389,36 @@ t.integer "language_id" t.string "contact_email" t.integer "org_type", default: 0, null: false - t.text "links", limit: 16777215 + t.text "links" t.string "contact_name" t.boolean "feedback_enabled", default: false - t.text "feedback_msg", limit: 16777215 + t.text "feedback_msg" t.boolean "managed", default: false, null: false t.string "helpdesk_email" t.index ["language_id"], name: "fk_rails_5640112cab" t.index ["region_id"], name: "fk_rails_5a6adf6bab" end - create_table "perms", id: :integer, force: :cascade do |t| + create_table "perms", id: :serial, force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "phase_translations", id: :integer, force: :cascade do |t| + create_table "phase_translations", id: :serial, force: :cascade do |t| t.integer "phase_id" t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.index ["locale"], name: "index_phase_translations_on_locale" t.index ["phase_id"], name: "index_phase_translations_on_phase_id" end - create_table "phases", id: :integer, force: :cascade do |t| + create_table "phases", id: :serial, force: :cascade do |t| t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.integer "number" t.integer "template_id" t.datetime "created_at" @@ -426,7 +429,7 @@ t.index ["versionable_id"], name: "index_phases_on_versionable_id" end - create_table "plan_sections", id: :integer, force: :cascade do |t| + create_table "plan_sections", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "section_id" t.integer "plan_id" @@ -435,13 +438,13 @@ t.datetime "release_time" end - create_table "plans", id: :integer, force: :cascade do |t| + create_table "plans", id: :serial, force: :cascade do |t| t.string "title" t.integer "template_id" t.datetime "created_at" t.datetime "updated_at" t.string "identifier" - t.text "description", limit: 16777215 + t.text "description" t.integer "visibility", default: 3, null: false t.boolean "feedback_requested", default: false t.boolean "complete", default: false @@ -462,19 +465,19 @@ t.index ["template_id"], name: "index_plans_on_template_id" end - create_table "plans_guidance_groups", id: :integer, force: :cascade do |t| + create_table "plans_guidance_groups", id: :serial, force: :cascade do |t| t.integer "guidance_group_id" t.integer "plan_id" t.index ["guidance_group_id", "plan_id"], name: "index_plans_guidance_groups_on_guidance_group_id_and_plan_id" t.index ["plan_id"], name: "fk_rails_13d0671430" end - create_table "prefs", id: :integer, force: :cascade do |t| - t.text "settings", limit: 16777215 + create_table "prefs", id: :serial, force: :cascade do |t| + t.text "settings" t.integer "user_id" end - create_table "project_groups", id: :integer, force: :cascade do |t| + create_table "project_groups", id: :serial, force: :cascade do |t| t.boolean "project_creator" t.boolean "project_editor" t.integer "user_id" @@ -490,7 +493,7 @@ t.index ["project_id", "guidance_group_id"], name: "index_project_guidance_on_project_id_and_guidance_group_id" end - create_table "projects", id: :integer, force: :cascade do |t| + create_table "projects", id: :serial, force: :cascade do |t| t.string "title" t.integer "dmptemplate_id" t.datetime "created_at", null: false @@ -507,27 +510,27 @@ t.index ["slug"], name: "index_projects_on_slug", unique: true end - create_table "question_format_translations", id: :integer, force: :cascade do |t| + create_table "question_format_translations", id: :serial, force: :cascade do |t| t.integer "question_format_id" t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.index ["locale"], name: "index_question_format_translations_on_locale" t.index ["question_format_id"], name: "index_question_format_translations_on_question_format_id" end - create_table "question_formats", id: :integer, force: :cascade do |t| + create_table "question_formats", id: :serial, force: :cascade do |t| t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "option_based", default: false t.integer "formattype", default: 0 end - create_table "question_options", id: :integer, force: :cascade do |t| + create_table "question_options", id: :serial, force: :cascade do |t| t.integer "question_id" t.string "text" t.integer "number" @@ -539,20 +542,20 @@ t.index ["versionable_id"], name: "index_question_options_on_versionable_id" end - create_table "question_translations", id: :integer, force: :cascade do |t| + create_table "question_translations", id: :serial, force: :cascade do |t| t.integer "question_id" t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.text "text", limit: 16777215 - t.text "guidance", limit: 16777215 + t.text "text" + t.text "guidance" t.index ["locale"], name: "index_question_translations_on_locale" t.index ["question_id"], name: "index_question_translations_on_question_id" end - create_table "questions", id: :integer, force: :cascade do |t| - t.text "text", limit: 16777215 - t.text "default_value", limit: 16777215 + create_table "questions", id: :serial, force: :cascade do |t| + t.text "text" + t.text "default_value" t.integer "number" t.integer "section_id" t.datetime "created_at" @@ -573,12 +576,12 @@ t.index ["theme_id"], name: "fk_rails_0489d5eeba" end - create_table "region_groups", id: :integer, force: :cascade do |t| + create_table "region_groups", id: :serial, force: :cascade do |t| t.integer "super_region_id" t.integer "region_id" end - create_table "regions", id: :integer, force: :cascade do |t| + create_table "regions", id: :serial, force: :cascade do |t| t.string "abbreviation" t.string "description" t.string "name" @@ -637,7 +640,7 @@ t.index ["plan_id"], name: "index_research_outputs_on_plan_id" end - create_table "roles", id: :integer, force: :cascade do |t| + create_table "roles", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "plan_id" t.datetime "created_at" @@ -648,20 +651,20 @@ t.index ["user_id"], name: "index_roles_on_user_id" end - create_table "section_translations", id: :integer, force: :cascade do |t| + create_table "section_translations", id: :serial, force: :cascade do |t| t.integer "section_id" t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.index ["locale"], name: "index_section_translations_on_locale" t.index ["section_id"], name: "index_section_translations_on_section_id" end - create_table "sections", id: :integer, force: :cascade do |t| + create_table "sections", id: :serial, force: :cascade do |t| t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.integer "number" t.datetime "created_at" t.datetime "updated_at" @@ -672,42 +675,33 @@ t.index ["versionable_id"], name: "index_sections_on_versionable_id" end - create_table "sessions", id: :integer, force: :cascade do |t| - t.string "session_id", limit: 64, null: false - t.text "data", limit: 16777215 - t.datetime "created_at" - t.datetime "updated_at" - t.index ["session_id"], name: "index_sessions_on_session_id", unique: true - t.index ["updated_at"], name: "index_sessions_on_updated_at" - end - - create_table "settings", id: :integer, force: :cascade do |t| + create_table "settings", id: :serial, force: :cascade do |t| t.string "var", null: false - t.text "value", limit: 16777215 + t.text "value" t.integer "target_id", null: false t.string "target_type", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "splash_logs", id: :integer, force: :cascade do |t| + create_table "splash_logs", id: :serial, force: :cascade do |t| t.string "destination" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "stats", id: :integer, force: :cascade do |t| + create_table "stats", id: :serial, force: :cascade do |t| t.bigint "count", default: 0 t.date "date", null: false t.string "type", null: false t.integer "org_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.text "details", limit: 16777215 + t.text "details" t.boolean "filtered", default: false end - create_table "stylesheets", id: :integer, force: :cascade do |t| + create_table "stylesheets", id: :serial, force: :cascade do |t| t.string "file_uid" t.string "file_name" t.integer "organisation_id" @@ -715,7 +709,7 @@ t.datetime "updated_at", null: false end - create_table "suggested_answers", id: :integer, force: :cascade do |t| + create_table "suggested_answers", id: :serial, force: :cascade do |t| t.integer "question_id" t.integer "organisation_id" t.text "text" @@ -724,9 +718,9 @@ t.boolean "is_example" end - create_table "templates", id: :integer, force: :cascade do |t| + create_table "templates", id: :serial, force: :cascade do |t| t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.boolean "published" t.integer "org_id" t.string "locale" @@ -738,16 +732,16 @@ t.integer "customization_of" t.integer "family_id" t.boolean "archived" - t.text "links", limit: 16777215 + t.text "links" t.index ["family_id", "version"], name: "index_templates_on_family_id_and_version", unique: true t.index ["family_id"], name: "index_templates_on_family_id" t.index ["org_id", "family_id"], name: "template_organisation_dmptemplate_index" t.index ["org_id"], name: "index_templates_on_org_id" end - create_table "themes", id: :integer, force: :cascade do |t| + create_table "themes", id: :serial, force: :cascade do |t| t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "locale" @@ -760,14 +754,14 @@ t.index ["theme_id"], name: "index_themes_in_guidance_on_theme_id" end - create_table "token_permission_types", id: :integer, force: :cascade do |t| + create_table "token_permission_types", id: :serial, force: :cascade do |t| t.string "token_type" - t.text "text_description", limit: 16777215 + t.text "text_description" t.datetime "created_at" t.datetime "updated_at" end - create_table "trackers", id: :integer, force: :cascade do |t| + create_table "trackers", id: :serial, force: :cascade do |t| t.integer "org_id" t.string "code" t.datetime "created_at", null: false @@ -775,28 +769,28 @@ t.index ["org_id"], name: "index_trackers_on_org_id" end - create_table "user_role_types", id: :integer, force: :cascade do |t| + create_table "user_role_types", id: :serial, force: :cascade do |t| t.string "name" t.text "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "user_statuses", id: :integer, force: :cascade do |t| + create_table "user_statuses", id: :serial, force: :cascade do |t| t.string "name" t.text "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "user_types", id: :integer, force: :cascade do |t| + create_table "user_types", id: :serial, force: :cascade do |t| t.string "name" t.text "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "users", id: :integer, force: :cascade do |t| + create_table "users", id: :serial, force: :cascade do |t| t.string "firstname" t.string "surname" t.string "email", limit: 80, default: "", null: false @@ -849,18 +843,18 @@ t.index ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id" end - create_table "version_translations", id: :integer, force: :cascade do |t| + create_table "version_translations", id: :serial, force: :cascade do |t| t.integer "version_id" t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "title" - t.text "description", limit: 16777215 + t.text "description" t.index ["locale"], name: "index_version_translations_on_locale" t.index ["version_id"], name: "index_version_translations_on_version_id" end - create_table "versions", id: :integer, force: :cascade do |t| + create_table "versions", id: :serial, force: :cascade do |t| t.string "title" t.text "description" t.boolean "published" diff --git a/lib/tasks/sessions.rake b/lib/tasks/sessions.rake deleted file mode 100644 index e3f9b1fbe1..0000000000 --- a/lib/tasks/sessions.rake +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -# Neil created this, designed around http://stackoverflow.com/questions/10088619/how-to-clear-rails-sessions-table -# hint: config/initializers/devise.rb sets "remember_for" -namespace :sessions do - desc 'Clear expired sessions from the database' - task cleanup: :environment do - ActiveRecord::SessionStore::Session.delete_all(['updated_at < ?', Devise.remember_for.ago]) - end -end diff --git a/public/android-chrome-144x144.png b/public/android-chrome-144x144.png new file mode 100644 index 0000000000..5dca11776f Binary files /dev/null and b/public/android-chrome-144x144.png differ diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png deleted file mode 100644 index 8f7ad3205c..0000000000 Binary files a/public/android-chrome-192x192.png and /dev/null differ diff --git a/public/android-chrome-256x256.png b/public/android-chrome-256x256.png deleted file mode 100644 index e1abad9f4b..0000000000 Binary files a/public/android-chrome-256x256.png and /dev/null differ diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png index 7396aa393a..5d4208fc9c 100644 Binary files a/public/apple-touch-icon.png and b/public/apple-touch-icon.png differ diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png index cf3295736a..b44acf048b 100644 Binary files a/public/favicon-16x16.png and b/public/favicon-16x16.png differ diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png index 5097e8b7c0..cd21e2006a 100644 Binary files a/public/favicon-32x32.png and b/public/favicon-32x32.png differ diff --git a/public/favicon.ico b/public/favicon.ico index 7c6dbee1d8..a12072882c 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/mstile-150x150.png b/public/mstile-150x150.png index 962f3dc29d..90fdfd2bf8 100644 Binary files a/public/mstile-150x150.png and b/public/mstile-150x150.png differ diff --git a/public/safari-pinned-tab.svg b/public/safari-pinned-tab.svg index 1b52f7e7dc..f44b83bd2d 100644 --- a/public/safari-pinned-tab.svg +++ b/public/safari-pinned-tab.svg @@ -2,20 +2,20 @@ -Created by potrace 1.11, written by Peter Selinger 2001-2013 +Created by potrace 1.14, written by Peter Selinger 2001-2017 - - - + diff --git a/public/site.webmanifest b/public/site.webmanifest index de65106f48..8af025f70d 100644 --- a/public/site.webmanifest +++ b/public/site.webmanifest @@ -3,13 +3,8 @@ "short_name": "", "icons": [ { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-256x256.png", - "sizes": "256x256", + "src": "/android-chrome-144x144.png", + "sizes": "144x144", "type": "image/png" } ], diff --git a/spec/features/plans/exports_spec.rb b/spec/features/plans/exports_spec.rb index 38081afb3f..43132b798e 100644 --- a/spec/features/plans/exports_spec.rb +++ b/spec/features/plans/exports_spec.rb @@ -45,7 +45,7 @@ select('html') new_window = window_opened_by { click_button 'Download Plan' } within_window new_window do - expect(page.source).to have_text(plan.title) + expect(page.title).to have_text(plan.title) end end @@ -60,7 +60,7 @@ select('html') new_window = window_opened_by { click_button 'Download Plan' } within_window new_window do - expect(page.source).to have_text(plan.title) + expect(page.title).to have_text(plan.title) end end @@ -91,7 +91,7 @@ click_button 'Download Plan' end within_window new_window do - expect(page.source).to have_text(plan.title) + expect(page.title).to have_text(plan.title) plan.phases.each do |phase| expect(page.source).to have_text(phase.title) end @@ -101,7 +101,7 @@ click_button 'Download Plan' end within_window new_window do - expect(page.source).to have_text(plan.title) + expect(page.title).to have_text(plan.title) expect(page.source).to have_text(plan.phases[1].title) expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2 end @@ -173,18 +173,18 @@ def _regular_download(format) click_button 'Download Plan' end within_window new_window do - expect(page.source).to have_text(plan.title) + expect(page.title).to have_text(plan.title) end else click_button 'Download Plan' - expect(page.source).to have_text(plan.title) + expect(page.title).to have_text(plan.title) end end def _all_phase_download _select_option('phase_id', 'All') click_button 'Download Plan' - expect(page.source).to have_text(plan.title) + expect(page.title).to have_text(plan.title) plan.phases.each do |phase| # All phase titles should be included in output expect(page.source).to have_text(phase.title) end @@ -193,7 +193,7 @@ def _all_phase_download def _single_phase_download _select_option('phase_id', plan.phases[1].id) click_button 'Download Plan' - expect(page.source).to have_text(plan.title) + expect(page.title).to have_text(plan.title) expect(page.source).to have_text(plan.phases[1].title) expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2 end