1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

Add bio field for user (#6113)

Fix #4339
This commit is contained in:
techknowlogick 2019-03-18 22:28:10 -04:00 committed by GitHub
parent ba2f6a45c8
commit d1c982cb73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 6 deletions

View File

@ -104,6 +104,7 @@ type User struct {
Rands string `xorm:"VARCHAR(10)"` Rands string `xorm:"VARCHAR(10)"`
Salt string `xorm:"VARCHAR(10)"` Salt string `xorm:"VARCHAR(10)"`
Language string `xorm:"VARCHAR(5)"` Language string `xorm:"VARCHAR(5)"`
Description string
CreatedUnix util.TimeStamp `xorm:"INDEX created"` CreatedUnix util.TimeStamp `xorm:"INDEX created"`
UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` UpdatedUnix util.TimeStamp `xorm:"INDEX updated"`
@ -134,7 +135,6 @@ type User struct {
NumRepos int NumRepos int
// For organization // For organization
Description string
NumTeams int NumTeams int
NumMembers int NumMembers int
Teams []*Team `xorm:"-"` Teams []*Team `xorm:"-"`

View File

@ -201,6 +201,7 @@ type UpdateProfileForm struct {
Website string `binding:"ValidUrl;MaxSize(255)"` Website string `binding:"ValidUrl;MaxSize(255)"`
Location string `binding:"MaxSize(50)"` Location string `binding:"MaxSize(50)"`
Language string `binding:"Size(5)"` Language string `binding:"Size(5)"`
Description string `binding:"MaxSize(255)"`
} }
// Validate validates the fields // Validate validates the fields

View File

@ -334,6 +334,7 @@ following = Following
follow = Follow follow = Follow
unfollow = Unfollow unfollow = Unfollow
heatmap.loading = Loading Heatmap… heatmap.loading = Loading Heatmap…
user_bio = Biography
form.name_reserved = The username '%s' is reserved. form.name_reserved = The username '%s' is reserved.
form.name_pattern_not_allowed = The pattern '%s' is not allowed in a username. form.name_pattern_not_allowed = The pattern '%s' is not allowed in a username.

View File

@ -92,6 +92,7 @@ func ProfilePost(ctx *context.Context, form auth.UpdateProfileForm) {
ctx.User.Website = form.Website ctx.User.Website = form.Website
ctx.User.Location = form.Location ctx.User.Location = form.Location
ctx.User.Language = form.Language ctx.User.Language = form.Language
ctx.User.Description = form.Description
if err := models.UpdateUserSetting(ctx.User); err != nil { if err := models.UpdateUserSetting(ctx.User); err != nil {
if _, ok := err.(models.ErrEmailAlreadyUsed); ok { if _, ok := err.(models.ErrEmailAlreadyUsed); ok {
ctx.Flash.Error(ctx.Tr("form.email_been_used")) ctx.Flash.Error(ctx.Tr("form.email_been_used"))

View File

@ -34,6 +34,12 @@
<a target="_blank" rel="noopener noreferrer me" href="{{.Owner.Website}}">{{.Owner.Website}}</a> <a target="_blank" rel="noopener noreferrer me" href="{{.Owner.Website}}">{{.Owner.Website}}</a>
</li> </li>
{{end}} {{end}}
{{if .Owner.Description}}
<li>
<i class="octicon octicon-info"></i>
<span>{{.Owner.Description}}</span>
</li>
{{end}}
{{range .OpenIDs}} {{range .OpenIDs}}
{{if .Show}} {{if .Show}}
<li> <li>

View File

@ -31,6 +31,10 @@
<input name="keep_email_private" type="checkbox" {{if .SignedUser.KeepEmailPrivate}}checked{{end}}> <input name="keep_email_private" type="checkbox" {{if .SignedUser.KeepEmailPrivate}}checked{{end}}>
</div> </div>
</div> </div>
<div class="field {{if .Err_Description}}error{{end}}">
<label for="description">{{$.i18n.Tr "user.user_bio"}}</label>
<textarea id="description" name="description" rows="2">{{.SignedUser.Description}}</textarea>
</div>
<div class="field {{if .Err_Website}}error{{end}}"> <div class="field {{if .Err_Website}}error{{end}}">
<label for="website">{{.i18n.Tr "settings.website"}}</label> <label for="website">{{.i18n.Tr "settings.website"}}</label>
<input id="website" name="website" type="url" value="{{.SignedUser.Website}}"> <input id="website" name="website" type="url" value="{{.SignedUser.Website}}">