Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated sendFeedback server method #12918

Merged
merged 2 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions components/gitpod-protocol/go/gitpod-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
15 changes: 0 additions & 15 deletions components/gitpod-protocol/go/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion components/gitpod-protocol/src/gitpod-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
deleteGitpodToken(tokenHash: string): Promise<void>;

// misc
sendFeedback(feedback: string): Promise<string | undefined>;
isGitHubAppEnabled(): Promise<boolean>;
registerGithubApp(installationId: string): Promise<void>;

Expand Down
17 changes: 0 additions & 17 deletions components/server/ee/src/workspace/gitpod-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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,
Expand Down Expand Up @@ -2452,22 +2451,6 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
return this.billingModes.getBillingMode(parsedAttributionId, new Date());
}

// various
async sendFeedback(ctx: TraceContext, feedback: string): Promise<string | undefined> {
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,
Expand Down
1 change: 0 additions & 1 deletion components/server/src/auth/rate-limiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
10 changes: 3 additions & 7 deletions components/server/src/workspace/gitpod-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1762,10 +1762,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
await this.userStorageResourcesDB.update(userId, uri, content);
}

async sendFeedback(ctx: TraceContext, feedback: string): Promise<string | undefined> {
throw new ResponseError(ErrorCodes.EE_FEATURE, "Sending feedback is not implemented");
}

async isGitHubAppEnabled(ctx: TraceContext): Promise<boolean> {
this.checkAndBlockUser();
return !!this.config.githubApp?.enabled;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down