Skip to content

Persist group invite banner dismissal in database

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)

  1. Create a new group.
  2. Refresh the page that this landed you on(the new group's page).
  3. View a new group and see "invite colleagues" banner.
  4. Dismiss banner.
  5. Refresh the page.
  6. Ensure this persists past browsers sessions by opening in an incognito window or clearing cookies.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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

Merge request reports

Loading