Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
2faa4bba
Commit
2faa4bba
authored
Sep 06, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Note#upvote? to support emoji voting
parent
3a63f6f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
app/models/note.rb
app/models/note.rb
+1
-1
spec/models/note_spec.rb
spec/models/note_spec.rb
+10
-0
No files found.
app/models/note.rb
View file @
2faa4bba
...
@@ -103,7 +103,7 @@ class Note < ActiveRecord::Base
...
@@ -103,7 +103,7 @@ class Note < ActiveRecord::Base
# Returns true if this is an upvote note,
# Returns true if this is an upvote note,
# otherwise false is returned
# otherwise false is returned
def
upvote?
def
upvote?
note
=~
/^\+1/
?
true
:
false
note
.
start_with?
(
'+1'
)
||
note
.
start_with?
(
':+1:'
)
end
end
end
end
# == Schema Information
# == Schema Information
...
...
spec/models/note_spec.rb
View file @
2faa4bba
...
@@ -35,6 +35,16 @@ describe Note do
...
@@ -35,6 +35,16 @@ describe Note do
note
=
Factory
(
:note
,
note:
"-1 for this"
)
note
=
Factory
(
:note
,
note:
"-1 for this"
)
note
.
should_not
be_upvote
note
.
should_not
be_upvote
end
end
it
"recognizes a +1 emoji as a vote"
do
note
=
build
(
:note
,
note:
":+1: for this"
)
note
.
should
be_upvote
end
it
"recognizes a neutral emoji note"
do
note
=
build
(
:note
,
note:
"I would :+1: this, but I don't want to"
)
note
.
should_not
be_upvote
end
end
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment