Persist group invite banner dismissal in database
requested to merge 334726-investigate-confirm-the-dismiss-for-the-invite-your-teammates-banner-works-as-intended into master
What does this MR do?
- Adds the ability to track a user callout being dismissed by
Group
(Namespace
) - Changes the invite banner on groups to persist via database instead of cookies
- bridges the gap between cookies and database persistence by populating the database if possible.
Database Migration Output
Up
❯ be rails db:migrate
== 20210823172643 CreateUserGroupCallout: migrating ===========================
-- create_table(:user_group_callouts)
-> 0.0126s
== 20210823172643 CreateUserGroupCallout: migrated (0.0127s) ==================
== 20210907182337 AddGroupIdFkeyForUserGroupCallout: migrating ================
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:user_group_callouts)
-> 0.0039s
-- execute("ALTER TABLE user_group_callouts\nADD CONSTRAINT fk_9dc8b9d4b2\nFOREIGN KEY (group_id)\nREFERENCES namespaces (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0031s
-- execute("SET statement_timeout TO 0")
-> 0.0006s
-- execute("ALTER TABLE user_group_callouts VALIDATE CONSTRAINT fk_9dc8b9d4b2;")
-> 0.0104s
-- execute("RESET statement_timeout")
-> 0.0006s
== 20210907182337 AddGroupIdFkeyForUserGroupCallout: migrated (0.0380s) =======
== 20210907182359 AddUserIdFkeyForUserGroupCallout: migrating =================
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:user_group_callouts)
-> 0.0026s
-- execute("ALTER TABLE user_group_callouts\nADD CONSTRAINT fk_c366e12ec3\nFOREIGN KEY (user_id)\nREFERENCES users (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0014s
-- execute("ALTER TABLE user_group_callouts VALIDATE CONSTRAINT fk_c366e12ec3;")
-> 0.0086s
== 20210907182359 AddUserIdFkeyForUserGroupCallout: migrated (0.0166s) ========
Down
❯ be rails db:migrate:down VERSION=20210907182359
== 20210907182359 AddUserIdFkeyForUserGroupCallout: reverting =================
-- remove_foreign_key(:user_group_callouts, {:column=>:user_id})
-> 0.0061s
== 20210907182359 AddUserIdFkeyForUserGroupCallout: reverted (0.0269s) ========
❯ be rails db:migrate:down VERSION=20210907182337
== 20210907182337 AddGroupIdFkeyForUserGroupCallout: reverting ================
-- remove_foreign_key(:user_group_callouts, {:column=>:group_id})
-> 0.0055s
== 20210907182337 AddGroupIdFkeyForUserGroupCallout: reverted (0.0256s) =======
❯ be rails db:migrate:down VERSION=20210823172643
== 20210823172643 CreateUserGroupCallout: reverting ===========================
-- drop_table(:user_group_callouts)
-> 0.0040s
== 20210823172643 CreateUserGroupCallout: reverted (0.0041s) ==================
Screenshots or Screencasts (strongly suggested)
Banner shown and dismissed
Screen_Recording_2021-08-30_at_12.28.04_PM
How to setup and validate locally (strongly suggested)
- Create a new group.
- Refresh the page that this landed you on(the new group's page).
- View a new group and see "invite colleagues" banner.
- Dismiss banner.
- Refresh the page.
- Ensure this persists past browsers sessions by opening in an incognito window or clearing cookies.
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Security
Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.
- [-] 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 #334726
Edited by Mayra Cabrera