mirror of
				https://github.com/gitbucket/gitbucket.git
				synced 2025-10-31 10:36:05 +01:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			disable-gi
			...
			maintenanc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 7deea43c75 | ||
|  | 8842e1fef2 | ||
|  | 5090112c39 | ||
|  | d4a3e88f1a | ||
|  | acada42d3f | ||
|  | b6cfbcd19c | 
| @@ -58,6 +58,9 @@ Run the following commands in `Terminal` to | |||||||
|  |  | ||||||
| Release Notes | Release Notes | ||||||
| -------- | -------- | ||||||
|  | ### 1.11.1 - 06 Mar 2014 | ||||||
|  | - Bug fix | ||||||
|  |  | ||||||
| ### 1.11 - 01 Mar 2014 | ### 1.11 - 01 Mar 2014 | ||||||
| - Base URL for redirection, notification and repository URL box is configurable | - Base URL for redirection, notification and repository URL box is configurable | ||||||
| - Remove ```--https``` option because it's possible to substitute in the base url | - Remove ```--https``` option because it's possible to substitute in the base url | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ abstract class ControllerBase extends ScalatraFilter | |||||||
|   // Don't set content type via Accept header. |   // Don't set content type via Accept header. | ||||||
|   override def format(implicit request: HttpServletRequest) = "" |   override def format(implicit request: HttpServletRequest) = "" | ||||||
|  |  | ||||||
|   override def doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain) { |   override def doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain): Unit = try { | ||||||
|     val httpRequest  = request.asInstanceOf[HttpServletRequest] |     val httpRequest  = request.asInstanceOf[HttpServletRequest] | ||||||
|     val httpResponse = response.asInstanceOf[HttpServletResponse] |     val httpResponse = response.asInstanceOf[HttpServletResponse] | ||||||
|     val context      = request.getServletContext.getContextPath |     val context      = request.getServletContext.getContextPath | ||||||
| @@ -38,12 +38,15 @@ abstract class ControllerBase extends ScalatraFilter | |||||||
|       val account = httpRequest.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account] |       val account = httpRequest.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account] | ||||||
|       if(account == null){ |       if(account == null){ | ||||||
|         // Redirect to login form |         // Redirect to login form | ||||||
|  |         // TODO Should use the configured base url. | ||||||
|         httpResponse.sendRedirect(context + "/signin?" + StringUtil.urlEncode(path)) |         httpResponse.sendRedirect(context + "/signin?" + StringUtil.urlEncode(path)) | ||||||
|       } else if(account.isAdmin){ |       } else if(account.isAdmin){ | ||||||
|         // H2 Console (administrators only) |         // H2 Console (administrators only) | ||||||
|  |         // TODO Should use the configured base url. | ||||||
|         chain.doFilter(request, response) |         chain.doFilter(request, response) | ||||||
|       } else { |       } else { | ||||||
|         // Redirect to dashboard |         // Redirect to dashboard | ||||||
|  |         // TODO Should use the configured base url. | ||||||
|         httpResponse.sendRedirect(context + "/") |         httpResponse.sendRedirect(context + "/") | ||||||
|       } |       } | ||||||
|     } else if(path.startsWith("/git/")){ |     } else if(path.startsWith("/git/")){ | ||||||
| @@ -53,12 +56,25 @@ abstract class ControllerBase extends ScalatraFilter | |||||||
|       // Scalatra actions |       // Scalatra actions | ||||||
|       super.doFilter(request, response, chain) |       super.doFilter(request, response, chain) | ||||||
|     } |     } | ||||||
|  |   } finally { | ||||||
|  |     contextCache.remove(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   private val contextCache = new java.lang.ThreadLocal[Context]() | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * Returns the context object for the request. |    * Returns the context object for the request. | ||||||
|    */ |    */ | ||||||
|   implicit def context: Context = Context(servletContext.getContextPath, LoginAccount, request) |   implicit def context: Context = { | ||||||
|  |     contextCache.get match { | ||||||
|  |       case null => { | ||||||
|  |         val context = Context(loadSystemSettings().baseUrl.getOrElse(servletContext.getContextPath), LoginAccount, request) | ||||||
|  |         contextCache.set(context) | ||||||
|  |         context | ||||||
|  |       } | ||||||
|  |       case context => context | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   private def LoginAccount: Option[Account] = session.getAs[Account](Keys.Session.LoginAccount) |   private def LoginAccount: Option[Account] = session.getAs[Account](Keys.Session.LoginAccount) | ||||||
|  |  | ||||||
| @@ -116,15 +132,19 @@ abstract class ControllerBase extends ScalatraFilter | |||||||
|                        includeContextPath: Boolean = true, includeServletPath: Boolean = true) |                        includeContextPath: Boolean = true, includeServletPath: Boolean = true) | ||||||
|                       (implicit request: HttpServletRequest, response: HttpServletResponse) = |                       (implicit request: HttpServletRequest, response: HttpServletResponse) = | ||||||
|     if (path.startsWith("http")) path |     if (path.startsWith("http")) path | ||||||
|     else baseUrl + url(path, params, false, false) |     else baseUrl + url(path, params, false, false, false) | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Context object for the current request. |  * Context object for the current request. | ||||||
|  |  * | ||||||
|  |  * @param path the context path | ||||||
|  */ |  */ | ||||||
| case class Context(path: String, loginAccount: Option[Account], request: HttpServletRequest){ | case class Context(path: String, loginAccount: Option[Account], request: HttpServletRequest){ | ||||||
|  |  | ||||||
|  |   lazy val currentPath = request.getRequestURI.substring(request.getContextPath.length) | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * Get object from cache. |    * Get object from cache. | ||||||
|    * |    * | ||||||
|   | |||||||
| @@ -216,16 +216,16 @@ trait PullRequestsControllerBase extends ControllerBase { | |||||||
|             val oldBranch = JGitUtil.getDefaultBranch(oldGit, originRepository).get._2 |             val oldBranch = JGitUtil.getDefaultBranch(oldGit, originRepository).get._2 | ||||||
|             val newBranch = JGitUtil.getDefaultBranch(newGit, forkedRepository).get._2 |             val newBranch = JGitUtil.getDefaultBranch(newGit, forkedRepository).get._2 | ||||||
|  |  | ||||||
|             redirect(s"${context.path}/${forkedRepository.owner}/${forkedRepository.name}/compare/${originUserName}:${oldBranch}...${newBranch}") |             redirect(s"/${forkedRepository.owner}/${forkedRepository.name}/compare/${originUserName}:${oldBranch}...${newBranch}") | ||||||
|           } |           } | ||||||
|         } getOrElse NotFound |         } getOrElse NotFound | ||||||
|       } |       } | ||||||
|       case _ => { |       case _ => { | ||||||
|         using(Git.open(getRepositoryDir(forkedRepository.owner, forkedRepository.name))){ git => |         using(Git.open(getRepositoryDir(forkedRepository.owner, forkedRepository.name))){ git => | ||||||
|           JGitUtil.getDefaultBranch(git, forkedRepository).map { case (_, defaultBranch) => |           JGitUtil.getDefaultBranch(git, forkedRepository).map { case (_, defaultBranch) => | ||||||
|             redirect(s"${context.path}/${forkedRepository.owner}/${forkedRepository.name}/compare/${defaultBranch}...${defaultBranch}") |             redirect(s"/${forkedRepository.owner}/${forkedRepository.name}/compare/${defaultBranch}...${defaultBranch}") | ||||||
|           } getOrElse { |           } getOrElse { | ||||||
|             redirect(s"${context.path}/${forkedRepository.owner}/${forkedRepository.name}") |             redirect(s"/${forkedRepository.owner}/${forkedRepository.name}") | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -119,16 +119,10 @@ trait IssuesService { | |||||||
|     // get issues and comment count and labels |     // get issues and comment count and labels | ||||||
|     searchIssueQuery(repos, condition, filterUser, onlyPullRequest) |     searchIssueQuery(repos, condition, filterUser, onlyPullRequest) | ||||||
|         .innerJoin(IssueOutline).on { (t1, t2) => t1.byIssue(t2.userName, t2.repositoryName, t2.issueId) } |         .innerJoin(IssueOutline).on { (t1, t2) => t1.byIssue(t2.userName, t2.repositoryName, t2.issueId) } | ||||||
|         .leftJoin (IssueLabels) .on { case ((t1, t2), t3) => t1.byIssue(t3.userName, t3.repositoryName, t3.issueId) } |         .sortBy { case (t1, t2) => | ||||||
|         .leftJoin (Labels)      .on { case (((t1, t2), t3), t4) => t3.byLabel(t4.userName, t4.repositoryName, t4.labelId) } |  | ||||||
|         .map { case (((t1, t2), t3), t4) => |  | ||||||
|           (t1, t2.commentCount, t4.labelId.?, t4.labelName.?, t4.color.?) |  | ||||||
|         } |  | ||||||
|         .sortBy(_._4)	// labelName |  | ||||||
|         .sortBy { case (t1, commentCount, _,_,_) => |  | ||||||
|           (condition.sort match { |           (condition.sort match { | ||||||
|             case "created"  => t1.registeredDate |             case "created"  => t1.registeredDate | ||||||
|             case "comments" => commentCount |             case "comments" => t2.commentCount | ||||||
|             case "updated"  => t1.updatedDate |             case "updated"  => t1.updatedDate | ||||||
|           }) match { |           }) match { | ||||||
|             case sort => condition.direction match { |             case sort => condition.direction match { | ||||||
| @@ -138,6 +132,11 @@ trait IssuesService { | |||||||
|           } |           } | ||||||
|         } |         } | ||||||
|         .drop(offset).take(limit) |         .drop(offset).take(limit) | ||||||
|  |         .leftJoin (IssueLabels) .on { case ((t1, t2), t3) => t1.byIssue(t3.userName, t3.repositoryName, t3.issueId) } | ||||||
|  |         .leftJoin (Labels)      .on { case (((t1, t2), t3), t4) => t3.byLabel(t4.userName, t4.repositoryName, t4.labelId) } | ||||||
|  |         .map { case (((t1, t2), t3), t4) => | ||||||
|  |           (t1, t2.commentCount, t4.labelId.?, t4.labelName.?, t4.color.?) | ||||||
|  |         } | ||||||
|         .list |         .list | ||||||
|         .splitWith { (c1, c2) => |         .splitWith { (c1, c2) => | ||||||
|           c1._1.userName == c2._1.userName && |           c1._1.userName == c2._1.userName && | ||||||
|   | |||||||
| @@ -61,7 +61,7 @@ | |||||||
|                 } |                 } | ||||||
|                 <a href="@path/signout" class="menu-last" data-toggle="tooltip" data-placement="bottom" title="Sign out"><i class="icon-share-alt"></i></a> |                 <a href="@path/signout" class="menu-last" data-toggle="tooltip" data-placement="bottom" title="Sign out"><i class="icon-share-alt"></i></a> | ||||||
|               } else { |               } else { | ||||||
|                 <a href="@path/signin" class="btn btn-last" id="signin">Sign in</a> |                 <a href="@path/signin?redirect=@urlEncode(currentPath)" class="btn btn-last" id="signin">Sign in</a> | ||||||
|               } |               } | ||||||
|             </div><!--/.nav-collapse --> |             </div><!--/.nav-collapse --> | ||||||
|           </div> |           </div> | ||||||
| @@ -76,7 +76,6 @@ | |||||||
|         $('#search').submit(function(){ |         $('#search').submit(function(){ | ||||||
|           return $.trim($(this).find('input[name=query]').val()) != ''; |           return $.trim($(this).find('input[name=query]').val()) != ''; | ||||||
|         }); |         }); | ||||||
|         $('#signin').attr('href', '@path/signin?redirect=' + encodeURIComponent(location.pathname + location.search + location.hash)); |  | ||||||
|       }); |       }); | ||||||
|     </script> |     </script> | ||||||
|   </body> |   </body> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user