Commit 3ada1d7ec38c48f3f69c5bd2efde4a9546c71ec1
1 parent
a9dcfd85
Exists in
spb-stable
and in
3 other branches
Added option to remove issue assignee on project issue page and issue edit page
Showing
3 changed files
with
65 additions
and
2 deletions
Show diff stats
CHANGELOG
@@ -7,6 +7,7 @@ v 6.7.0 | @@ -7,6 +7,7 @@ v 6.7.0 | ||
7 | - Piwik Integration (Sebastian Winkler) | 7 | - Piwik Integration (Sebastian Winkler) |
8 | - Show contribution guide link for new issue form (Jeroen van Baarsen) | 8 | - Show contribution guide link for new issue form (Jeroen van Baarsen) |
9 | - Fix CI status for merge requests from fork | 9 | - Fix CI status for merge requests from fork |
10 | + - Added option to remove issue assignee on project issue page and issue edit page (Jason Blanchard) | ||
10 | 11 | ||
11 | v 6.6.2 | 12 | v 6.6.2 |
12 | - Fix 500 error on branch/tag create or remove via UI | 13 | - Fix 500 error on branch/tag create or remove via UI |
@@ -664,4 +665,4 @@ v 0.8.0 | @@ -664,4 +665,4 @@ v 0.8.0 | ||
664 | - stability | 665 | - stability |
665 | - security fixes | 666 | - security fixes |
666 | - increased test coverage | 667 | - increased test coverage |
667 | - - email notification | ||
668 | \ No newline at end of file | 668 | \ No newline at end of file |
669 | + - email notification |
app/assets/javascripts/project_users_select.js.coffee
@@ -10,6 +10,16 @@ | @@ -10,6 +10,16 @@ | ||
10 | query: (query) -> | 10 | query: (query) -> |
11 | Api.projectUsers project_id, query.term, (users) -> | 11 | Api.projectUsers project_id, query.term, (users) -> |
12 | data = { results: users } | 12 | data = { results: users } |
13 | + | ||
14 | + nullUser = { | ||
15 | + name: 'Unassigned', | ||
16 | + avatar: null, | ||
17 | + username: 'none', | ||
18 | + id: '' | ||
19 | + } | ||
20 | + | ||
21 | + data.results.unshift(nullUser) | ||
22 | + | ||
13 | query.callback(data) | 23 | query.callback(data) |
14 | 24 | ||
15 | initSelection: (element, callback) -> | 25 | initSelection: (element, callback) -> |
@@ -35,8 +45,13 @@ | @@ -35,8 +45,13 @@ | ||
35 | else | 45 | else |
36 | avatar = gon.relative_url_root + "/assets/no_avatar.png" | 46 | avatar = gon.relative_url_root + "/assets/no_avatar.png" |
37 | 47 | ||
48 | + if user.id == '' | ||
49 | + avatarMarkup = '' | ||
50 | + else | ||
51 | + avatarMarkup = "<div class='user-image'><img class='avatar s24' src='#{avatar}'></div>" | ||
52 | + | ||
38 | "<div class='user-result'> | 53 | "<div class='user-result'> |
39 | - <div class='user-image'><img class='avatar s24' src='#{avatar}'></div> | 54 | + #{avatarMarkup} |
40 | <div class='user-name'>#{user.name}</div> | 55 | <div class='user-name'>#{user.name}</div> |
41 | <div class='user-username'>#{user.username}</div> | 56 | <div class='user-username'>#{user.username}</div> |
42 | </div>" | 57 | </div>" |
spec/features/issues_spec.rb
@@ -43,6 +43,31 @@ describe "Issues" do | @@ -43,6 +43,31 @@ describe "Issues" do | ||
43 | page.should have_content project.name | 43 | page.should have_content project.name |
44 | end | 44 | end |
45 | end | 45 | end |
46 | + | ||
47 | + end | ||
48 | + | ||
49 | + describe "Editing issue assignee" do | ||
50 | + let!(:issue) do | ||
51 | + create(:issue, | ||
52 | + author: @user, | ||
53 | + assignee: @user, | ||
54 | + project: project) | ||
55 | + end | ||
56 | + | ||
57 | + it 'allows user to select unasigned', :js => true do | ||
58 | + visit edit_project_issue_path(project, issue) | ||
59 | + | ||
60 | + page.should have_content "Assign to #{@user.name}" | ||
61 | + | ||
62 | + page.first('#s2id_issue_assignee_id').click | ||
63 | + sleep 2 # wait for ajax stuff to complete | ||
64 | + page.first('.user-result').click | ||
65 | + | ||
66 | + click_button "Save changes" | ||
67 | + | ||
68 | + page.should have_content "Assignee: Select assignee" | ||
69 | + issue.reload.assignee.should be_nil | ||
70 | + end | ||
46 | end | 71 | end |
47 | 72 | ||
48 | describe "Filter issue" do | 73 | describe "Filter issue" do |
@@ -245,6 +270,28 @@ describe "Issues" do | @@ -245,6 +270,28 @@ describe "Issues" do | ||
245 | page.should have_content milestone.title | 270 | page.should have_content milestone.title |
246 | end | 271 | end |
247 | end | 272 | end |
273 | + | ||
274 | + describe 'removing assignee' do | ||
275 | + let(:user2) { create(:user) } | ||
276 | + | ||
277 | + before :each do | ||
278 | + issue.assignee = user2 | ||
279 | + issue.save | ||
280 | + end | ||
281 | + | ||
282 | + it 'allows user to remove assignee', :js => true do | ||
283 | + visit project_issue_path(project, issue) | ||
284 | + page.should have_content "Assignee: #{user2.name}" | ||
285 | + | ||
286 | + page.first('#s2id_issue_assignee_id').click | ||
287 | + sleep 2 # wait for ajax stuff to complete | ||
288 | + page.first('.user-result').click | ||
289 | + | ||
290 | + page.should have_content "Assignee: Unassigned" | ||
291 | + sleep 2 # wait for ajax stuff to complete | ||
292 | + issue.reload.assignee.should be_nil | ||
293 | + end | ||
294 | + end | ||
248 | end | 295 | end |
249 | 296 | ||
250 | def first_issue | 297 | def first_issue |