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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e8561287
Commit
e8561287
authored
Apr 17, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove IIFEs from diff_notes_bundle.js
parent
eeaeb275
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
731 additions
and
753 deletions
+731
-753
app/assets/javascripts/diff_notes/components/comment_resolve_btn.js
.../javascripts/diff_notes/components/comment_resolve_btn.js
+49
-51
app/assets/javascripts/diff_notes/components/diff_note_avatars.js
...ts/javascripts/diff_notes/components/diff_note_avatars.js
+129
-131
app/assets/javascripts/diff_notes/components/jump_to_discussion.js
...s/javascripts/diff_notes/components/jump_to_discussion.js
+154
-156
app/assets/javascripts/diff_notes/components/new_issue_for_discussion.js
...scripts/diff_notes/components/new_issue_for_discussion.js
+20
-22
app/assets/javascripts/diff_notes/components/resolve_btn.js
app/assets/javascripts/diff_notes/components/resolve_btn.js
+98
-100
app/assets/javascripts/diff_notes/components/resolve_count.js
...assets/javascripts/diff_notes/components/resolve_count.js
+17
-19
app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js
...vascripts/diff_notes/components/resolve_discussion_btn.js
+47
-49
app/assets/javascripts/diff_notes/mixins/discussion.js
app/assets/javascripts/diff_notes/mixins/discussion.js
+24
-26
app/assets/javascripts/diff_notes/services/resolve.js
app/assets/javascripts/diff_notes/services/resolve.js
+53
-55
app/assets/javascripts/diff_notes/stores/comments.js
app/assets/javascripts/diff_notes/stores/comments.js
+44
-46
spec/javascripts/diff_comments_store_spec.js
spec/javascripts/diff_comments_store_spec.js
+96
-98
No files found.
app/assets/javascripts/diff_notes/components/comment_resolve_btn.js
View file @
e8561287
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
(()
=>
{
const
CommentAndResolveBtn
=
Vue
.
extend
({
const
CommentAndResolveBtn
=
Vue
.
extend
({
props
:
{
props
:
{
discussionId
:
String
,
discussionId
:
String
,
},
},
...
@@ -61,7 +60,6 @@ import Vue from 'vue';
...
@@ -61,7 +60,6 @@ import Vue from 'vue';
$
(
`.js-discussion-note-form[data-discussion-id=
${
this
.
discussionId
}
] .note-textarea`
).
off
(
'
input.comment-and-resolve-btn
'
);
$
(
`.js-discussion-note-form[data-discussion-id=
${
this
.
discussionId
}
] .note-textarea`
).
off
(
'
input.comment-and-resolve-btn
'
);
}
}
});
});
Vue
.
component
(
'
comment-and-resolve-btn
'
,
CommentAndResolveBtn
);
Vue
.
component
(
'
comment-and-resolve-btn
'
,
CommentAndResolveBtn
);
})(
window
);
app/assets/javascripts/diff_notes/components/diff_note_avatars.js
View file @
e8561287
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
collapseIcon
from
'
../icons/collapse_icon.svg
'
;
import
collapseIcon
from
'
../icons/collapse_icon.svg
'
;
(()
=>
{
const
DiffNoteAvatars
=
Vue
.
extend
({
const
DiffNoteAvatars
=
Vue
.
extend
({
props
:
[
'
discussionId
'
],
props
:
[
'
discussionId
'
],
data
()
{
data
()
{
return
{
return
{
...
@@ -152,7 +151,6 @@ import collapseIcon from '../icons/collapse_icon.svg';
...
@@ -152,7 +151,6 @@ import collapseIcon from '../icons/collapse_icon.svg';
this
.
isVisible
=
$
(
`.diffs .notes[data-discussion-id="
${
this
.
discussion
.
id
}
"]`
).
is
(
'
:visible
'
);
this
.
isVisible
=
$
(
`.diffs .notes[data-discussion-id="
${
this
.
discussion
.
id
}
"]`
).
is
(
'
:visible
'
);
},
},
},
},
});
});
Vue
.
component
(
'
diff-note-avatars
'
,
DiffNoteAvatars
);
Vue
.
component
(
'
diff-note-avatars
'
,
DiffNoteAvatars
);
})();
app/assets/javascripts/diff_notes/components/jump_to_discussion.js
View file @
e8561287
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
(()
=>
{
const
JumpToDiscussion
=
Vue
.
extend
({
const
JumpToDiscussion
=
Vue
.
extend
({
mixins
:
[
DiscussionMixins
],
mixins
:
[
DiscussionMixins
],
props
:
{
props
:
{
discussionId
:
String
discussionId
:
String
...
@@ -189,7 +188,6 @@ import Vue from 'vue';
...
@@ -189,7 +188,6 @@ import Vue from 'vue';
created
()
{
created
()
{
this
.
discussion
=
this
.
discussions
[
this
.
discussionId
];
this
.
discussion
=
this
.
discussions
[
this
.
discussionId
];
},
},
});
});
Vue
.
component
(
'
jump-to-discussion
'
,
JumpToDiscussion
);
Vue
.
component
(
'
jump-to-discussion
'
,
JumpToDiscussion
);
})();
app/assets/javascripts/diff_notes/components/new_issue_for_discussion.js
View file @
e8561287
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
(()
=>
{
const
NewIssueForDiscussion
=
Vue
.
extend
({
const
NewIssueForDiscussion
=
Vue
.
extend
({
props
:
{
props
:
{
discussionId
:
{
discussionId
:
{
type
:
String
,
type
:
String
,
...
@@ -24,7 +23,6 @@ import Vue from 'vue';
...
@@ -24,7 +23,6 @@ import Vue from 'vue';
return
false
;
return
false
;
},
},
},
},
});
});
Vue
.
component
(
'
new-issue-for-discussion-btn
'
,
NewIssueForDiscussion
);
Vue
.
component
(
'
new-issue-for-discussion-btn
'
,
NewIssueForDiscussion
);
})();
app/assets/javascripts/diff_notes/components/resolve_btn.js
View file @
e8561287
...
@@ -5,8 +5,7 @@
...
@@ -5,8 +5,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
(()
=>
{
const
ResolveBtn
=
Vue
.
extend
({
const
ResolveBtn
=
Vue
.
extend
({
props
:
{
props
:
{
noteId
:
Number
,
noteId
:
Number
,
discussionId
:
String
,
discussionId
:
String
,
...
@@ -115,7 +114,6 @@ import Vue from 'vue';
...
@@ -115,7 +114,6 @@ import Vue from 'vue';
noteTruncated
:
this
.
noteTruncated
,
noteTruncated
:
this
.
noteTruncated
,
});
});
}
}
});
});
Vue
.
component
(
'
resolve-btn
'
,
ResolveBtn
);
Vue
.
component
(
'
resolve-btn
'
,
ResolveBtn
);
})();
app/assets/javascripts/diff_notes/components/resolve_count.js
View file @
e8561287
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
((
w
)
=>
{
window
.
ResolveCount
=
Vue
.
extend
({
w
.
ResolveCount
=
Vue
.
extend
({
mixins
:
[
DiscussionMixins
],
mixins
:
[
DiscussionMixins
],
props
:
{
props
:
{
loggedOut
:
Boolean
loggedOut
:
Boolean
...
@@ -23,5 +22,4 @@ import Vue from 'vue';
...
@@ -23,5 +22,4 @@ import Vue from 'vue';
return
this
.
discussionCount
===
1
?
'
discussion
'
:
'
discussions
'
;
return
this
.
discussionCount
===
1
?
'
discussion
'
:
'
discussions
'
;
}
}
}
}
});
});
})(
window
);
app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js
View file @
e8561287
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
(()
=>
{
const
ResolveDiscussionBtn
=
Vue
.
extend
({
const
ResolveDiscussionBtn
=
Vue
.
extend
({
props
:
{
props
:
{
discussionId
:
String
,
discussionId
:
String
,
mergeRequestId
:
Number
,
mergeRequestId
:
Number
,
...
@@ -56,7 +55,6 @@ import Vue from 'vue';
...
@@ -56,7 +55,6 @@ import Vue from 'vue';
this
.
discussion
=
CommentsStore
.
state
[
this
.
discussionId
];
this
.
discussion
=
CommentsStore
.
state
[
this
.
discussionId
];
}
}
});
});
Vue
.
component
(
'
resolve-discussion-btn
'
,
ResolveDiscussionBtn
);
Vue
.
component
(
'
resolve-discussion-btn
'
,
ResolveDiscussionBtn
);
})();
app/assets/javascripts/diff_notes/mixins/discussion.js
View file @
e8561287
/* eslint-disable object-shorthand, func-names, guard-for-in, no-restricted-syntax, comma-dangle, no-param-reassign, max-len */
/* eslint-disable object-shorthand, func-names, guard-for-in, no-restricted-syntax, comma-dangle, no-param-reassign, max-len */
((
w
)
=>
{
window
.
DiscussionMixins
=
{
w
.
DiscussionMixins
=
{
computed
:
{
computed
:
{
discussionCount
:
function
()
{
discussionCount
:
function
()
{
return
Object
.
keys
(
this
.
discussions
).
length
;
return
Object
.
keys
(
this
.
discussions
).
length
;
...
@@ -33,5 +32,4 @@
...
@@ -33,5 +32,4 @@
return
unresolvedCount
;
return
unresolvedCount
;
}
}
}
}
};
};
})(
window
);
app/assets/javascripts/diff_notes/services/resolve.js
View file @
e8561287
...
@@ -9,10 +9,9 @@ require('../../vue_shared/vue_resource_interceptor');
...
@@ -9,10 +9,9 @@ require('../../vue_shared/vue_resource_interceptor');
Vue
.
use
(
VueResource
);
Vue
.
use
(
VueResource
);
(()
=>
{
window
.
gl
=
window
.
gl
||
{};
window
.
gl
=
window
.
gl
||
{};
class
ResolveServiceClass
{
class
ResolveServiceClass
{
constructor
(
root
)
{
constructor
(
root
)
{
this
.
noteResource
=
Vue
.
resource
(
`
${
root
}
/notes{/noteId}/resolve`
);
this
.
noteResource
=
Vue
.
resource
(
`
${
root
}
/notes{/noteId}/resolve`
);
this
.
discussionResource
=
Vue
.
resource
(
`
${
root
}
/merge_requests{/mergeRequestId}/discussions{/discussionId}/resolve`
);
this
.
discussionResource
=
Vue
.
resource
(
`
${
root
}
/merge_requests{/mergeRequestId}/discussions{/discussionId}/resolve`
);
...
@@ -78,7 +77,6 @@ Vue.use(VueResource);
...
@@ -78,7 +77,6 @@ Vue.use(VueResource);
discussionId
discussionId
},
{});
},
{});
}
}
}
}
gl
.
DiffNotesResolveServiceClass
=
ResolveServiceClass
;
gl
.
DiffNotesResolveServiceClass
=
ResolveServiceClass
;
})();
app/assets/javascripts/diff_notes/stores/comments.js
View file @
e8561287
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
((
w
)
=>
{
window
.
CommentsStore
=
{
w
.
CommentsStore
=
{
state
:
{},
state
:
{},
get
:
function
(
discussionId
,
noteId
)
{
get
:
function
(
discussionId
,
noteId
)
{
return
this
.
state
[
discussionId
].
getNote
(
noteId
);
return
this
.
state
[
discussionId
].
getNote
(
noteId
);
...
@@ -54,5 +53,4 @@ import Vue from 'vue';
...
@@ -54,5 +53,4 @@ import Vue from 'vue';
return
ids
;
return
ids
;
}
}
};
};
})(
window
);
spec/javascripts/diff_comments_store_spec.js
View file @
e8561287
...
@@ -5,8 +5,7 @@ require('~/diff_notes/models/discussion');
...
@@ -5,8 +5,7 @@ require('~/diff_notes/models/discussion');
require
(
'
~/diff_notes/models/note
'
);
require
(
'
~/diff_notes/models/note
'
);
require
(
'
~/diff_notes/stores/comments
'
);
require
(
'
~/diff_notes/stores/comments
'
);
(()
=>
{
function
createDiscussion
(
noteId
=
1
,
resolved
=
true
)
{
function
createDiscussion
(
noteId
=
1
,
resolved
=
true
)
{
CommentsStore
.
create
({
CommentsStore
.
create
({
discussionId
:
'
a
'
,
discussionId
:
'
a
'
,
noteId
,
noteId
,
...
@@ -17,13 +16,13 @@ require('~/diff_notes/stores/comments');
...
@@ -17,13 +16,13 @@ require('~/diff_notes/stores/comments');
authorAvatar
:
'
test
'
,
authorAvatar
:
'
test
'
,
noteTruncated
:
'
test...
'
,
noteTruncated
:
'
test...
'
,
});
});
}
}
beforeEach
(()
=>
{
beforeEach
(()
=>
{
CommentsStore
.
state
=
{};
CommentsStore
.
state
=
{};
});
});
describe
(
'
New discussion
'
,
()
=>
{
describe
(
'
New discussion
'
,
()
=>
{
it
(
'
creates new discussion
'
,
()
=>
{
it
(
'
creates new discussion
'
,
()
=>
{
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
createDiscussion
();
createDiscussion
();
...
@@ -37,9 +36,9 @@ require('~/diff_notes/stores/comments');
...
@@ -37,9 +36,9 @@ require('~/diff_notes/stores/comments');
const
discussion
=
CommentsStore
.
state
[
'
a
'
];
const
discussion
=
CommentsStore
.
state
[
'
a
'
];
expect
(
Object
.
keys
(
discussion
.
notes
).
length
).
toBe
(
2
);
expect
(
Object
.
keys
(
discussion
.
notes
).
length
).
toBe
(
2
);
});
});
});
});
describe
(
'
Get note
'
,
()
=>
{
describe
(
'
Get note
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
createDiscussion
();
createDiscussion
();
...
@@ -50,9 +49,9 @@ require('~/diff_notes/stores/comments');
...
@@ -50,9 +49,9 @@ require('~/diff_notes/stores/comments');
expect
(
note
).
toBeDefined
();
expect
(
note
).
toBeDefined
();
expect
(
note
.
id
).
toBe
(
1
);
expect
(
note
.
id
).
toBe
(
1
);
});
});
});
});
describe
(
'
Delete discussion
'
,
()
=>
{
describe
(
'
Delete discussion
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
createDiscussion
();
createDiscussion
();
...
@@ -73,9 +72,9 @@ require('~/diff_notes/stores/comments');
...
@@ -73,9 +72,9 @@ require('~/diff_notes/stores/comments');
CommentsStore
.
delete
(
'
a
'
,
2
);
CommentsStore
.
delete
(
'
a
'
,
2
);
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
});
});
});
});
describe
(
'
Update note
'
,
()
=>
{
describe
(
'
Update note
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
createDiscussion
();
createDiscussion
();
...
@@ -87,9 +86,9 @@ require('~/diff_notes/stores/comments');
...
@@ -87,9 +86,9 @@ require('~/diff_notes/stores/comments');
const
note
=
CommentsStore
.
get
(
'
a
'
,
1
);
const
note
=
CommentsStore
.
get
(
'
a
'
,
1
);
expect
(
note
.
resolved
).
toBe
(
false
);
expect
(
note
.
resolved
).
toBe
(
false
);
});
});
});
});
describe
(
'
Discussion resolved
'
,
()
=>
{
describe
(
'
Discussion resolved
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
expect
(
Object
.
keys
(
CommentsStore
.
state
).
length
).
toBe
(
0
);
createDiscussion
();
createDiscussion
();
...
@@ -129,5 +128,4 @@ require('~/diff_notes/stores/comments');
...
@@ -129,5 +128,4 @@ require('~/diff_notes/stores/comments');
discussion
.
unResolveAllNotes
();
discussion
.
unResolveAllNotes
();
expect
(
discussion
.
isResolved
()).
toBe
(
false
);
expect
(
discussion
.
isResolved
()).
toBe
(
false
);
});
});
});
});
})();
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