fix: resolved issue with incorrect moderation url being generated (#2743)

This commit is contained in:
Wyatt Johnson
2019-12-06 18:46:54 +00:00
committed by GitHub
parent 7615dc2aaf
commit 88f6cad840
5 changed files with 82 additions and 55 deletions
+5 -1
View File
@@ -61,7 +61,11 @@ export default class TenantContext extends CommonContext {
this.clientID = options.clientID;
this.publisher = createPublisher({
pubsub: this.pubsub,
slackPublisher: createSlackPublisher(this.mongo, this.tenant),
slackPublisher: createSlackPublisher(
this.mongo,
this.config,
this.tenant
),
notifierQueue,
tenantID: this.tenant.id,
clientID: this.clientID,
+3 -13
View File
@@ -2,7 +2,7 @@ import { GraphQLResolveInfo } from "graphql";
import graphqlFields from "graphql-fields";
import { pull } from "lodash";
import { constructTenantURL, reconstructURL } from "coral-server/app/url";
import { reconstructTenantURL } from "coral-server/app/url";
import TenantContext from "../context";
@@ -16,16 +16,6 @@ export function getRequestedFields<T>(info: GraphQLResolveInfo) {
}
export function reconstructTenantURLResolver<T = any>(path: string) {
return (parent: T, args: {}, ctx: TenantContext) => {
// If the request is available, then prefer it over building from the tenant
// as the tenant does not include the port number. This should only really
// be a problem if the graph API is called internally.
if (ctx.req) {
return reconstructURL(ctx.req, path);
}
// Note that when constructing the callback url with the tenant, the port
// information is lost.
return constructTenantURL(ctx.config, ctx.tenant, path);
};
return (parent: T, args: {}, ctx: TenantContext) =>
reconstructTenantURL(ctx.config, ctx.tenant, ctx.req, path);
}