mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	Use variables for times
This commit is contained in:
		@@ -22,16 +22,24 @@ type IssueWatch struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// BeforeInsert is invoked from XORM before inserting an object of this type.
 | 
					// BeforeInsert is invoked from XORM before inserting an object of this type.
 | 
				
			||||||
func (iw *IssueWatch) BeforeInsert() {
 | 
					func (iw *IssueWatch) BeforeInsert() {
 | 
				
			||||||
	iw.Created = time.Now()
 | 
						var (
 | 
				
			||||||
	iw.CreatedUnix = time.Now().Unix()
 | 
							t = time.Now()
 | 
				
			||||||
	iw.Updated = time.Now()
 | 
							u = t.Unix()
 | 
				
			||||||
	iw.UpdatedUnix = time.Now().Unix()
 | 
						)
 | 
				
			||||||
 | 
						iw.Created = t
 | 
				
			||||||
 | 
						iw.CreatedUnix = u
 | 
				
			||||||
 | 
						iw.Updated = t
 | 
				
			||||||
 | 
						iw.UpdatedUnix = u
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// BeforeUpdate is invoked from XORM before updating an object of this type.
 | 
					// BeforeUpdate is invoked from XORM before updating an object of this type.
 | 
				
			||||||
func (iw *IssueWatch) BeforeUpdate() {
 | 
					func (iw *IssueWatch) BeforeUpdate() {
 | 
				
			||||||
	iw.Updated = time.Now()
 | 
						var (
 | 
				
			||||||
	iw.UpdatedUnix = time.Now().Unix()
 | 
							t = time.Now()
 | 
				
			||||||
 | 
							u = t.Unix()
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						iw.Updated = t
 | 
				
			||||||
 | 
						iw.UpdatedUnix = u
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CreateOrUpdateIssueWatch set watching for a user and issue
 | 
					// CreateOrUpdateIssueWatch set watching for a user and issue
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user