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
Boxiang Sun
gitlab-ce
Commits
7433377a
Commit
7433377a
authored
Jun 15, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Restrict
👍
and
👎
on your own note.
parent
36f84ce7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
16 deletions
+36
-16
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+3
-3
app/assets/javascripts/notes/components/issue_note_awards_list.vue
...s/javascripts/notes/components/issue_note_awards_list.vue
+29
-10
app/assets/javascripts/notes/components/issue_note_body.vue
app/assets/javascripts/notes/components/issue_note_body.vue
+3
-2
app/assets/javascripts/notes/components/issue_note_form.vue
app/assets/javascripts/notes/components/issue_note_form.vue
+1
-1
No files found.
app/assets/javascripts/notes/components/issue_note.vue
View file @
7433377a
...
@@ -14,7 +14,7 @@ export default {
...
@@ -14,7 +14,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
isEditing
:
false
,
isEditing
:
false
,
}
}
;
},
},
components
:
{
components
:
{
UserAvatarLink
,
UserAvatarLink
,
...
@@ -31,8 +31,8 @@ export default {
...
@@ -31,8 +31,8 @@ export default {
editHandler
()
{
editHandler
()
{
this
.
isEditing
=
true
;
this
.
isEditing
=
true
;
},
},
formUpdateHandler
(
data
)
{
formUpdateHandler
()
{
console
.
log
(
'
update requested
'
,
data
);
//
console.log('update requested', data);
},
},
formCancelHandler
()
{
formCancelHandler
()
{
this
.
isEditing
=
false
;
this
.
isEditing
=
false
;
...
...
app/assets/javascripts/notes/components/issue_note_awards_list.vue
View file @
7433377a
...
@@ -10,13 +10,20 @@ export default {
...
@@ -10,13 +10,20 @@ export default {
type
:
Array
,
type
:
Array
,
required
:
true
,
required
:
true
,
},
},
noteAuthorId
:
{
type
:
Number
,
required
:
true
,
},
},
},
data
()
{
data
()
{
const
userId
=
window
.
gon
.
current_user_id
;
return
{
return
{
emojiSmiling
,
emojiSmiling
,
emojiSmile
,
emojiSmile
,
emojiSmiley
,
emojiSmiley
,
canAward
:
!!
window
.
gon
.
current_user_id
,
canAward
:
!!
userId
,
myUserId
:
userId
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -48,9 +55,11 @@ export default {
...
@@ -48,9 +55,11 @@ export default {
delete
awards
.
thumbsdown
;
delete
awards
.
thumbsdown
;
}
}
for
(
let
key
in
awards
)
{
// Because for-in forbidden
const
keys
=
Object
.
keys
(
awards
);
keys
.
forEach
((
key
)
=>
{
orderedAwards
[
key
]
=
awards
[
key
];
orderedAwards
[
key
]
=
awards
[
key
];
};
}
)
;
return
orderedAwards
;
return
orderedAwards
;
},
},
...
@@ -59,27 +68,37 @@ export default {
...
@@ -59,27 +68,37 @@ export default {
getAwardHTML
(
name
)
{
getAwardHTML
(
name
)
{
return
glEmojiTag
(
name
);
return
glEmojiTag
(
name
);
},
},
getAwardClassBindings
(
awardList
)
{
getAwardClassBindings
(
awardList
,
awardName
)
{
return
{
return
{
active
:
this
.
amIAwarded
(
awardList
),
active
:
this
.
amIAwarded
(
awardList
),
disabled
:
!
this
.
can
Award
,
disabled
:
!
this
.
can
InteractWithEmoji
(
awardList
,
awardName
)
,
};
};
},
},
canInteractWithEmoji
(
awardList
,
awardName
)
{
let
isAllowed
=
true
;
const
restrictedEmojis
=
[
'
thumbsup
'
,
'
thumbsdown
'
];
const
{
myUserId
,
noteAuthorId
}
=
this
;
// Users can not add :+1: and :-1: to their notes
if
(
myUserId
===
noteAuthorId
&&
restrictedEmojis
.
indexOf
(
awardName
)
>
-
1
)
{
isAllowed
=
false
;
}
return
this
.
canAward
&&
isAllowed
;
},
amIAwarded
(
awardList
)
{
amIAwarded
(
awardList
)
{
const
myUserId
=
window
.
gon
.
current_user_id
;
const
isAwarded
=
awardList
.
filter
(
award
=>
award
.
user
.
id
===
this
.
myUserId
);
const
isAwarded
=
awardList
.
filter
(
award
=>
award
.
user
.
id
===
myUserId
);
return
isAwarded
.
length
;
return
isAwarded
.
length
;
},
},
awardTitle
(
awardsList
)
{
awardTitle
(
awardsList
)
{
const
amIAwarded
=
this
.
amIAwarded
(
awardsList
);
const
amIAwarded
=
this
.
amIAwarded
(
awardsList
);
const
myUserId
=
window
.
gon
.
current_user_id
;
const
TOOLTIP_NAME_COUNT
=
amIAwarded
?
9
:
10
;
const
TOOLTIP_NAME_COUNT
=
amIAwarded
?
9
:
10
;
let
awardList
=
awardsList
;
let
awardList
=
awardsList
;
// Filter myself from list if I am awarded.
// Filter myself from list if I am awarded.
if
(
amIAwarded
)
{
if
(
amIAwarded
)
{
awardList
=
awardList
.
filter
(
award
=>
award
.
user
.
id
!==
myUserId
);
awardList
=
awardList
.
filter
(
award
=>
award
.
user
.
id
!==
this
.
myUserId
);
}
}
// Get only 9-10 usernames to show in tooltip text.
// Get only 9-10 usernames to show in tooltip text.
...
@@ -120,7 +139,7 @@ export default {
...
@@ -120,7 +139,7 @@ export default {
<button
<button
v-for=
"(awardList, awardName) in groupedAwards"
v-for=
"(awardList, awardName) in groupedAwards"
class=
"btn award-control has-tooltip"
class=
"btn award-control has-tooltip"
:class=
"getAwardClassBindings(awardList)"
:class=
"getAwardClassBindings(awardList
, awardName
)"
:title=
"awardTitle(awardList)"
:title=
"awardTitle(awardList)"
data-placement=
"bottom"
data-placement=
"bottom"
type=
"button"
>
type=
"button"
>
...
...
app/assets/javascripts/notes/components/issue_note_body.vue
View file @
7433377a
...
@@ -21,7 +21,7 @@ export default {
...
@@ -21,7 +21,7 @@ export default {
formCancelHandler
:
{
formCancelHandler
:
{
type
:
Function
,
type
:
Function
,
required
:
true
,
required
:
true
,
}
}
,
},
},
components
:
{
components
:
{
IssueNoteEditedText
,
IssueNoteEditedText
,
...
@@ -58,6 +58,7 @@ export default {
...
@@ -58,6 +58,7 @@ export default {
actionText=
"Edited"
/>
actionText=
"Edited"
/>
<issue-note-awards-list
<issue-note-awards-list
v-if=
"note.award_emoji.length"
v-if=
"note.award_emoji.length"
:awards=
"note.award_emoji"
/>
:awards=
"note.award_emoji"
:noteAuthorId=
"note.author.id"
/>
</div>
</div>
</
template
>
</
template
>
app/assets/javascripts/notes/components/issue_note_form.vue
View file @
7433377a
...
@@ -21,7 +21,7 @@ export default {
...
@@ -21,7 +21,7 @@ export default {
note
:
this
.
noteBody
,
note
:
this
.
noteBody
,
markdownPreviewUrl
:
''
,
markdownPreviewUrl
:
''
,
markdownDocsUrl
:
''
,
markdownDocsUrl
:
''
,
}
}
;
},
},
components
:
{
components
:
{
MarkdownField
,
MarkdownField
,
...
...
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