Skip to content

Commit

Permalink
Merge pull request #8 from jujugrrr/more-allowed-chars
Browse files Browse the repository at this point in the history
Allow dot and dash in user/group name
  • Loading branch information
bhouse committed Jul 30, 2015
2 parents 6e4afd8 + 86518c8 commit 80ed7f5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions lib/lita/handlers/group_mention.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ module Lita
module Handlers
# GroupMention handler class
class GroupMention < Handler
route(/@(\w+)+/, :group_mention)
route(/@([a-zA-Z0-9.\-_]+)+/, :group_mention)
route(
/^group\s+mention\s+add\s+@?(?<user>\w+)\s+to\s+@?(?<group>\w+)/,
/^group\s+mention\s+add\s+@?(?<user>[a-zA-Z0-9.\-_]+)\s+to\s+@?(?<group>[a-zA-Z0-9.\-_]+)/,
:add_member,
command: true,
help: {
t('help.add_user_key') => t('help.add_user_value')
}
)
route(
/^group\s+mention\s+remove\s+@?(?<user>\w+)\s+from\s+@?(?<group>\w+)/,
/^group\s+mention\s+remove\s+@?(?<user>[a-zA-Z0-9.\-_]+)\s+from\s+@?(?<group>[a-zA-Z0-9.\-_]+)/,
:remove_member,
command: true,
help: {
t('help.remove_user_key') => t('help.remove_user_value')
}
)
route(
/^group\s+mention\s+remove\s+group\s+@?(?<group>\w+)/,
/^group\s+mention\s+remove\s+group\s+@?(?<group>[a-zA-Z0-9.\-_]+)/,
:remove_group,
command: true,
help: {
Expand All @@ -37,15 +37,15 @@ class GroupMention < Handler
}
)
route(
/^group\s+mention\s+show\s+group\s+@?(?<group>\w+)/,
/^group\s+mention\s+show\s+group\s+@?(?<group>[a-zA-Z0-9.\-_]+)/,
:show_group,
command: true,
help: {
t('help.show_group_key') => t('help.show_group_value')
}
)
route(
/^group\s+mention\s+show\s+user\s+@?(?<user>\w+)/,
/^group\s+mention\s+show\s+user\s+@?(?<user>[a-zA-Z0-9.\-_]+)/,
:show_user,
command: true,
help: {
Expand Down
4 changes: 2 additions & 2 deletions lita-group-mention.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
spec.metadata = { 'lita_plugin_type' => 'handler' }

spec.files = `git ls-files`.split($RS)
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_runtime_dependency 'lita', '>= 4.2'
Expand Down
8 changes: 4 additions & 4 deletions spec/lita/handlers/group_mention_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
context 'commands sent without @ mentions' do
include_examples 'commands' do
let(:redis) { redis_connection }
let(:chat_user) { 'test_user1' }
let(:chat_group) { 'test_group1' }
let(:chat_user) { 'test_user.1-0' }
let(:chat_group) { 'test_group.1-0' }
let(:command_user) { chat_user }
let(:command_group) { chat_group }
end
Expand All @@ -95,8 +95,8 @@
context 'commands sent with @ mentions' do
include_examples 'commands' do
let(:redis) { redis_connection }
let(:chat_user) { 'test_user1' }
let(:chat_group) { 'test_group1' }
let(:chat_user) { 'test_user.1-0' }
let(:chat_group) { 'test_group.1-0' }
let(:command_user) { '@' + chat_user }
let(:command_group) { '@' + chat_group }
end
Expand Down

0 comments on commit 80ed7f5

Please sign in to comment.