#1157 some avatar setting changes

- Allow to delete current avatar
This commit is contained in:
Unknwon committed 2016-03-05 00:51:51 -05:00
1 parent 2a931937a8
commit a2f13eae55
10 files changed
+79 -46

No files matched your search

+1
View File
@@ -217,6 +217,7 @@ func runWeb(ctx *cli.Context) {
m.Get("", user.Settings)
m.Post("", bindIgnErr(auth.UpdateProfileForm{}), user.SettingsPost)
m.Post("/avatar", binding.MultipartForm(auth.UploadAvatarForm{}), user.SettingsAvatar)
m.Post("/avatar/delete", user.SettingsDeleteAvatar)
m.Combo("/email").Get(user.SettingsEmails).
Post(bindIgnErr(auth.AddEmailForm{}), user.SettingsEmailPost)
m.Post("/email/delete", user.DeleteEmail)
+1 -2
View File
@@ -264,11 +264,10 @@ continue = Continue
cancel = Cancel
enable_custom_avatar = Enable Custom Avatar
enable_custom_avatar_helper = Disable fetch from Gravatar
choose_new_avatar = Choose new avatar
update_avatar = Update Avatar Setting
delete_current_avatar = Delete Current Avatar
uploaded_avatar_not_a_image = Uploaded file is not a image.
no_custom_avatar_available = No custom avatar available, cannot enable it.
update_avatar_success = Your avatar setting has been updated successfully.
change_password = Change Password
+1 -1
View File
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.8.57.0304"
const APP_VER = "0.8.57.0305"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
+4 -11
View File
@@ -617,7 +617,7 @@ func ChangeUserName(u *User, newUserName string) (err error) {
}
func updateUser(e Engine, u *User) error {
// Organization does not need e-mail.
// Organization does not need email
if !u.IsOrganization() {
u.Email = strings.ToLower(u.Email)
has, err := e.Where("id!=?", u.Id).And("type=?", u.Type).And("email=?", u.Email).Get(new(User))
@@ -634,16 +634,9 @@ func updateUser(e Engine, u *User) error {
}
u.LowerName = strings.ToLower(u.Name)
if len(u.Location) > 255 {
u.Location = u.Location[:255]
}
if len(u.Website) > 255 {
u.Website = u.Website[:255]
}
if len(u.Description) > 255 {
u.Description = u.Description[:255]
}
u.Location = base.TruncateString(u.Location, 255)
u.Website = base.TruncateString(u.Website, 255)
u.Description = base.TruncateString(u.Description, 255)
u.FullName = markdown.Sanitizer.Sanitize(u.FullName)
_, err := e.Id(u.Id).AllCols().Update(u)
+9
View File
@@ -464,6 +464,15 @@ func EllipsisString(str string, length int) string {
return str[:length-3] + "..."
}
// TruncateString returns a truncated string with given limit,
// it returns input string if length is not reached limit.
func TruncateString(str string, limit int) string {
if len(str) < limit {
return str
}
return str[:limit]
}
// StringsToInt64s converts a slice of string to a slice of int64.
func StringsToInt64s(strs []string) []int64 {
ints := make([]int64, len(strs))
+2 -2
View File
@@ -4322,7 +4322,7 @@ func confLocaleLocale_deDeIni() (*asset, error) {
return a, nil
}
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xac\xbd\xfb\x92\xdc\x46\x8e\x2f\xfc\x3f\x9f\x82\xd6\x84\x42\x56\x44\xab\x1c\x1e\xef\x77\x09\x87\x65\x7f\xba\x58\x97\x5d\xb5\xba\x57\xdd\xf6\x7c\x73\x1c\x8a\x32\xab\x8a\x5d\xc5\x55\x15\x59\x43\xb2\xd4\xea\x99\x98\x37\x38\x0f\x70\x9e\xef\x3c\xc9\x01\x7e\x00\x32\x91\x24\xab\x5b\xf2\xac\xfe\x50\xb3\x32\x91\x77\x24\x12\x40\x02\xc8\x62\xbf\x9f\xaf\xca\x6e\x99\x3f\xce\x9f\xe4\xfb\xa2\xaa\xb7\x65\xd7\xe5\x5d\xb9\xbd\x7a\xb4\x69\xba\xbe\x5c\xe5\x2f\xab\x9e\x7e\xb7\x1f\xab\x65\x99\x65\x9b\x66\x57\x12\xe8\x2b\xfa\x93\xad\x8a\x6e\xb3\x68\x8a\x76\x45\x09\xcf\xed\x3b\x2b\x3f\xed\xb7\x4d\xcb\x40\x3f\xcb\x57\xb6\x29\xb7\x7b\x2e\x43\x7f\xb2\xae\x5a\xd7\xf3\xaa\xa6\x9f\x17\xf4\x95\xbf\xae\x25\xa5\x39\xf4\x96\x74\x76\xe8\x25\xed\xb0\xb7\xa4\x5f\xf6\x59\x5b\xae\x2b\xea\x4d\x4b\x49\xef\xf4\x33\xbb\x2e\x17\x5d\xd5\x73\x4b\x7f\x91\xaf\xec\x63\xd9\x76\x55\xc3\xb5\xff\x2a\x5f\xd9\xbe\x58\x33\xc0\x39\xfd\xc9\xfa\x72\xb7\xdf\x16\x28\x70\xa9\x9f\xd9\xb6\xa8\xd7\x07\x81\x79\xa3\x9f\xd9\xb2\x2d\x29\x6b\x5e\x97\xd7\x94\xfa\x0c\x3f\x66\xb3\x59\x76\xa0\x49\x98\xef\xdb\xe6\xaa\xda\x96\xf3\xa2\x5e\xcd\x77\x32\xcc\x5f\x28\x3d\xd7\xf4\x9c\xd2\x73\x4e\xc7\x10\xca\x15\x0d\x75\x5e\x74\x3a\x0e\x9a\x4b\x1a\x79\xd1\x65\xa8\xaa\x2e\x76\x56\x9a\x3f\xb3\x72\x57\x54\x5b\x9e\x35\xfe\x4b\xfd\xee\xba\xeb\x06\x53\x7b\xae\x9f\x34\x07\xf3\xfe\x66\x5f\x62\x0a\x1e\x5d\xd2\x57\xb6\x2c\xf6\xfd\x72\x53\x70\x37\xe5\x2b\x23\xa0\x7d\x43\x73\xd1\xb4\x37\x80\xb3\x1f\x59\xd3\xae\x8b\xba\xfa\x7b\xd1\xcb\xfc\x9c\xb9\x9f\xd9\xae\x6a\xdb\x86\xa7\xf6\x14\x1f\x19\x8d\x7c\xce\xf5\x50\xca\x5b\x9a\x04\x57\x0b\xe7\xec\xaa\x75\x2b\xb3\xc8\x99\xa7\xf8\xc5\xb5\x48\x9e\xd6\x24\x59\xa1\xb6\xab\xa6\xfd\xa0\xa9\x2f\xf8\x73\x50\x25\x75\x4e\x73\xd3\x7e\x15\x35\xad\x87\xe6\x9e\xe2\x47\x02\xd0\x65\xc5\x6a\x47\x33\xbc\x2f\xea\x92\xa7\xee\x09\xff\xa2\xf9\xa2\x5f\x59\xb1\x5c\x36\x87\xba\x9f\x77\x65\xdf\x57\xf5\x9a\xd7\xe0\x89\x24\xe5\x17\x9a\x94\xb9\xbc\x90\x76\xd3\x1c\xc2\x2a\x53\xfa\x5f\xe9\x67\x7e\x2e\x3f\x25\xcf\x15\x42\x66\x28\x49\x4d\xf6\xd5\xc7\xaa\xaf\x4a\x69\xcc\x7e\x64\xfb\xc3\x76\x4b\xf3\xf9\xb7\x43\xd9\xf5\x9c\x75\x4e\xbf\x69\x06\xe4\x77\x56\x75\xdd\x01\x25\x5e\xe3\x23\xa3\x45\xad\x97\x18\xce\x33\x7c\x64\xd9\x6f\x5d\x59\xb4\xcb\xcd\xfb\x4c\xfe\xa2\xb7\xfc\xc1\x48\x79\x6c\xb9\x19\xc3\x14\xbb\xa4\x05\x6b\x20\x5b\x36\x2b\xfe\xf1\x8c\xfe\x50\xd5\x55\xdd\xf5\xc5\x76\xfb\x3e\xd3\x0f\x06\x93\x2f\x59\x82\xbe\xea\x31\x0f\x9a\x98\x5f\xf4\xe5\xbe\xe3\x35\xcc\x5f\x54\x6d\xd7\x3f\xea\x2b\xc2\xe2\x77\x87\x3a\x5b\x35\xcb\x0f\xb4\x3f\x78\xaf\xa3\xe5\xd7\x57\x39\x4d\xd7\x03\xda\x21\xed\xa1\xae\x69\x82\xf2\x97\x0d\x4d\x1a\x35\x53\x51\xfb\xcf\x01\x7d\x92\xef\xb7\x65\xd1\x11\x48\x59\xac\xf2\x1f\x8a\xbc\x2f\xda\x75\xd9\x3f\xbe\x37\x5f\xd0\xbe\xfc\x70\x2f\xdf\xb4\xe5\xd5\xe3\x7b\xf7\xbb\x7b\x3f\xbe\x3c\x50\xb1\x6d\x55\x97\xdd\x0f\xdf\x14\x3f\xe6\xcb\x82\x72\x68\x1a\x6f\xf2\x45\x79\xc5\xdb\x90\xda\xca\x09\xff\xeb\x35\x6f\xc1\x9b\x7e\xc3\x0d\x12\x2e\xd0\x47\x97\x33\x0d\xf8\x2a\xe3\x05\x20\x1a\x31\x5f\x2d\x8c\xde\xa1\x43\x48\x6e\x69\x01\x4e\x6f\x2e\xfe\xf3\xcd\x49\x7e\x4e\x44\x6f\xdd\x96\xf8\xa6\xff\xa8\xc4\x77\x39\x8d\xf6\xb2\x7a\xfe\x74\x96\x51\x59\x9b\x90\xe7\x45\x5f\x2c\xb8\xef\x61\xfd\x39\x53\xb6\x67\xc8\xc3\x26\x65\x32\x0a\x92\xd9\xf5\xc9\xb2\x4c\x6d\x71\xaa\x43\xe9\x42\xa8\xe3\x2d\x13\x07\x4a\x0f\x33\x7b\x2e\x73\x46\x55\xe5\xaf\xdf\xbe\x3d\x7b\xfe\x34\x2f\xeb\x35\xcd\x4c\x7e\x5d\xf5\x9b\xfc\xd0\x5f\xfd\xbf\xf3\x75\x59\x97\x6d\xb1\x9d\x2f\x2b\x9e\x94\x96\x50\x36\xa7\x59\x92\x21\xce\xb2\xae\xdb\x12\xed\x02\x16\x5c\x5c\xbc\xc9\x4f\x19\x13\xf6\x45\xbf\x41\x47\xfa\x4d\xd6\xfd\x6d\xcb\x13\x15\x1a\xbc\xdc\x94\x39\xb6\x03\x80\x9a\xab\xe1\xbc\xe4\x2b\xed\xeb\x2c\xff\x61\xd1\xfe\xe8\xfa\x57\x2c\xba\x66\x7b\xe8\xb5\xe4\xf5\xa6\xac\xb1\x50\x84\x4a\x6d\x4f\x84\xd0\x8e\x95\x59\x56\xb6\xed\x9c\x48\x72\x7f\xc3\xcb\xa3\x7d\x39\xd6\x8a\x54\x46\xbb\xa4\x6e\x7a\x5a\xfe\x1c\xe5\xa4\x8a\xaa\xfe\x58\x6c\xab\x15\x2d\x52\x9c\xc8\xb4\x2c\x12\x57\x0d\xad\x37\x97\x26\x8c\x6e\xae\x31\x45\xb4\x77\xe9\xc4\xc8\xef\xcd\xee\x81\x84\xdf\x7b\x74\x6f\x96\xd5\xcd\x5c\xe8\x0b\x13\xfb\x55\xd5\x15\x0b\x22\xfc\x72\x10\xb5\x46\x47\xff\xca\x78\x27\x5d\x51\x88\x3c\x81\xe0\x35\xe1\xc3\x0d\x67\x0a\x23\x65\x41\x27\x00\xc8\x94\x12\x28\x3f\x76\xa3\x66\x01\x2f\x84\xa0\x85\x84\xd1\x98\x33\x5b\x68\xc3\xca\x27\xfb\xfd\xb6\x5a\x4a\xd3\x2f\x25\x2f\x22\x28\x1f\xf5\x3a\x29\x1e\x0e\x08\x66\x79\x0e\xcd\xa8\xd7\x4c\xf0\xf2\xe4\xe4\x40\xf9\x4d\x49\x3b\x6e\x73\x58\xcb\x71\xb7\x6d\x0e\xab\xaf\x40\x88\x6c\xe5\x22\x1d\xca\xdf\x35\xd4\x61\x60\x55\x00\x88\x4d\x3c\x21\x82\xc2\xdc\x45\x5b\xee\x9a\x9e\x27\x4e\x8b\x31\x05\xbd\xae\x28\x93\x46\xda\x15\x1f\xe9\xdc\xec\x1b\xd9\xca\x2b\xda\xaa\x4b\xae\x98\x28\xdf\x81\x58\x04\xd9\x4e\x44\x7f\x64\x4b\x59\x5a\x8a\xbb\x80\xda\x1d\x68\x17\x6e\xa8\x32\x9e\x78\x66\x71\xa8\xca\xa9\x7e\x62\x48\x54\x0f\xa8\x03\xed\xf8\x86\x8e\x63\x5e\xe8\xe7\xf8\xd0\xdf\xbe\x7e\xea\x55\x71\x75\x45\xbd\xea\x68\x37\xbd\xca\x97\xdb\x86\xb6\xe2\x2f\xef\xde\x74\xbc\xd1\x36\xfLine truncated
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xac\xbd\xeb\x72\xdc\x48\xae\x27\xfe\x9d\x4f\xc1\xf6\x84\xc3\x76\x84\x5c\x8e\xee\x3e\xff\xff\x6e\x74\xb4\xdd\x2b\x4b\xed\xcb\x19\xcb\xd2\x48\x72\xf7\xce\x76\x38\xd8\xac\x22\x55\xc5\x71\x15\x59\x43\xb2\x24\x6b\x26\xe6\x0d\xf6\x01\xf6\xf9\xf6\x49\x16\xf8\x01\xc8\x0b\xc9\x92\xec\x9e\xe3\x0f\x16\x2b\x13\x79\x47\x22\x01\x24\x80\xcc\xb7\xdb\xac\x28\xbb\x45\xfa\x3c\x3d\x4c\xb7\x79\x55\xaf\xcb\xae\x4b\xbb\x72\x7d\xf5\x74\xd5\x74\x7d\x59\xa4\xaf\xab\x9e\x7e\xb7\xd7\xd5\xa2\x4c\x92\x55\xb3\x29\x09\xf4\x0d\xfd\x49\x8a\xbc\x5b\xcd\x9b\xbc\x2d\x28\xe1\xd8\xbe\x93\xf2\xf3\x76\xdd\xb4\x0c\xf4\xb3\x7c\x25\xab\x72\xbd\xe5\x32\xf4\x27\xe9\xaa\x65\x9d\x55\x35\xfd\xbc\xa0\xaf\xf4\x6d\x2d\x29\xcd\xae\xb7\xa4\xd3\x5d\x2f\x69\xbb\xad\x25\x7d\xd8\x26\x6d\xb9\xac\xa8\x37\x2d\x25\x9d\xeb\x67\x72\x53\xce\xbb\xaa\xe7\x96\x7e\x95\xaf\xe4\xba\x6c\xbb\xaa\xe1\xda\x7f\x91\xaf\x64\x9b\x2f\x19\xe0\x8c\xfe\x24\x7d\xb9\xd9\xae\x73\x14\xb8\xd4\xcf\x64\x9d\xd7\xcb\x9d\xc0\xbc\xd3\xcf\x64\xd1\x96\x94\x95\xd5\xe5\x0d\xa5\x1e\xe1\xc7\x6c\x36\x4b\x76\x34\x09\xd9\xb6\x6d\xae\xaa\x75\x99\xe5\x75\x91\x6d\x64\x98\x1f\x28\x3d\xd5\xf4\x94\xd2\x53\x4e\xc7\x10\xca\x82\x86\x9a\xe5\x9d\x8e\x83\xe6\x92\x46\x9e\x77\x09\xaa\xaa\xf3\x8d\x95\xe6\xcf\xa4\xdc\xe4\xd5\x9a\x67\x8d\xff\x52\xbf\xbb\xee\xa6\xc1\xd4\x9e\xe9\x27\xcd\x41\xd6\xdf\x6e\x4b\x4c\xc1\xd3\x4b\xfa\x4a\x16\xf9\xb6\x5f\xac\x72\xee\xa6\x7c\x25\x04\xb4\x6d\x68\x2e\x9a\xf6\x16\x70\xf6\x23\x69\xda\x65\x5e\x57\xff\xc8\x7b\x99\x9f\xd3\xe0\x67\xb2\xa9\xda\xb6\xe1\xa9\x3d\xc1\x47\x42\x23\xcf\xb8\x1e\x4a\x79\x4f\x93\x10\xd4\xc2\x39\x9b\x6a\xd9\xca\x2c\x72\xe6\x09\x7e\x71\x2d\x92\xa7\x35\x49\x96\xab\xed\xaa\x69\x3f\x69\xea\x2b\xfe\x1c\x54\x49\x9d\xd3\xdc\xb8\x5f\x79\x4d\xeb\xa1\xb9\x27\xf8\x11\x01\x74\x49\x5e\x6c\x68\x86\xb7\x79\x5d\xf2\xd4\x1d\xf2\x2f\x9a\x2f\xfa\x95\xe4\x8b\x45\xb3\xab\xfb\xac\x2b\xfb\xbe\xaa\x97\xbc\x06\x87\x92\x94\x5e\x68\x52\x12\xe4\xb9\xb4\xdb\x66\xe7\x56\x99\xd2\xff\x4a\x3f\xd3\x33\xf9\x29\x79\x41\x21\x64\xba\x92\xd4\x64\x5f\x5d\x57\x7d\x55\x4a\x63\xf6\x23\xd9\xee\xd6\x6b\x9a\xcf\xbf\xef\xca\xae\xe7\xac\x33\xfa\x4d\x33\x20\xbf\x93\xaa\xeb\x76\x28\xf1\x16\x1f\x09\x2d\x6a\xbd\xc0\x70\x8e\xf0\x91\x24\xbf\x75\x65\xde\x2e\x56\x1f\x13\xf9\x8b\xde\xf2\x07\x23\xe5\xbe\xe5\x66\x0c\x53\xec\x92\x16\xac\x81\x64\xd1\x14\xfc\xe3\x88\xfe\x50\xd5\x55\xdd\xf5\xf9\x7a\xfd\x31\xd1\x0f\x06\x93\x2f\x59\x82\xbe\xea\x31\x0f\x9a\x98\x5e\xf4\xe5\xb6\xe3\x35\x4c\x5f\x55\x6d\xd7\x3f\xed\x2b\xc2\xe2\xf3\x5d\x9d\x14\xcd\xe2\x13\xed\x0f\xde\xeb\x68\xf9\xed\x55\x4a\xd3\xf5\x88\x76\x48\xbb\xab\x6b\x9a\xa0\xf4\x75\x43\x93\x46\xcd\x54\xd4\xfe\x31\xa0\x0f\xd2\xed\xba\xcc\x3b\x02\x29\xf3\x22\xfd\x31\x4f\xfb\xbc\x5d\x96\xfd\xf3\x07\xd9\x9c\xf6\xe5\xa7\x07\xe9\xaa\x2d\xaf\x9e\x3f\x78\xd8\x3d\x78\xf1\x7a\x47\xc5\xd6\x55\x5d\x76\x3f\x3e\xcb\x5f\xa4\x8b\x9c\x72\x68\x1a\x6f\xd3\x79\x79\xc5\xdb\x90\xda\x4a\x09\xff\xeb\x25\x6f\xc1\xdb\x7e\xc5\x0d\x12\x2e\xd0\x47\x97\x32\x0d\xf8\x26\xe1\x05\x20\x1a\x91\x15\x73\xa3\x77\xe8\x10\x92\x5b\x5a\x80\x93\xdb\x8b\xbf\xbc\x3b\x48\xcf\x88\xe8\x2d\xdb\x12\xdf\xf4\x1f\x95\xf8\x3e\xa5\xd1\x5e\x56\xc7\x2f\x67\x09\x95\xb5\x09\x39\xce\xfb\x7c\xce\x7d\x77\xeb\xcf\x99\xb2\x3d\x5d\x1e\x36\x29\x93\x51\x90\xcc\xae\x8f\x96\x65\x6a\x8b\x53\x1d\x4a\x17\x5c\x1d\xef\x99\x38\x50\xba\x9b\xd9\x33\x99\x33\xaa\x2a\x7d\xfb\xfe\xfd\xe9\xf1\xcb\xb4\xac\x97\x34\x33\xe9\x4d\xd5\xaf\xd2\x5d\x7f\xf5\xdf\xb3\x65\x59\x97\x6d\xbe\xce\x16\x15\x4f\x4a\x4b\x28\x9b\xd2\x2c\xc9\x10\x67\x49\xd7\xad\x89\x76\x01\x0b\x2e\x2e\xde\xa5\x27\x8c\x09\xdb\xbc\x5f\xa1\x23\xfd\x2a\xe9\xfe\xbe\xe6\x89\x72\x0d\x5e\xae\xca\x14\xdb\x01\x40\xcd\xd5\x70\x5e\xd2\x42\xfb\x3a\x4b\x7f\x9c\xb7\x2f\x82\xfe\xe5\xf3\xae\x59\xef\x7a\x2d\x79\xb3\x2a\x6b\x2c\x14\xa1\x52\xdb\x13\x21\xb4\x63\x65\x96\x94\x6d\x9b\x11\x49\xee\x6f\x79\x79\xb4\x2f\xfb\x5a\x91\xca\x68\x97\xd4\x4d\x4f\xcb\x9f\xa2\x9c\x54\x51\xd5\xd7\xf9\xba\x2a\x68\x91\xfc\x44\xc6\x65\x91\x58\x34\xb4\xde\x5c\x9a\x30\xba\xb9\xc1\x14\xd1\xde\xa5\x13\x23\x7d\x30\x7b\x00\x12\xfe\xe0\xe9\x83\x59\x52\x37\x99\xd0\x17\x26\xf6\x45\xd5\xe5\x73\x22\xfc\x72\x10\xb5\x46\x47\xff\xca\x78\x27\x5d\x51\x88\x34\x82\xe0\x35\xe1\xc3\x0d\x67\x0a\x23\x65\x4e\x27\x00\xc8\x94\x12\xa8\x70\xec\x46\xcd\x1c\x5e\x08\x41\x73\x09\xa3\x31\x27\xb6\xd0\x86\x95\x87\xdb\xed\xba\x5a\x48\xd3\xaf\x25\xcf\x23\x28\x1f\xf5\x3a\x29\x21\x1c\x10\xcc\xf2\x02\x34\xa3\x5e\x33\xc1\x4b\xa3\x93\x03\xe5\x57\x25\xed\xb8\xd5\x6e\x29\xc7\xdd\xba\xd9\x15\xdf\x80\x10\xd9\xca\x79\x3a\x94\x9e\x37\xd4\x61\x60\x95\x03\xf0\x4d\x1c\x12\x41\x61\xee\xa2\x2d\x37\x4d\xcf\x13\xa7\xc5\x98\x82\xde\x54\x94\x49\x23\xed\xf2\x6b\x3a\x37\xfb\x46\xb6\x72\x41\x5b\x75\xc1\x15\x13\xe5\xdb\x11\x8b\x20\xdb\x89\xe8\x8f\x6c\x29\x4b\x8b\x71\x17\x50\x9b\x1d\xed\xc2\x15\x55\xc6\x13\xcf\x2c\x0e\x55\x39\xd5\x4f\x0c\x89\xea\x01\x75\xa0\x1d\xdf\xd0\x71\xcc\x0b\x7d\x8c\x0f\xfd\x1d\xd6\x4f\xbd\xca\xaf\xae\xa8\x57\x1d\xed\xa6\x37\xe9\x62\xdd\xd0\x56\xfc\x70\xfe\xae\xe3\x8d\xb6\xca\xb6\x4d\x0b\xd6\x86\xb2\xce\xeLine truncated
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
return bindataRead(
@@ -4337,7 +4337,7 @@ func confLocaleLocale_enUsIni() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 50496, mode: os.FileMode(420), modTime: time.Unix(1457115284, 0)}
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 50409, mode: os.FileMode(420), modTime: time.Unix(1457156822, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
+31 -18
View File
@@ -18,7 +18,7 @@ function initCommentPreviewTab($form) {
var $preview_tab = $form.find('.tab.segment[data-tab="' + $tab_menu.data('preview') + '"]');
$preview_tab.html(data);
emojify.run($preview_tab[0]);
$('pre code', $preview_tab[0]).each(function(i, block) {
$('pre code', $preview_tab[0]).each(function (i, block) {
hljs.highlightBlock(block);
});
}
@@ -322,8 +322,7 @@ function initRepository() {
};
$('#edit-title').click(editTitleToggle);
$('#cancel-edit-title').click(editTitleToggle);
$('#save-edit-title').click(editTitleToggle).
click(function () {
$('#save-edit-title').click(editTitleToggle).click(function () {
if ($edit_input.val().length == 0 ||
$edit_input.val() == $issue_title.text()) {
$edit_input.val($issue_title.text());
@@ -385,7 +384,7 @@ function initRepository() {
} else {
$render_content.html(data.content);
emojify.run($render_content[0]);
$('pre code', $render_content[0]).each(function(i, block) {
$('pre code', $render_content[0]).each(function (i, block) {
hljs.highlightBlock(block);
});
}
@@ -521,10 +520,8 @@ function initOrganization() {
}
}
function initUser() {
if ($('.user').length == 0) {
return;
}
function initUserSettings() {
console.log('initUserSettings');
// Options
if ($('.user.settings.profile').length > 0) {
@@ -796,10 +793,7 @@ $(document).ready(function () {
// Show exact time
$('.time-since').each(function () {
$(this).addClass('poping up').
attr('data-content', $(this).attr('title')).
attr('data-variation', 'inverted tiny').
attr('title', '');
$(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny').attr('title', '');
});
// Semantic UI modules.
@@ -879,8 +873,8 @@ $(document).ready(function () {
ignore_emoticons: true
});
var hasEmoji = document.getElementsByClassName('has-emoji');
for (var i = 0; i < hasEmoji.length; i++) {
emojify.run(hasEmoji[i]);
for (var i = 0; i < hasEmoji.length; i++) {
emojify.run(hasEmoji[i]);
}
// Clipboard JS
@@ -928,6 +922,14 @@ $(document).ready(function () {
$('.show-modal.button').click(function () {
$($(this).data('modal')).modal('show');
});
$('.delete-post.button').click(function(){
var $this = $(this);
$.post($this.data('request-url'),{
"_csrf": csrf
}).done(function(){
window.location.href = $this.data('done-url');
});
});
// Set anchor.
$('.markdown').each(function () {
@@ -953,15 +955,25 @@ $(document).ready(function () {
searchUsers();
searchRepositories();
initCommentForm();
initInstall();
initRepository();
initWiki();
initOrganization();
initUser();
initWebhook();
initAdmin();
var routes = {
'div.user.settings': initUserSettings
};
var selector;
for (selector in routes) {
if ($(selector).length > 0) {
routes[selector]();
break;
}
}
});
$(window).load(function () {
@@ -1053,11 +1065,12 @@ $(window).load(function () {
case 'ssh':
if ($('#repo-clone-ssh').click().length === 0) {
$('#repo-clone-https').click();
};
}
;
break;
default:
$('#repo-clone-https').click();
break;
}
}
});
});
+27 -9
View File
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/Unknwon/com"
@@ -39,12 +40,13 @@ func Settings(ctx *middleware.Context) {
ctx.HTML(200, SETTINGS_PROFILE)
}
func handlerUsernameChange(ctx *middleware.Context, newName string) {
func handleUsernameChange(ctx *middleware.Context, newName string) {
// Non-local users are not allowed to change their username.
if len(newName) == 0 || !ctx.User.IsLocal() {
return
}
// Check if user name has been changed.
// Check if user name has been changed
if ctx.User.LowerName != strings.ToLower(newName) {
if err := models.ChangeUserName(ctx.User, newName); err != nil {
switch {
@@ -67,7 +69,8 @@ func handlerUsernameChange(ctx *middleware.Context, newName string) {
}
log.Trace("User name changed: %s -> %s", ctx.User.Name, newName)
}
// In case it's just a case change.
// In case it's just a case change
ctx.User.Name = newName
ctx.User.LowerName = strings.ToLower(newName)
}
@@ -81,7 +84,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
return
}
handlerUsernameChange(ctx, form.Name)
handleUsernameChange(ctx, form.Name)
if ctx.Written() {
return
}
@@ -98,7 +101,8 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
ctx.Handle(500, "UpdateUser", err)
return
}
log.Trace("User setting updated: %s", ctx.User.Name)
log.Trace("User settings updated: %s", ctx.User.Name)
ctx.Flash.Success(ctx.Tr("settings.update_profile_success"))
ctx.Redirect(setting.AppSubUrl + "/user/settings")
}
@@ -112,10 +116,11 @@ func UpdateAvatarSetting(ctx *middleware.Context, form auth.UploadAvatarForm, ct
if err != nil {
return fmt.Errorf("Avatar.Open: %v", err)
}
defer fr.Close()
data, err := ioutil.ReadAll(fr)
if err != nil {
return fmt.Errorf("ReadAll: %v", err)
return fmt.Errorf("ioutil.ReadAll: %v", err)
}
if _, ok := base.IsImageFile(data); !ok {
return errors.New(ctx.Tr("settings.uploaded_avatar_not_a_image"))
@@ -124,9 +129,12 @@ func UpdateAvatarSetting(ctx *middleware.Context, form auth.UploadAvatarForm, ct
return fmt.Errorf("UploadAvatar: %v", err)
}
} else {
// In case no avatar at all.
if form.Enable && !com.IsFile(ctx.User.CustomAvatarPath()) {
return errors.New(ctx.Tr("settings.no_custom_avatar_available"))
// No avatar is uploaded but setting has been changed to enable,
// generate a random one when needed.
if form.Enable && !com.IsFile(ctxUser.CustomAvatarPath()) {
if err := ctxUser.GenerateRandomAvatar(); err != nil {
log.Error(4, "GenerateRandomAvatar[%d]: %v", ctxUser.Id, err)
}
}
}
@@ -147,6 +155,16 @@ func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) {
ctx.Redirect(setting.AppSubUrl + "/user/settings")
}
func SettingsDeleteAvatar(ctx *middleware.Context) {
os.Remove(ctx.User.CustomAvatarPath())
ctx.User.UseCustomAvatar = false
if err := models.UpdateUser(ctx.User); err != nil {
ctx.Flash.Error(fmt.Sprintf("UpdateUser: %v", err))
}
ctx.Redirect(setting.AppSubUrl + "/user/settings")
}
func SettingsPassword(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsPassword"] = true
+1 -1
View File
@@ -1 +1 @@
0.8.57.0304
0.8.57.0305
+2 -2
View File
@@ -52,10 +52,9 @@
<form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data">
{{.CsrfTokenHtml}}
<div class="inline field">
<label>{{.i18n.Tr "settings.enable_custom_avatar"}}</label>
<div class="ui checkbox">
<input name="enable" type="checkbox" {{if .SignedUser.UseCustomAvatar}}checked{{end}}>
<label>{{.i18n.Tr "settings.enable_custom_avatar_helper"}}</label>
<label>{{.i18n.Tr "settings.enable_custom_avatar"}}</label>
</div>
</div>
<div class="inline field">
@@ -65,6 +64,7 @@
<div class="field">
<button class="ui green button">{{$.i18n.Tr "settings.update_avatar"}}</button>
<a class="ui red button delete-post" data-request-url="{{.Link}}/avatar/delete" data-done-url="{{.Link}}">{{$.i18n.Tr "settings.delete_current_avatar"}}</a>
</div>
</form>
</div>