mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-11-02 07:21:02 +00:00
[GITEA] Allow user to select email for file operations in Web UI
- Add a dropdown to the web interface for changing files to select which Email should be used for the commit. It only shows (and verifies) that a activated mail can be used, while this isn't necessary, it's better to have this already in place. - Added integration testing. - Resolves https://codeberg.org/forgejo/forgejo/issues/281 (cherry picked from commit564e701f40) (cherry picked from commitde8f2e03cc) (cherry picked from commit0182cff12e) (cherry picked from commit9c74254d46) (cherry picked from commit2f0b68f821) (cherry picked from commit079b995d49) (cherry picked from commit6952ea6ee3) (cherry picked from commit6c7d5a5d14)
This commit is contained in:
parent
97f02df163
commit
49c39f0ed5
10 changed files with 303 additions and 25 deletions
|
|
@ -189,6 +189,25 @@ func GetEmailAddresses(ctx context.Context, uid int64) ([]*EmailAddress, error)
|
|||
return emails, nil
|
||||
}
|
||||
|
||||
type ActivatedEmailAddress struct {
|
||||
ID int64
|
||||
Email string
|
||||
}
|
||||
|
||||
func GetActivatedEmailAddresses(ctx context.Context, uid int64) ([]*ActivatedEmailAddress, error) {
|
||||
emails := make([]*ActivatedEmailAddress, 0, 8)
|
||||
if err := db.GetEngine(ctx).
|
||||
Table("email_address").
|
||||
Select("id, email").
|
||||
Where("uid=?", uid).
|
||||
And("is_activated=?", true).
|
||||
Asc("id").
|
||||
Find(&emails); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return emails, nil
|
||||
}
|
||||
|
||||
// GetEmailAddressByID gets a user's email address by ID
|
||||
func GetEmailAddressByID(ctx context.Context, uid, id int64) (*EmailAddress, error) {
|
||||
// User ID is required for security reasons
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue