- Minimal password length increased to 8 symbols
- Side-by-side diff view (Steven Thonus)
- Internal projects (Jason Hollingsworth)
+ - Allow removal of avatar (Drew Blessing)
v 6.3.0
- API for adding gitlab-ci service
margin-right: 12px;
}
+.remove_avatar {
+ margin-top: 10px;
+}
+
--- /dev/null
+class Profiles::AvatarsController < ApplicationController
+ layout "profile"
+
+ def destroy
+ @user = current_user
+ @user.remove_avatar!
+
+ @user.save
+ redirect_to profile_path
+ end
+end
.clearfix
.profile-avatar-form-option
%p.light
- You can upload an avatar here
- %br
- or change it at #{link_to "gravatar.com", "http://gravatar.com"}
+ - if @user.avatar?
+ You can change your avatar here
+ %br
+ or remove the current avatar to revert to #{link_to "gravatar.com", "http://gravatar.com"}
+ - else
+ You can upload an avatar here
+ %br
+ or change it at #{link_to "gravatar.com", "http://gravatar.com"}
%hr
%a.choose-btn.btn.btn-small.js-choose-user-avatar-button
%i.icon-paper-clip
%span.file_name.js-avatar-filename File name...
= f.file_field :avatar, class: "js-user-avatar-input hide"
%span.help-block The maximum file size allowed is 100KB.
+ - if @user.avatar?
+ = link_to 'Remove avatar', profile_avatar_path, confirm: "Avatar will be removed. Are you sure?", method: :delete, class: "btn btn-remove remove_avatar"
.form-actions
- = f.submit 'Save changes', class: "btn btn-save"
+ = f.submit 'Save changes', class: "btn btn-save"
\ No newline at end of file
delete :leave
end
end
+ resource :avatar, only: [:destroy]
end
end
Given I visit profile page
Then I change my avatar
And I should see new avatar
+ And I should see the "Remove avatar" button
+
+ Scenario: I remove my avatar
+ Given I visit profile page
+ And I have an avatar
+ When I remove my avatar
+ Then I should see my gravatar
+ And I should not see the "Remove avatar" button
Scenario: My password is expired
Given my password is expired
@user.avatar.url.should == "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png"
end
+ step 'I should see the "Remove avatar" button' do
+ page.should have_link("Remove avatar")
+ end
+
+ step 'I have an avatar' do
+ attach_file(:user_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
+ click_button "Save changes"
+ @user.reload
+ end
+
+ step 'I remove my avatar' do
+ click_link "Remove avatar"
+ @user.reload
+ end
+
+ step 'I should see my gravatar' do
+ @user.avatar?.should be_false
+ end
+
+ step 'I should not see the "Remove avatar" button' do
+ page.should_not have_link("Remove avatar")
+ end
+
step 'I try change my password w/o old one' do
within '.update-password' do
fill_in "user_password", with: "22233344"
end
end
+# profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy
+describe Profiles::AvatarsController, "routing" do
+ it "to #destroy" do
+ delete("/profile/avatar").should route_to('profiles/avatars#destroy')
+ end
+end
+
# dashboard GET /dashboard(.:format) dashboard#show
# dashboard_issues GET /dashboard/issues(.:format) dashboard#issues
# dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests