Skip to content

Commit

Permalink
Use 'joinToken' in place of 'organizationUuid' since we are actually …
Browse files Browse the repository at this point in the history
…using the joinToken value

Also remove an unnecessary import and fix a comment
  • Loading branch information
sjwmoveon committed May 3, 2024
1 parent 4be13a6 commit 0dfcea5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions __test__/server/api/campaign/campaign.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,13 +846,11 @@ describe("Reassignments", () => {
await runGql(
dynamicReassignMutation,
{
organizationUuid: testCampaign.joinToken,
joinToken: testCampaign.joinToken,
campaignId: testCampaign.id,
},
testTexterUser2
);
// TEXTER 1 (60 needsMessage, 4 messaged)
// TEXTER 2 (25 needsMessage, 2 needsResponse, 3 convo, 1 messaged)
texterCampaignDataResults = await runGql(
TexterTodoQuery,
{
Expand Down Expand Up @@ -897,7 +895,7 @@ describe("Reassignments", () => {
await runGql(
dynamicReassignMutation,
{
organizationUuid: testCampaign.joinToken,
joinToken: testCampaign.joinToken,
campaignId: testCampaign.id,
},
testTexterUser2
Expand Down Expand Up @@ -930,6 +928,8 @@ describe("Reassignments", () => {
},
testTexterUser2
);
// TEXTER 1 (60 needsMessage, 4 messaged)
// TEXTER 2 (25 needsMessage, 2 needsResponse, 3 convo, 1 messaged)
expect(texterCampaignDataResults.data.assignment.contacts.length).toEqual(
0
);
Expand Down
2 changes: 1 addition & 1 deletion src/api/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ const rootSchema = gql`
newTexterUserId: String!
): [CampaignIdAssignmentId]
dynamicReassign(
organizationUuid: String!
joinToken: String!
campaignId: String!
): String
importCampaignScript(campaignId: String!, url: String!): Int
Expand Down
2 changes: 1 addition & 1 deletion src/components/CampaignDynamicAssignmentForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class CampaignDynamicAssignmentForm extends React.Component {
<li>
{joinToken ? (
<OrganizationReassignLink
organizationUuid={joinToken}
joinToken={joinToken}
campaignId={campaignId}
/>
) : (
Expand Down
6 changes: 3 additions & 3 deletions src/components/OrganizationReassignLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import PropTypes from "prop-types";
import React from "react";
import DisplayLink from "./DisplayLink";

const OrganizationReassignLink = ({ organizationUuid, campaignId }) => {
const OrganizationReassignLink = ({ joinToken, campaignId }) => {
let baseUrl = "http://base";
if (typeof window !== "undefined") {
baseUrl = window.location.origin;
}

const replyUrl = `${baseUrl}/${organizationUuid}/replies/${campaignId}`;
const replyUrl = `${baseUrl}/${joinToken}/replies/${campaignId}`;
const textContent = `Send your texting volunteers this link! Once they sign up, they\'ll be automatically assigned replies for this campaign.`;

return <DisplayLink url={replyUrl} textContent={textContent} />;
};

OrganizationReassignLink.propTypes = {
organizationUuid: PropTypes.string,
joinToken: PropTypes.string,
campaignId: PropTypes.string
};

Expand Down
10 changes: 5 additions & 5 deletions src/containers/AssignReplies.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AssignReplies extends React.Component {
try {

const organizationId = (await this.props.mutations.dynamicReassign(
this.props.params.organizationUuid,
this.props.params.joinToken,
this.props.params.campaignId
)).data.dynamicReassign;
console.log("ID:", organizationId);
Expand Down Expand Up @@ -62,24 +62,24 @@ AssignReplies.propTypes = {

export const dynamicReassignMutation = gql`
mutation dynamicReassign(
$organizationUuid: String!
$joinToken: String!
$campaignId: String!
) {
dynamicReassign(
organizationUuid: $organizationUuid
joinToken: $joinToken
campaignId: $campaignId
)
}
`;

const mutations = {
dynamicReassign: ownProps => (
organizationUuid,
joinToken,
campaignId
) => ({
mutation: dynamicReassignMutation,
variables: {
organizationUuid,
joinToken,
campaignId
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default function makeRoutes(requireAuth = () => {}) {
onEnter={requireAuth}
/>
<Route
path=":organizationUuid/replies/:campaignId"
path=":joinToken/replies/:campaignId"
component={AssignReplies}
onEnter={requireAuth}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/server/api/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import GraphQLDate from "graphql-date";
import GraphQLJSON from "graphql-type-json";
import { GraphQLError } from "graphql/error";
import isUrl from "is-url";
import _, { orderBy } from "lodash";
import _ from "lodash";
import { gzip, makeTree, getHighestRole } from "../../lib";
import { capitalizeWord, groupCannedResponses } from "./lib/utils";
import httpRequest from "../lib/http-request";
Expand Down Expand Up @@ -1441,7 +1441,7 @@ const rootMutations = {
dynamicReassign: async (
_,
{
organizationUuid,
joinToken,
campaignId
},
{ user }
Expand All @@ -1451,7 +1451,7 @@ const rootMutations = {
.knex("campaign")
.where({
id: campaignId,
join_token: organizationUuid,
join_token: joinToken,
})
.first();
const INVALID_REASSIGN = () => {
Expand Down

0 comments on commit 0dfcea5

Please sign in to comment.