Skip to content

Commit

Permalink
remove EXPERIMENTAL_TAGS env var -- tags are now enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
schuyler1d committed Aug 18, 2020
1 parent dbce65a commit 24f7dfb
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 85 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ EMAIL_FROM=
TWILIO_MESSAGE_VALIDITY_PERIOD=
DST_REFERENCE_TIMEZONE='America/New_York'
PASSPORT_STRATEGY=local
EXPERIMENTAL_TAGS=1
TEXTER_SIDEBOXES=celebration-gif,default-dynamicassignment,default-releasecontacts,contact-reference,tag-contact
OWNER_CONFIGURABLE=ALL
6 changes: 3 additions & 3 deletions __test__/extensions/message-handlers/profanity-tagger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("Message Hanlder: profanity-tagger", () => {
.knex("organization")
.update(
"features",
'{"EXPERIMENTAL_TAGS": "1", "PROFANITY_CONTACT_TAG_ID": "1", "PROFANITY_TEXTER_TAG_ID": "2", "PROFANITY_TEXTER_SUSPEND_COUNT": "1"}'
'{"PROFANITY_CONTACT_TAG_ID": "1", "PROFANITY_TEXTER_TAG_ID": "2", "PROFANITY_TEXTER_SUSPEND_COUNT": "1"}'
);
await cacheableData.organization.clear(c.organizationId);

Expand Down Expand Up @@ -117,7 +117,7 @@ describe("Message Hanlder: profanity-tagger", () => {
.knex("organization")
.update(
"features",
'{"EXPERIMENTAL_TAGS": "1", "PROFANITY_CONTACT_TAG_ID": "1", "PROFANITY_TEXTER_TAG_ID": "2", "PROFANITY_TEXTER_SUSPEND_COUNT": "2"}'
'{"PROFANITY_CONTACT_TAG_ID": "1", "PROFANITY_TEXTER_TAG_ID": "2", "PROFANITY_TEXTER_SUSPEND_COUNT": "2"}'
);
await cacheableData.organization.clear(c.organizationId);
const org = await cacheableData.organization.load(c.organizationId);
Expand Down Expand Up @@ -200,7 +200,7 @@ describe("Message Hanlder: profanity-tagger", () => {
.knex("organization")
.update(
"features",
'{"EXPERIMENTAL_TAGS": "1", "PROFANITY_CONTACT_TAG_ID": "1", "PROFANITY_TEXTER_TAG_ID": "2", "PROFANITY_TEXTER_BLOCK_SEND": "1"}'
'{"PROFANITY_CONTACT_TAG_ID": "1", "PROFANITY_TEXTER_TAG_ID": "2", "PROFANITY_TEXTER_BLOCK_SEND": "1"}'
);
await cacheableData.organization.clear(c.organizationId);
const org = await cacheableData.organization.load(c.organizationId);
Expand Down
12 changes: 11 additions & 1 deletion __test__/test_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,17 @@ export async function createOrganization(user, invite) {
name,
inviteId
};
return await graphql(mySchema, orgQuery, rootValue, context, variables);
const result = await graphql(
mySchema,
orgQuery,
rootValue,
context,
variables
);
if (result && result.errors) {
throw new Exception("createOrganization failed " + JSON.stringify(result));
}
return result;
}

export async function setTwilioAuth(user, organization) {
Expand Down
3 changes: 1 addition & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ module.exports = {
TWILIO_MESSAGE_SERVICE_SID: "TEST_MESSAGE_SID",
TEST_ENVIRONMENT: "1",
TEST_ENVIRONMENT_FAKE: "0",
TEST_ENVIRONMENT_FAKE2: "false",
EXPERIMENTAL_TAGS: "1"
TEST_ENVIRONMENT_FAKE2: "false"
},
moduleFileExtensions: ["js", "jsx"],
transform: {
Expand Down
4 changes: 0 additions & 4 deletions src/components/AdminDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ class AdminDashboard extends React.Component {
}
];

if (window.EXPERIMENTAL_TAGS === false) {
sections = sections.filter(section => section.name !== "Tags");
}

if (!this.props.data.organization.phoneInventoryEnabled) {
sections = sections.filter(section => section.name !== "Phone Numbers");
}
Expand Down
62 changes: 29 additions & 33 deletions src/components/CampaignCannedResponseForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,39 +71,35 @@ export default class CannedResponseForm extends React.Component {
multiLine
fullWidth
/>
{window.EXPERIMENTAL_TAGS && (
<AutoComplete
ref="autocompleteInput"
floatingLabelText="Tags"
filter={AutoComplete.fuzzyFilter}
dataSource={
tags && tags.filter(t => this.state.tagIds.indexOf(t.id) === -1)
}
maxSearchResults={8}
onNewRequest={({ id }) => {
this.refs.autocompleteInput.setState({ searchText: "" });
this.setState({ tagIds: [...this.state.tagIds, id] });
}}
dataSourceConfig={{
text: "name",
value: "id"
}}
fullWidth
/>
)}
{window.EXPERIMENTAL_TAGS && (
<TagChips
tags={tags}
tagIds={this.state.tagIds}
onRequestDelete={listedTag => {
this.setState({
tagIds: this.state.tagIds.filter(
tagId => tagId !== listedTag.id
)
});
}}
/>
)}
<AutoComplete
ref="autocompleteInput"
floatingLabelText="Tags"
filter={AutoComplete.fuzzyFilter}
dataSource={
tags && tags.filter(t => this.state.tagIds.indexOf(t.id) === -1)
}
maxSearchResults={8}
onNewRequest={({ id }) => {
this.refs.autocompleteInput.setState({ searchText: "" });
this.setState({ tagIds: [...this.state.tagIds, id] });
}}
dataSourceConfig={{
text: "name",
value: "id"
}}
fullWidth
/>
<TagChips
tags={tags}
tagIds={this.state.tagIds}
onRequestDelete={listedTag => {
this.setState({
tagIds: this.state.tagIds.filter(
tagId => tagId !== listedTag.id
)
});
}}
/>
<div className={css(styles.buttonRow)}>
<FlatButton
{...dataTest("addResponse")}
Expand Down
14 changes: 6 additions & 8 deletions src/components/CampaignCannedResponsesForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,12 @@ export class CampaignCannedResponsesForm extends React.Component {
>
<div className={css(styles.title)}>{response.title}</div>
<div className={css(styles.text)}>{response.text}</div>
{window.EXPERIMENTAL_TAGS &&
response.tagIds &&
response.tagIds.length > 0 && (
<TagChips
tags={this.props.data.organization.tags}
tagIds={response.tagIds}
/>
)}
{response.tagIds && response.tagIds.length > 0 && (
<TagChips
tags={this.props.data.organization.tags}
tagIds={response.tagIds}
/>
)}
</ListItem>
));
return listItems;
Expand Down
12 changes: 5 additions & 7 deletions src/components/IncomingMessageFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,11 @@ class IncomingMessageFilter extends Component {
/>
</div>
<div>
{window.EXPERIMENTAL_TAGS === true && (
<TagsSelector
onChange={this.onTagsFilterChanged}
tagsFilter={this.state.tagsFilter}
tags={this.props.tags}
/>
)}
<TagsSelector
onChange={this.onTagsFilterChanged}
tagsFilter={this.state.tagsFilter}
tags={this.props.tags}
/>
<SelectedCampaigns
campaigns={this.state.selectedCampaigns}
onDeleteRequested={this.handleCampaignRemoved}
Expand Down
10 changes: 4 additions & 6 deletions src/components/IncomingMessageList/ConversationPreviewModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ class ConversationPreviewBody extends Component {
render() {
return (
<div>
{window.EXPERIMENTAL_TAGS && (
<TagList
organizationTags={this.props.organizationTags}
tags={this.props.conversation.tags}
/>
)}
<TagList
organizationTags={this.props.organizationTags}
tags={this.props.conversation.tags}
/>
<MessageList messages={this.state.messages} />
<MessageResponse
conversation={this.props.conversation}
Expand Down
6 changes: 2 additions & 4 deletions src/components/IncomingMessageList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class IncomingMessageList extends Component {
}}
icon={<ActionOpenInNew />}
/>
{window.EXPERIMENTAL_TAGS && this.renderTags(row.tags)}
{this.renderTags(row.tags)}
</div>
)
}
Expand Down Expand Up @@ -299,9 +299,7 @@ export class IncomingMessageList extends Component {
selectedRows={clearSelectedMessages ? null : this.state.selectedRows}
/>
<ConversationPreviewModal
{...(window.EXPERIMENTAL_TAGS && {
organizationTags: this.state.tags
})}
organizationTags={this.state.tags}
conversation={this.state.activeConversation}
onRequestClose={this.handleCloseConversation}
onForceRefresh={this.props.onForceRefresh}
Expand Down
1 change: 1 addition & 0 deletions src/extensions/texter-sideboxes/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function getComponents() {
"default-releasecontacts",
"celebration-gif",
"contact-reference",
"tag-contact",
"default-editinitial"
];
const components = {};
Expand Down
3 changes: 0 additions & 3 deletions src/server/api/campaign-contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ export const resolvers = {
tags: async campaignContact => {
// TODO: there's more to do here to avoid cache-misses
// maybe preload with campaignContact.loadMany
if (!getConfig("EXPERIMENTAL_TAGS", null, { truthy: 1 })) {
return [];
}
if (campaignContact.message_status === "needsMessage") {
return []; // it's the beginning, so there won't be any
}
Expand Down
8 changes: 2 additions & 6 deletions src/server/api/conversations.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ function getConversationsJoinsAndWhereClause(
query = query.where("is_opted_out", contactsFilter.isOptedOut);
}

if (
getConfig("EXPERIMENTAL_TAGS", null, { truthy: 1 }) &&
contactsFilter &&
contactsFilter.tags
) {
if (contactsFilter && contactsFilter.tags) {
const tags = contactsFilter.tags;

let tagsSubquery = r.knex
Expand Down Expand Up @@ -229,7 +225,7 @@ export async function getConversations(
}

// tags query
if (getConfig("EXPERIMENTAL_TAGS", null, { truthy: 1 }) && includeTags) {
if (includeTags) {
const tagsQuery = r.knex
.select(
"tag_campaign_contact.campaign_contact_id as campaign_contact_id",
Expand Down
4 changes: 0 additions & 4 deletions src/server/api/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { Tag, r } from "../models";
import { getConfig } from "../api/lib/config";

export async function getTags(organization, group) {
if (getConfig("EXPERIMENTAL_TAGS", null, { truthy: 1 }) === false) {
return [];
}

// TODO: need to cache this on organization object
let query = r.knex
.select("*")
Expand Down
3 changes: 0 additions & 3 deletions src/server/middleware/render-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ export default function renderIndex(html, css, assetMap) {
window.CAN_GOOGLE_IMPORT=${canGoogleImport}
window.EXPERIMENTAL_TWILIO_PER_CAMPAIGN_MESSAGING_SERVICE=${process.env
.EXPERIMENTAL_TWILIO_PER_CAMPAIGN_MESSAGING_SERVICE || false}
window.EXPERIMENTAL_TAGS=${getConfig("EXPERIMENTAL_TAGS", null, {
truthy: 1
}) || false}
window.TWILIO_MULTI_ORG=${process.env.TWILIO_MULTI_ORG || false}
window.DEPRECATED_TEXTERUI="${process.env.DEPRECATED_TEXTERUI || ""}"
${
Expand Down

0 comments on commit 24f7dfb

Please sign in to comment.