Retrieve epic list user preference collapsed value
What does this MR do?
Implements and exposes user preferences for epic board lists so we can retrieve whether or not a user has set an epic board list as collapsed.
- Add a new database table
- Moves some logic into a shared concern with
List
(the issue board model) - Moves some tests into a shared example and generalise them a bit
- Exposes the collapsed preference via GraphQL under the epic board list as
collapsed
To test:
- Enable feature flag
epic_boards
- Create an epic board (see below)
- Use the following GraphQL query:
{
group(fullPath: "group") {
epicBoards {
nodes {
name
lists {
nodes {
title
collapsed
}
}
}
}
}
}
To create a new epic board:
- use the GraphQL query in !52258 (merged) OR
- view the index page for your group at https://localhost:3000/groups/group/-/epic_boards for one to be created automatically.
Database migrations:
up
$ bundle exec rake db:migrate:up VERSION=20210217101901
== 20210217101901 CreateEpicListUserPreferences: migrating ====================
-- create_table(:boards_epic_list_user_preferences)
-> 0.0133s
-- add_index(:boards_epic_list_user_preferences, [:user_id, :epic_list_id], {:unique=>true, :name=>"index_epic_board_list_preferences_on_user_and_list"})
-> 0.0031s
== 20210217101901 CreateEpicListUserPreferences: migrated (0.0165s) ===========
$ bundle exec rake db:migrate:up VERSION=20210222085529
== 20210222085529 AddEpicBoardUserPreferenceUserFk: migrating =================
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:boards_epic_list_user_preferences)
-> 0.0022s
-- execute("ALTER TABLE boards_epic_list_user_preferences\nADD CONSTRAINT fk_f5f2fe5c1f\nFOREIGN KEY (user_id)\nREFERENCES users (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0130s
-- execute("SET statement_timeout TO 0")
-> 0.0003s
-- execute("ALTER TABLE boards_epic_list_user_preferences VALIDATE CONSTRAINT fk_f5f2fe5c1f;")
-> 0.0072s
-- execute("RESET ALL")
-> 0.0004s
== 20210222085529 AddEpicBoardUserPreferenceUserFk: migrated (0.0274s) ========
$ bundle exec rake db:migrate:up VERSION=20210222085551
== 20210222085551 AddEpicBoardUserPreferenceEpicListFk: migrating =============
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:boards_epic_list_user_preferences)
-> 0.0019s
-- execute("ALTER TABLE boards_epic_list_user_preferences\nADD CONSTRAINT fk_95eac55851\nFOREIGN KEY (epic_list_id)\nREFERENCES boards_epic_lists (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0020s
-- execute("SET statement_timeout TO 0")
-> 0.0003s
-- execute("ALTER TABLE boards_epic_list_user_preferences VALIDATE CONSTRAINT fk_95eac55851;")
-> 0.0018s
-- execute("RESET ALL")
-> 0.0004s
== 20210222085551 AddEpicBoardUserPreferenceEpicListFk: migrated (0.0102s) ====
down
$ bundle exec rake db:migrate:down VERSION=20210222085551
== 20210222085551 AddEpicBoardUserPreferenceEpicListFk: reverting =============
-- foreign_keys(:boards_epic_list_user_preferences)
-> 0.0045s
-- remove_foreign_key(:boards_epic_list_user_preferences, :boards_epic_lists)
-> 0.0061s
== 20210222085551 AddEpicBoardUserPreferenceEpicListFk: reverted (0.0147s) ====
$ bundle exec rake db:migrate:down VERSION=20210222085529
== 20210222085529 AddEpicBoardUserPreferenceUserFk: reverting =================
-- foreign_keys(:boards_epic_list_user_preferences)
-> 0.0021s
-- remove_foreign_key(:boards_epic_list_user_preferences, :users)
-> 0.0025s
== 20210222085529 AddEpicBoardUserPreferenceUserFk: reverted (0.0080s) ========
$ bundle exec rake db:migrate:down VERSION=20210217101901
== 20210217101901 CreateEpicListUserPreferences: reverting ====================
-- drop_table(:boards_epic_list_user_preferences)
-> 0.0039s
== 20210217101901 CreateEpicListUserPreferences: reverted (0.0040s) ===========
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Related to #301018 (closed)
Edited by charlie ablett