Revert "Add MessageOfTheDay-entries to ServerInfo"
This reverts commit c77032cc74.
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
This commit is contained in:
@@ -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` ||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user