Skip to content

Commit 776e72c

Browse files
committed
update to gitbucket 4.0.0; fixes #11
1 parent 671c5d7 commit 776e72c

File tree

4 files changed

+25
-34
lines changed

4 files changed

+25
-34
lines changed

README.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ It is then possible, for example, to notify every user that an upgrade of the sy
1616

1717
Plugin version | GitBucket version
1818
:--------------|:-----------------
19+
1.4.x | 4.x.y
1920
1.3.x | 3.11.x, 3.12.x
2021
1.2.x | 3.11.x
2122
1.1.x | 3.7.x -> 3.10.x
@@ -31,6 +32,9 @@ Plugin version | GitBucket version
3132

3233
## Release Notes
3334

35+
### 1.4.0
36+
- [issue-11](https://github.com/gitbucket-plugins/gitbucket-announce-plugin/issues/11) enahnce plugin compatibility, runs with gitbucket 4.0.0
37+
3438
### 1.3
3539
- [issue-10](https://github.com/gitbucket-plugins/gitbucket-announce-plugin/issues/10) allow sending to partial list of receivers, correct exception handling on email failure
3640

project/build.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object MyBuild extends Build {
77

88
val Organization = "fr.brouillard.gitbucket"
99
val Name = "gitbucket-announce-plugin"
10-
val Version = "1.3"
10+
val Version = "1.4.0"
1111
val ScalaVersion = "2.11.6"
1212

1313
lazy val project = Project (
@@ -25,11 +25,12 @@ object MyBuild extends Build {
2525
"amateras-repo" at "http://amateras.sourceforge.jp/mvn/"
2626
),
2727
libraryDependencies ++= Seq(
28-
"gitbucket" % "gitbucket-assembly" % "3.11.0" % "provided",
29-
"com.typesafe.play" %% "twirl-compiler" % "1.0.4" % "provided",
30-
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
31-
"org.apache.commons" % "commons-email" % "1.4" % "provided",
32-
"com.sun.mail" % "javax.mail" % "1.5.2" % "provided"
28+
"gitbucket" % "gitbucket-assembly" % "4.0.0" % "provided",
29+
"io.github.gitbucket" % "solidbase" % "1.0.0" % "provided",
30+
"com.typesafe.play" %% "twirl-compiler" % "1.0.4" % "provided",
31+
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
32+
"org.apache.commons" % "commons-email" % "1.4" % "provided",
33+
"com.sun.mail" % "javax.mail" % "1.5.2" % "provided"
3334
),
3435
javacOptions in compile ++= Seq("-target", "7", "-source", "7")
3536
).enablePlugins(SbtTwirl)

src/main/scala/Plugin.scala

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import javax.servlet.ServletContext
2-
31
import fr.brouillard.gitbucket.announce.controller.AnnounceController
4-
import gitbucket.core.plugin.PluginRegistry
5-
import gitbucket.core.service.SystemSettingsService.SystemSettings
6-
import gitbucket.core.util.Version
2+
import gitbucket.core.controller.Context
3+
import gitbucket.core.plugin.{Link, PluginRegistry}
4+
import io.github.gitbucket.solidbase.model.Version
75

86
class Plugin extends gitbucket.core.plugin.Plugin {
97
override val pluginId: String = "announce"
@@ -13,28 +11,16 @@ class Plugin extends gitbucket.core.plugin.Plugin {
1311
override val description: String = "Allows to handle announces for gitbucket"
1412

1513
override val versions: List[Version] = List(
16-
Version(1, 3)
17-
, Version(1, 2)
18-
, Version(1, 1)
19-
, Version(1, 0)
14+
new Version("1.4.0")
15+
, new Version("1.3.0")
16+
, new Version("1.2.0")
17+
, new Version("1.1.0")
18+
, new Version("1.0.0")
2019
)
2120

22-
override def javaScripts(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(String, String)] = {
23-
// Add Snippet link to the header
24-
val path = settings.baseUrl.getOrElse(context.getContextPath)
25-
Seq(
26-
".*/admin/announce" -> s"""
27-
|$$('#system-admin-menu-container>li:last').after(
28-
| $$('<li class="active"><a href="${path}/admin/announce">Global Announce</a></li>')
29-
|);
30-
""".stripMargin,
31-
".*/admin/(?!announce).*" -> s"""
32-
|$$('#system-admin-menu-container>li:last').after(
33-
| $$('<li><a href="${path}/admin/announce">Global Announce</a></li>')
34-
|);
35-
""".stripMargin
36-
)
37-
}
21+
override val systemSettingMenus: Seq[(Context) => Option[Link]] = Seq(
22+
(ctx: Context) => Some(Link("announce", "Global Announce", "admin/announce"))
23+
)
3824

3925
override val controllers = Seq(
4026
"/admin/announce" -> new AnnounceController()

src/main/twirl/fr/brouillard/gitbucket/announce/announce.scala.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
@information(info)
1111
<form action="@path/admin/announce" method="POST" validate="true">
1212
@if(settings.useSMTP && settings.smtp.nonEmpty){
13-
<div class="box">
14-
<div class="box-header">New announce</div>
15-
<div class="box-content">
13+
<div class="panel panel-default">
14+
<div class="panel-heading strong">New announce</div>
15+
<div class="panel-body">
1616
<fieldset>
1717
<label><span class="strong">To</span></label>
1818
<input type="text" style="width: 635px;" name="to"/>

0 commit comments

Comments
 (0)