diff options
author | Thomas Draebing <thomas.draebing@sap.com> | 2020-01-31 10:45:23 +0100 |
---|---|---|
committer | Thomas Draebing <thomas.draebing@sap.com> | 2020-01-31 10:45:23 +0100 |
commit | cfff720610374fe538649f272a762569bb785998 (patch) | |
tree | 4264c8b48c1cac66424f4cf8efbb66165c1aca1b | |
parent | 1fbf53df6049cdadc8b2b2dd5bb61a19eefd90d4 (diff) |
Document MessageOfTheDay extension
Change-Id: I99894e9d9b0376e11ac47796cee4c9e2e0c9be5a
-rw-r--r-- | Documentation/dev-plugins.txt | 34 | ||||
-rw-r--r-- | Documentation/rest-api-config.txt | 8 |
2 files changed, 39 insertions, 3 deletions
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt index 974e3706ca..64cae2d5a6 100644 --- a/Documentation/dev-plugins.txt +++ b/Documentation/dev-plugins.txt @@ -2954,6 +2954,40 @@ to change in order to be compliant. These requirements should be kept once they are met, but marked as `OK`. If the requirements were not displayed, reviewers would need to use their precious time to manually check that they were met. +[[message-of-the-day]] +== Posting Messages (Of The Day) to the UI +Gerrit provides an extension point that enables plugins to implement a method to +collect messages that will then be shown below the main header in the Gerrit UI. + +[source, java] +---- +import com.google.gerrit.extensions.systemstatus.MessageOfTheDay; + +@Singleton +class MessageOfTheDayImpl extends MessageOfTheDay { + + private final String id; + private final String msg; + + public MessageOfTheDayImpl() { + id = "hello"; + msg = "I just wanted to say <b>hello</b>."; + } + + @Override + public String getHtmlMessage() { + return msg; + } + + @Override + public String getMessageId() { + return id; + } +} +---- + +Note, that the message will be added as HTML and parsed into the DOM. Thus, +plugins using this extension should ensure that the message content is safe. == SEE ALSO diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt index 0e4cac28f1..905c3ef830 100644 --- a/Documentation/rest-api-config.txt +++ b/Documentation/rest-api-config.txt @@ -1908,7 +1908,8 @@ The number of open files. [[message-of-the-day-info]] === MessageOfTheDayInfo The `MessageOfTheDayInfo` entity contains information about a message -that was registered with the `MessageOfTheDay`-extension by plugins. +that was registered with the +link:dev-plugins.html#message-of-the-day[MessageOfTheDay]-extension by plugins. [options="header",cols="1,^1,5"] |=========================== @@ -1974,8 +1975,9 @@ Information about the configuration from the link:config-gerrit.html#gerrit[gerrit] section as link:#gerrit-info[ GerritInfo] entity. |`messages` || -List of messages registered with the `MessageOfTheDay`- -extension containing link:#message-of-the-day-info[ +List of messages registered with the +link:dev-plugins.html#message-of-the-day[MessageOfTheDay]-extension +containing link:#message-of-the-day-info[ MessageOfTheDayInfo] entities. |`note_db_enabled` |not set if `false`| Whether the NoteDb storage backend is fully enabled. |