Commit graph

5 commits

Author SHA1 Message Date
Rémy Coutable
f393f2dde0
Simplify the slash commands DSL to store action blocks instead of creating methods
Other improvements:
- Ensure slash commands autocomplete doesn't break when noteable_type is not given
- Slash commands: improve autocomplete behavior and /due command
- We don't display slash commands for note edit forms.
- Add tests for reply by email with slash commands
- Be sure to execute slash commands after the note creation in Notes::CreateService

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-08-13 00:36:47 +02:00
Rémy Coutable
39f7f63fe9 Add the /title slash command
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-08-13 00:06:12 +02:00
Rémy Coutable
0eea8c8857 Support slash commands in noteable description and notes
Some important things to note:

- commands are removed from noteable.description / note.note
- commands are translated to params so that they are treated as normal
  params in noteable Creation services
- the logic is not in the models but in the Creation services, which is
  the right place for advanced logic that has nothing to do with what
  models should be responsible of!
- UI/JS needs to be updated to handle notes which consist of commands
  only
- the `/merge` command is not handled yet

Other improvements:

- Don't process commands in commit notes and display a flash is note is only commands
- Add autocomplete for slash commands
- Add description and params to slash command DSL methods
- Ensure replying by email with a commands-only note works
- Use :subscription_event instead of calling noteable.subscribe
- Support :todo_event in IssuableBaseService

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-08-13 00:05:57 +02:00
Lin Jen-Shin
176fa21cb7 raise UnknownIncomingEmail when there's no mail_key:
So that we don't have to pretend that CreateNoteHandler
could handle a nil mail_key. Also, since NilClass#=~ would
just return nil for any regular expression, we could just
match it without checking nilness.

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3363#note_12566407
2016-06-20 19:15:54 +08:00
Lin Jen-Shin
8c0b619d40 Split tests into their own classes 2016-05-24 17:30:36 +08:00