Commit 185da5f9 authored by Marin Jankovski's avatar Marin Jankovski

Make sure that at mentioning all properly notifies.

parent 63c1cdce
...@@ -130,7 +130,7 @@ class ProjectsController < ApplicationController ...@@ -130,7 +130,7 @@ class ProjectsController < ApplicationController
[] []
end end
team_members = sorted(@project.team.members) team_members = sorted(@project.team.members)
participants = [{ username: "all", name: "Group Members" }] + team_members + participating participants = [{ username: "all", name: "Project and Group Members" }] + team_members + participating
@suggestions = { @suggestions = {
emojis: Emoji.names.map { |e| { name: e, path: view_context.image_url("emoji/#{e}.png") } }, emojis: Emoji.names.map { |e| { name: e, path: view_context.image_url("emoji/#{e}.png") } },
issues: @project.issues.select([:iid, :title, :description]), issues: @project.issues.select([:iid, :title, :description]),
......
...@@ -49,12 +49,16 @@ module Mentionable ...@@ -49,12 +49,16 @@ module Mentionable
matches = mentionable_text.scan(/@[a-zA-Z][a-zA-Z0-9_\-\.]*/) matches = mentionable_text.scan(/@[a-zA-Z][a-zA-Z0-9_\-\.]*/)
matches.each do |match| matches.each do |match|
identifier = match.delete "@" identifier = match.delete "@"
if has_project if identifier == "all"
id = project.team.members.find_by(username: identifier).try(:id) users += project.team.members.flatten
else else
id = User.where(username: identifier).pluck(:id).first if has_project
id = project.team.members.find_by(username: identifier).try(:id)
else
id = User.where(username: identifier).pluck(:id).first
end
users << User.find(id) unless id.blank?
end end
users << User.find(id) unless id.blank?
end end
users.uniq users.uniq
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment