Skip to content

user emojis#519

Open
mcfiredrill wants to merge 6 commits into
mainfrom
dj-custom-emojis
Open

user emojis#519
mcfiredrill wants to merge 6 commits into
mainfrom
dj-custom-emojis

Conversation

@mcfiredrill
Copy link
Copy Markdown
Member

@mcfiredrill mcfiredrill commented Apr 5, 2026

Adds user emoji support with a model, migration, and API endpoints.

Changes Made

  • Model: UserEmoji with belongs_to :user and has_one_attached :image
  • Migration: Creates user_emojis table with user_id, name, and timestamps
  • API Endpoints:
    • GET /api/user_emojis — lists the current user's emojis
    • POST /api/user_emojis — creates a new user emoji (accepts name and image via JSON:API format)
  • Serializer: UserEmojiSerializer exposing id, name, and image_url
  • User association: Added has_many :user_emojis to the User model

Both API endpoints require authentication.

@mcfiredrill
Copy link
Copy Markdown
Member Author

@copilot create an API endpoint for creating user emojis

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 5, 2026

@copilot create an API endpoint for creating user emojis

Done in commit 2e465c8. Added the following:

  • GET /api/user_emojis — lists the current user's emojis
  • POST /api/user_emojis — creates a new user emoji (accepts name and image via JSON:API format)
  • UserEmojiSerializer returning id, name, and image_url
  • has_many :user_emojis on the User model

Both endpoints require authentication.

@mcfiredrill
Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

@copilot resolve the merge conflicts in this pull request

Done in commit 23f7bf3. Merged origin/main into the branch and resolved the single conflict in db/schema.rb — kept the newer schema version (2025_09_20_032802) from main and included the user_accessories and user_live_bars tables that were added there.

def index
@user_emojis = current_user.user_emojis
render json: @user_emojis
end
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this index route quite yet @copilot

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in commit 8f6599e — deleted the index action from the controller and updated the route to only: [:create].

before_action :authenticate_user!

def create
@user_emoji = current_user.user_emojis.new(user_emoji_params)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot You can only create an emoji if you have enough "emoji slots" left.

You get more after leveling up.

Level 3: 1 additional slots granted
Level 4: 2 additional slots granted
Level 5: 2 additional slots granted

(some kind of gentle curve like this, maxing out at level 30 perhaps)

You must also have the DJ role.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add the code for emoji slots to the user model

we also need to add validations to see if the user is allowed to create more emojis based on their available slots

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot retry

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit ff16a23. Added:

  • User#emoji_slots in User::Rpg: returns 0 for non-DJs or level < 3, then accumulates slots per level using ⌈√(level−2)⌉ — yielding 1 slot at level 3, +2 at level 4, +2 at level 5, growing gently and capping at level 30.
  • UserEmoji validations:
    • User must have the DJ role
    • User must have available emoji slots remaining
  • Specs covering both the slot calculation and the validations.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 3, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • s3.amazonaws.com
    • Triggering command: /usr/bin/ruby3.2 /usr/bin/ruby3.2 -I/usr/lib/ruby/vendor_ruby extconf.rb x86_64-linux-gnu -D _FORTIFY_SOURCE=3 conftest.c -quiet -dumpbase conftest.c -dumpbase-ext .c -I /usr/include/x86/usr/include/ruby-3.2.0/ruby/backward by-3.2.0 s kward y-3.2.0/ruby/bac-I -I y-3.2.0 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants