aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DismissSonarlintAdAction.java58
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UsersWsModule.java1
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/DismissSonarlintAdActionTest.java77
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java1
4 files changed, 0 insertions, 137 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DismissSonarlintAdAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DismissSonarlintAdAction.java
deleted file mode 100644
index 01c4d5ed7c6..00000000000
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DismissSonarlintAdAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.user.ws;
-
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.server.user.UserSession;
-
-import static org.sonar.server.user.ws.DismissNoticeAction.SONARLINT_AD;
-import static org.sonarqube.ws.client.user.UsersWsParameters.ACTION_DISMISS_SONARLINT_AD;
-
-/**
- * @deprecated use DismissNoticeAction
- */
-@Deprecated(since = "9.6", forRemoval = true)
-public class DismissSonarlintAdAction implements UsersWsAction {
- private final UserSession userSession;
- private final DismissNoticeAction dismissNoticeAction;
-
- public DismissSonarlintAdAction(UserSession userSession, DismissNoticeAction dismissNoticeAction) {
- this.userSession = userSession;
- this.dismissNoticeAction = dismissNoticeAction;
- }
-
- @Override
- public void define(WebService.NewController controller) {
- controller.createAction(ACTION_DISMISS_SONARLINT_AD)
- .setDescription("Dismiss SonarLint advertisement. Deprecated since 9.6, replaced api/users/dismiss_notice")
- .setSince("9.2")
- .setPost(true)
- .setDeprecatedSince("9.6")
- .setHandler(this);
- }
-
- @Override
- public void handle(Request request, Response response) throws Exception {
- userSession.checkLoggedIn();
- dismissNoticeAction.dismissNotice(response, userSession.getUuid(), SONARLINT_AD);
- }
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UsersWsModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UsersWsModule.java
index f97f22edfd9..eae85baf6bb 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UsersWsModule.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UsersWsModule.java
@@ -33,7 +33,6 @@ public class UsersWsModule extends Module {
UpdateLoginAction.class,
DeactivateAction.class,
UserDeactivator.class,
- DismissSonarlintAdAction.class,
ChangePasswordAction.class,
CurrentAction.class,
SearchAction.class,
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/DismissSonarlintAdActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/DismissSonarlintAdActionTest.java
deleted file mode 100644
index 24484d4d1cb..00000000000
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/DismissSonarlintAdActionTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.user.ws;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-import org.sonar.db.user.UserDto;
-import org.sonar.server.exceptions.UnauthorizedException;
-import org.sonar.server.tester.UserSessionRule;
-import org.sonar.server.ws.TestRequest;
-import org.sonar.server.ws.WsActionTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonarqube.ws.client.user.UsersWsParameters.ACTION_DISMISS_SONARLINT_AD;
-
-public class DismissSonarlintAdActionTest {
- @Rule
- public UserSessionRule userSession = UserSessionRule.standalone();
- @Rule
- public DbTester db = DbTester.create(System2.INSTANCE);
-
- private final DismissNoticeAction dismissNoticeAction = new DismissNoticeAction(userSession, db.getDbClient());
- private final WsActionTester underTest = new WsActionTester(new DismissSonarlintAdAction(userSession, dismissNoticeAction));
-
- @Test
- public void test_definition() {
- WebService.Action definition = underTest.getDef();
- assertThat(definition.key()).isEqualTo(ACTION_DISMISS_SONARLINT_AD);
- assertThat(definition.description()).isEqualTo("Dismiss SonarLint advertisement. Deprecated since 9.6, replaced api/users/dismiss_notice");
- assertThat(definition.since()).isEqualTo("9.2");
- assertThat(definition.isPost()).isTrue();
- assertThat(definition.params()).isEmpty();
- assertThat(definition.changelog()).isEmpty();
- }
-
- @Test
- public void endpoint_throw_exception_if_no_user_login() {
- final TestRequest request = underTest.newRequest();
- assertThatThrownBy(request::execute)
- .isInstanceOf(UnauthorizedException.class);
- }
-
- @Test
- public void calling_endpoint_should_set_sonarlint_ad_seen_true() {
- UserDto user = db.users().insertUser(u -> u
- .setLogin("obiwan.kenobi")
- .setName("Obiwan Kenobi")
- .setEmail(null));
- userSession.logIn(user);
- assertThat(db.properties().findFirstUserProperty(userSession.getUuid(), "user.dismissedNotices.sonarlintAd")).isEmpty();
-
- underTest.newRequest().execute();
- UserDto updatedUser = db.users().selectUserByLogin(user.getLogin()).get();
- assertThat(db.properties().findFirstUserProperty(userSession.getUuid(), "user.dismissedNotices.sonarlintAd")).isPresent();
- }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java
index 99be8a4191d..315502e4c16 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java
@@ -29,7 +29,6 @@ public class UsersWsParameters {
public static final String ACTION_UPDATE = "update";
public static final String ACTION_CURRENT = "current";
public static final String ACTION_UPDATE_IDENTITY_PROVIDER = "update_identity_provider";
- public static final String ACTION_DISMISS_SONARLINT_AD = "dismiss_sonarlint_ad";
public static final String PARAM_LOGIN = "login";
public static final String PARAM_PASSWORD = "password";