summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Draebing <thomas.draebing@sap.com>2020-02-03 15:31:21 +0100
committerThomas Draebing <thomas.draebing@sap.com>2020-02-03 15:40:38 +0100
commitc9c27621607853b1f781b3a5a3a5d8e23e5282f5 (patch)
tree2b23a76281ad39caa60f2ee22bff8dc812ebc909
parent265559f5ad83a24379193d2bd5ce05d32ab6bc3c (diff)
Revert "Add MessageOfTheDay-entries to ServerInfo"
This reverts commit c77032cc74b2d766cb8eb69b65a205dd0d8a5887. The message of the day functionality is still heavily depended on components of Gerrit core. It is planned to move this functionality completely to the plugin. Since it was not usable with the new UI for a long while, the functionality will be removed completely until then. Change-Id: I7a426d1814f29b3674283ee22132cee326894470
-rw-r--r--Documentation/rest-api-config.txt19
-rw-r--r--java/com/google/gerrit/extensions/common/MessageOfTheDayInfo.java27
-rw-r--r--java/com/google/gerrit/extensions/common/ServerInfo.java3
-rw-r--r--java/com/google/gerrit/server/restapi/config/GetServerInfo.java24
4 files changed, 1 insertions, 72 deletions
diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt
index c83ed103d7..93591120e7 100644
--- a/Documentation/rest-api-config.txt
+++ b/Documentation/rest-api-config.txt
@@ -1896,21 +1896,6 @@ The maximal memory size. The value is returned with a unit abbreviation
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.
-
-[options="header",cols="1,^1,5"]
-|===========================
-|Field Name ||Description
-|`id` ||ID of the message.
-|`redisplay` ||
-Date and Time, when the message should be displayed again after it was dismissed
-by the user.
-|`html` ||Message in HTML-format.
-|===========================
-
[[plugin-config-info]]
=== PluginConfigInfo
The `PluginConfigInfo` entity contains information about Gerrit
@@ -1964,10 +1949,6 @@ information about Gerrit
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[
-MessageOfTheDayInfo] entities.
|`note_db_enabled` |not set if `false`|
Whether the NoteDb storage backend is fully enabled.
|`plugin` ||
diff --git a/java/com/google/gerrit/extensions/common/MessageOfTheDayInfo.java b/java/com/google/gerrit/extensions/common/MessageOfTheDayInfo.java
deleted file mode 100644
index f752f86a64..0000000000
--- a/java/com/google/gerrit/extensions/common/MessageOfTheDayInfo.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2020 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.gerrit.extensions.common;
-
-import java.util.Date;
-
-/** REST API representation of a "message of the day". */
-public class MessageOfTheDayInfo {
- /** The ID of the message. */
- public String id;
- /** The date and time the message will be displayed again after being dismissed by the user. */
- public Date redisplay;
- /** The message in HTML-format. */
- public String html;
-}
diff --git a/java/com/google/gerrit/extensions/common/ServerInfo.java b/java/com/google/gerrit/extensions/common/ServerInfo.java
index 1d7de26564..82d5bc8061 100644
--- a/java/com/google/gerrit/extensions/common/ServerInfo.java
+++ b/java/com/google/gerrit/extensions/common/ServerInfo.java
@@ -14,15 +14,12 @@
package com.google.gerrit.extensions.common;
-import java.util.List;
-
public class ServerInfo {
public AccountsInfo accounts;
public AuthInfo auth;
public ChangeConfigInfo change;
public DownloadInfo download;
public GerritInfo gerrit;
- public List<MessageOfTheDayInfo> messages;
public Boolean noteDbEnabled;
public PluginConfigInfo plugin;
public SshdInfo sshd;
diff --git a/java/com/google/gerrit/server/restapi/config/GetServerInfo.java b/java/com/google/gerrit/server/restapi/config/GetServerInfo.java
index cfd9f580ea..aa0e350481 100644
--- a/java/com/google/gerrit/server/restapi/config/GetServerInfo.java
+++ b/java/com/google/gerrit/server/restapi/config/GetServerInfo.java
@@ -26,7 +26,6 @@ import com.google.gerrit.extensions.common.ChangeConfigInfo;
import com.google.gerrit.extensions.common.DownloadInfo;
import com.google.gerrit.extensions.common.DownloadSchemeInfo;
import com.google.gerrit.extensions.common.GerritInfo;
-import com.google.gerrit.extensions.common.MessageOfTheDayInfo;
import com.google.gerrit.extensions.common.PluginConfigInfo;
import com.google.gerrit.extensions.common.ReceiveInfo;
import com.google.gerrit.extensions.common.ServerInfo;
@@ -36,9 +35,7 @@ import com.google.gerrit.extensions.common.UserConfigInfo;
import com.google.gerrit.extensions.config.CloneCommand;
import com.google.gerrit.extensions.config.DownloadCommand;
import com.google.gerrit.extensions.config.DownloadScheme;
-import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.extensions.restapi.RestReadView;
-import com.google.gerrit.extensions.systemstatus.MessageOfTheDay;
import com.google.gerrit.extensions.webui.WebUiPlugin;
import com.google.gerrit.server.EnableSignedPush;
import com.google.gerrit.server.account.AccountVisibilityProvider;
@@ -68,7 +65,6 @@ import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.lib.Config;
@@ -93,7 +89,6 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
private final AgreementJson agreementJson;
private final ChangeIndexCollection indexes;
private final SitePaths sitePaths;
- private final DynamicSet<MessageOfTheDay> messages;
@Inject
public GetServerInfo(
@@ -115,8 +110,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
ProjectCache projectCache,
AgreementJson agreementJson,
ChangeIndexCollection indexes,
- SitePaths sitePaths,
- DynamicSet<MessageOfTheDay> motd) {
+ SitePaths sitePaths) {
this.config = config;
this.accountVisibilityProvider = accountVisibilityProvider;
this.authConfig = authConfig;
@@ -136,7 +130,6 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
this.agreementJson = agreementJson;
this.indexes = indexes;
this.sitePaths = sitePaths;
- this.messages = motd;
}
@Override
@@ -147,7 +140,6 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
info.change = getChangeInfo();
info.download = getDownloadInfo();
info.gerrit = getGerritInfo();
- info.messages = getMessages();
info.noteDbEnabled = true;
info.plugin = getPluginInfo();
info.defaultTheme = getDefaultTheme();
@@ -309,20 +301,6 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
return CharMatcher.is('/').trimTrailingFrom(docUrl) + '/';
}
- private List<MessageOfTheDayInfo> getMessages() {
- return this.messages.stream()
- .filter(motd -> !Strings.isNullOrEmpty(motd.getHtmlMessage()))
- .map(
- motd -> {
- MessageOfTheDayInfo m = new MessageOfTheDayInfo();
- m.id = motd.getMessageId();
- m.redisplay = motd.getRedisplay();
- m.html = motd.getHtmlMessage();
- return m;
- })
- .collect(toList());
- }
-
private PluginConfigInfo getPluginInfo() {
PluginConfigInfo info = new PluginConfigInfo();
info.hasAvatars = toBoolean(avatar.hasImplementation());