Skip to content

Add creator to custom emoji

Toon Claes requested to merge tc-add-custom-emoji-creator into master

What does this MR do?

We'd like to know who added a custom emoji, because we probably will allow the creator to delete/modify the custom emoji they added. So add this info to CustomEmoji.

Closes #284641 (closed)

Database

Migration output

#up

== 20210205134213 AddCreatorIdToCustomEmoji: migrating ========================
-- execute("DELETE FROM custom_emoji")
   -> 0.0028s
-- add_reference(:custom_emoji, :creator, {:index=>true, :null=>false, :foreign_key=>false})
   -> 0.0160s
== 20210205134213 AddCreatorIdToCustomEmoji: migrated (0.0190s) ===============

== 20210219100137 AddCreatorForeignKeyToCustomEmoji: migrating ================
-- transaction_open?()
   -> 0.0000s
-- foreign_keys(:custom_emoji)
   -> 0.0030s
-- execute("ALTER TABLE custom_emoji\nADD CONSTRAINT fk_custom_emoji_creator_id\nFOREIGN KEY (creator_id)\nREFERENCES users (id)\nON DELETE CASCADE\nNOT VALID;\n")
   -> 0.0024s
-- execute("SET statement_timeout TO 0")
   -> 0.0006s
-- execute("ALTER TABLE custom_emoji VALIDATE CONSTRAINT fk_custom_emoji_creator_id;")
   -> 0.0035s
-- execute("RESET ALL")
   -> 0.0006s
== 20210219100137 AddCreatorForeignKeyToCustomEmoji: migrated (0.0189s) =======

#down

== 20210219100137 AddCreatorForeignKeyToCustomEmoji: reverting ================
-- remove_foreign_key(:custom_emoji, {:name=>"fk_custom_emoji_creator_id"})
   -> 0.0048s
== 20210219100137 AddCreatorForeignKeyToCustomEmoji: reverted (0.0097s) =======

== 20210205134213 AddCreatorIdToCustomEmoji: reverting ========================
-- remove_reference(:custom_emoji, :creator)
   -> 0.0073s
== 20210205134213 AddCreatorIdToCustomEmoji: reverted (0.0074s) ===============

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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
Edited by Toon Claes

Merge request reports