diff --git a/components/gitpod-protocol/go/gitpod-service.go b/components/gitpod-protocol/go/gitpod-service.go index 5ade0a301746fa..a2ff1d798e2bce 100644 --- a/components/gitpod-protocol/go/gitpod-service.go +++ b/components/gitpod-protocol/go/gitpod-service.go @@ -73,7 +73,6 @@ type APIInterface interface { GetGitpodTokens(ctx context.Context) (res []*APIToken, err error) GenerateNewGitpodToken(ctx context.Context, options *GenerateNewGitpodTokenOptions) (res string, err error) DeleteGitpodToken(ctx context.Context, tokenHash string) (err error) - SendFeedback(ctx context.Context, feedback string) (res string, err error) RegisterGithubApp(ctx context.Context, installationID string) (err error) TakeSnapshot(ctx context.Context, options *TakeSnapshotOptions) (res string, err error) WaitForSnapshot(ctx context.Context, snapshotId string) (err error) @@ -191,8 +190,6 @@ const ( FunctionGenerateNewGitpodToken FunctionName = "generateNewGitpodToken" // FunctionDeleteGitpodToken is the name of the deleteGitpodToken function FunctionDeleteGitpodToken FunctionName = "deleteGitpodToken" - // FunctionSendFeedback is the name of the sendFeedback function - FunctionSendFeedback FunctionName = "sendFeedback" // FunctionRegisterGithubApp is the name of the registerGithubApp function FunctionRegisterGithubApp FunctionName = "registerGithubApp" // FunctionTakeSnapshot is the name of the takeSnapshot function @@ -1272,26 +1269,6 @@ func (gp *APIoverJSONRPC) DeleteGitpodToken(ctx context.Context, tokenHash strin return } -// SendFeedback calls sendFeedback on the server -func (gp *APIoverJSONRPC) SendFeedback(ctx context.Context, feedback string) (res string, err error) { - if gp == nil { - err = errNotConnected - return - } - var _params []interface{} - - _params = append(_params, feedback) - - var result string - err = gp.C.Call(ctx, "sendFeedback", _params, &result) - if err != nil { - return - } - res = result - - return -} - // RegisterGithubApp calls registerGithubApp on the server func (gp *APIoverJSONRPC) RegisterGithubApp(ctx context.Context, installationID string) (err error) { if gp == nil { diff --git a/components/gitpod-protocol/go/mock.go b/components/gitpod-protocol/go/mock.go index f50826801d5461..fd159cdfd5dd2f 100644 --- a/components/gitpod-protocol/go/mock.go +++ b/components/gitpod-protocol/go/mock.go @@ -703,21 +703,6 @@ func (mr *MockAPIInterfaceMockRecorder) RegisterGithubApp(ctx, installationID in return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGithubApp", reflect.TypeOf((*MockAPIInterface)(nil).RegisterGithubApp), ctx, installationID) } -// SendFeedback mocks base method. -func (m *MockAPIInterface) SendFeedback(ctx context.Context, feedback string) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendFeedback", ctx, feedback) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SendFeedback indicates an expected call of SendFeedback. -func (mr *MockAPIInterfaceMockRecorder) SendFeedback(ctx, feedback interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendFeedback", reflect.TypeOf((*MockAPIInterface)(nil).SendFeedback), ctx, feedback) -} - // SendHeartBeat mocks base method. func (m *MockAPIInterface) SendHeartBeat(ctx context.Context, options *SendHeartBeatOptions) error { m.ctrl.T.Helper() diff --git a/components/gitpod-protocol/src/gitpod-service.ts b/components/gitpod-protocol/src/gitpod-service.ts index 57d592b74b57a7..0806d61460036f 100644 --- a/components/gitpod-protocol/src/gitpod-service.ts +++ b/components/gitpod-protocol/src/gitpod-service.ts @@ -206,7 +206,6 @@ export interface GitpodServer extends JsonRpcServer, AdminServer, deleteGitpodToken(tokenHash: string): Promise; // misc - sendFeedback(feedback: string): Promise; isGitHubAppEnabled(): Promise; registerGithubApp(installationId: string): Promise; diff --git a/components/server/ee/src/workspace/gitpod-server-impl.ts b/components/server/ee/src/workspace/gitpod-server-impl.ts index 578a49a365b793..dabe2b3e556a8a 100644 --- a/components/server/ee/src/workspace/gitpod-server-impl.ts +++ b/components/server/ee/src/workspace/gitpod-server-impl.ts @@ -85,7 +85,6 @@ import * as pThrottle from "p-throttle"; import { formatDate } from "@gitpod/gitpod-protocol/lib/util/date-time"; import { FindUserByIdentityStrResult, UserService } from "../../../src/user/user-service"; import { - Accounting, AccountService, SubscriptionService, TeamSubscriptionService, @@ -2449,22 +2448,6 @@ export class GitpodServerEEImpl extends GitpodServerImpl { return this.billingModes.getBillingMode(parsedAttributionId, new Date()); } - // various - async sendFeedback(ctx: TraceContext, feedback: string): Promise { - traceAPIParams(ctx, {}); // feedback is not interesting here, any may contain names - - const user = this.checkUser("sendFeedback"); - const now = new Date().toISOString(); - const remainingUsageHours = await this.getRemainingUsageHours(ctx); - const stillEnoughCredits = remainingUsageHours > Math.max(...Accounting.LOW_CREDIT_WARNINGS_IN_HOURS); - log.info({ userId: user.id }, `Feedback: "${feedback}"`, { feedback, stillEnoughCredits }); - if (stillEnoughCredits) { - return "Thank you for your feedback."; - } - await this.subscriptionService.addCredit(user.id, 50, now); - return "Thank you for you feedback. We have added 50 Gitpod Hours to your account. Have fun!"; - } - // Projects async getProviderRepositoriesForUser( ctx: TraceContext, diff --git a/components/server/src/auth/rate-limiter.ts b/components/server/src/auth/rate-limiter.ts index 8b7d6dd1322cd5..48d0952aca709a 100644 --- a/components/server/src/auth/rate-limiter.ts +++ b/components/server/src/auth/rate-limiter.ts @@ -122,7 +122,6 @@ const defaultFunctions: FunctionsConfig = { getGitpodTokens: { group: "default", points: 1 }, generateNewGitpodToken: { group: "default", points: 1 }, deleteGitpodToken: { group: "default", points: 1 }, - sendFeedback: { group: "default", points: 1 }, isGitHubAppEnabled: { group: "default", points: 1 }, registerGithubApp: { group: "default", points: 1 }, takeSnapshot: { group: "default", points: 1 }, diff --git a/components/server/src/workspace/gitpod-server-impl.ts b/components/server/src/workspace/gitpod-server-impl.ts index 18df149b1a5d82..4c0c95600a2359 100644 --- a/components/server/src/workspace/gitpod-server-impl.ts +++ b/components/server/src/workspace/gitpod-server-impl.ts @@ -802,7 +802,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable { traceAPIParams(ctx, { workspaceId, action }); traceWI(ctx, { workspaceId }); - this.checkAndBlockUser("updateWorkspacePin"); + this.checkAndBlockUser("updateWorkspaceUserPin"); await this.workspaceDb.trace(ctx).transaction(async (db) => { const ws = await this.internalGetWorkspace(workspaceId, db); @@ -1762,10 +1762,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable { await this.userStorageResourcesDB.update(userId, uri, content); } - async sendFeedback(ctx: TraceContext, feedback: string): Promise { - throw new ResponseError(ErrorCodes.EE_FEATURE, "Sending feedback is not implemented"); - } - async isGitHubAppEnabled(ctx: TraceContext): Promise { this.checkAndBlockUser(); return !!this.config.githubApp?.enabled; @@ -1834,7 +1830,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable { traceAPIParams(ctx, { workspaceId }); traceWI(ctx, { workspaceId }); - this.checkUser("storeLayout"); + this.checkUser("getLayout"); const workspace = await this.workspaceDb.trace(ctx).findById(workspaceId); if (!workspace) { @@ -2948,7 +2944,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable { // traceAPIParams(ctx, { event }); tracing analytics does not make much sense //Identify calls collect user informmation. If the user is unknown, we don't make a call (privacy preservation) - const user = this.checkUser("IdentifyUser"); + const user = this.checkUser("identifyUser"); const identifyMessage: IdentifyMessage = { userId: user.id,