FIX: sending messages to groups with non-lowercase names

Fixes a regression in

e8fb9d406667c758cba0f7b1cc779e1ceb352c4c

which caused a bug where you couldn't send a message to a group that
contained an Uppercase letter. Added a test case for this.

Bug report: https://meta.discourse.org/t/-/152999
This commit is contained in:
Blake Erickson
2020-05-27 14:49:00 -06:00
parent 75f46ca632
commit 6548cd1a96
3 changed files with 27 additions and 3 deletions

View File

@ -748,7 +748,7 @@ class PostsController < ApplicationController
if recipients
recipients = recipients.split(",").map(&:downcase)
groups = Group.messageable(current_user).where('lower(name) in (?)', recipients).pluck('name')
groups = Group.messageable(current_user).where('lower(name) in (?)', recipients).pluck('lower(name)')
recipients -= groups
emails = recipients.select { |user| user.match(/@/) }
recipients -= emails