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
3883cca9
Commit
3883cca9
authored
May 13, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
21d65470
1dd0caf4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
4 deletions
+57
-4
CHANGELOG
CHANGELOG
+1
-0
app/models/group.rb
app/models/group.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
app/models/user.rb
app/models/user.rb
+2
-2
spec/controllers/groups/avatars_controller_spec.rb
spec/controllers/groups/avatars_controller_spec.rb
+17
-0
spec/controllers/profiles/avatars_controller_spec.rb
spec/controllers/profiles/avatars_controller_spec.rb
+17
-0
spec/controllers/projects/avatars_controller_spec.rb
spec/controllers/projects/avatars_controller_spec.rb
+18
-0
No files found.
CHANGELOG
View file @
3883cca9
...
...
@@ -40,6 +40,7 @@ v 7.11.0 (unreleased)
- Fix bug where commit data would not appear in some subdirectories (Stan Hu)
- Unescape branch names in compare commit (Stan Hu)
- Task lists are now usable in comments, and will show up in Markdown previews.
- Fix bug where avatar filenames were not actually deleted from the database during removal (Stan Hu)
- Fix bug where Slack service channel was not saved in admin template settings. (Stan Hu)
- Move snippets UI to fluid layout
- Improve UI for sidebar. Increase separation between navigation and content
...
...
app/models/group.rb
View file @
3883cca9
...
...
@@ -20,7 +20,7 @@ class Group < Namespace
has_many
:group_members
,
dependent: :destroy
,
as: :source
,
class_name:
'GroupMember'
has_many
:users
,
through: :group_members
validate
:avatar_type
,
if:
->
(
user
)
{
user
.
avatar_changed?
}
validate
:avatar_type
,
if:
->
(
user
)
{
user
.
avatar
.
present?
&&
user
.
avatar
_changed?
}
validates
:avatar
,
file_size:
{
maximum:
200
.
kilobytes
.
to_i
}
mount_uploader
:avatar
,
AvatarUploader
...
...
app/models/project.rb
View file @
3883cca9
...
...
@@ -144,7 +144,7 @@ class Project < ActiveRecord::Base
validates
:star_count
,
numericality:
{
greater_than_or_equal_to:
0
}
validate
:check_limit
,
on: :create
validate
:avatar_type
,
if:
->
(
project
)
{
project
.
avatar
&&
project
.
avatar_changed?
}
if:
->
(
project
)
{
project
.
avatar
.
present?
&&
project
.
avatar_changed?
}
validates
:avatar
,
file_size:
{
maximum:
200
.
kilobytes
.
to_i
}
mount_uploader
:avatar
,
AvatarUploader
...
...
app/models/user.rb
View file @
3883cca9
...
...
@@ -148,7 +148,7 @@ class User < ActiveRecord::Base
validates
:notification_level
,
inclusion:
{
in:
Notification
.
notification_levels
},
presence:
true
validate
:namespace_uniq
,
if:
->
(
user
)
{
user
.
username_changed?
}
validate
:avatar_type
,
if:
->
(
user
)
{
user
.
avatar_changed?
}
validate
:avatar_type
,
if:
->
(
user
)
{
user
.
avatar
.
present?
&&
user
.
avatar
_changed?
}
validate
:unique_email
,
if:
->
(
user
)
{
user
.
email_changed?
}
validate
:owns_notification_email
,
if:
->
(
user
)
{
user
.
notification_email_changed?
}
validate
:owns_public_email
,
if:
->
(
user
)
{
user
.
public_email_changed?
}
...
...
@@ -309,7 +309,7 @@ class User < ActiveRecord::Base
if
primary_email_record
primary_email_record
.
destroy
self
.
emails
.
create
(
email:
self
.
email_was
)
self
.
update_secondary_emails!
end
end
...
...
spec/controllers/groups/avatars_controller_spec.rb
0 → 100644
View file @
3883cca9
require
'spec_helper'
describe
Groups
::
AvatarsController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
owner:
user
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
before
do
sign_in
(
user
)
end
it
'destroy should remove avatar from DB'
do
delete
:destroy
,
group_id:
group
.
path
@group
=
assigns
(
:group
)
expect
(
@group
.
avatar
.
present?
).
to
be_falsey
expect
(
@group
).
to
be_valid
end
end
spec/controllers/profiles/avatars_controller_spec.rb
0 → 100644
View file @
3883cca9
require
'spec_helper'
describe
Profiles
::
AvatarsController
do
let
(
:user
)
{
create
(
:user
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
))
}
before
do
sign_in
(
user
)
controller
.
instance_variable_set
(
:@user
,
user
)
end
it
'destroy should remove avatar from DB'
do
delete
:destroy
@user
=
assigns
(
:user
)
expect
(
@user
.
avatar
.
present?
).
to
be_falsey
expect
(
@user
).
to
be_valid
end
end
spec/controllers/projects/avatars_controller_spec.rb
0 → 100644
View file @
3883cca9
require
'spec_helper'
describe
Projects
::
AvatarsController
do
let
(
:project
)
{
create
(
:project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
controller
.
instance_variable_set
(
:@project
,
project
)
end
it
'destroy should remove avatar from DB'
do
delete
:destroy
,
namespace_id:
project
.
namespace
.
id
,
project_id:
project
.
id
expect
(
project
.
avatar
.
present?
).
to
be_falsey
expect
(
project
).
to
be_valid
end
end
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