Skip to content

Commit

Permalink
Allow org=all filtering for the TexterTodoList screen to show assignm…
Browse files Browse the repository at this point in the history
…ents across orgs
  • Loading branch information
ibrand committed Oct 19, 2020
1 parent 7ebf783 commit 844ca04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/containers/TexterTodoList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class TexterTodoList extends React.Component {
}

renderTodoList(assignments) {
const organizationId = this.props.params.organizationId;
return assignments
.sort((x, y) => {
const xToText = x.unmessagedCount + x.unrepliedCount;
Expand All @@ -34,7 +33,7 @@ class TexterTodoList extends React.Component {
) {
return (
<AssignmentSummary
organizationId={organizationId}
organizationId={assignment.campaign.organization.id}
key={assignment.id}
assignment={assignment}
texter={this.props.data.user}
Expand Down Expand Up @@ -121,6 +120,7 @@ export const dataQuery = gql`
query getTodos(
$userId: Int
$organizationId: String!
$todosOrg: String
$needsMessageFilter: ContactsFilter
$needsResponseFilter: ContactsFilter
$badTimezoneFilter: ContactsFilter
Expand All @@ -134,7 +134,7 @@ export const dataQuery = gql`
profileComplete(organizationId: $organizationId)
cacheable
roles(organizationId: $organizationId)
todos(organizationId: $organizationId) {
todos(organizationId: $todosOrg) {
id
hasUnassignedContactsForTexter
campaign {
Expand Down Expand Up @@ -199,6 +199,11 @@ const queries = {
variables: {
userId: ownProps.params.userId || null,
organizationId: ownProps.params.organizationId,
todosOrg:
ownProps.location.query["org"] == "all" ||
!ownProps.params.organizationId
? null
: ownProps.params.organizationId,
needsMessageFilter: {
messageStatus: "needsMessage",
isOptedOut: false,
Expand Down
5 changes: 3 additions & 2 deletions src/server/api/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,12 @@ export const resolvers = {
.join("campaign", "assignment.campaign_id", "campaign.id")
.where({
is_started: true,
organization_id: organizationId,
is_archived: false
})
.where("assignment.user_id", user.id);

if (organizationId) {
query.where("organization_id", organizationId);
}
if (getConfig("FILTER_DUEBY", null, { truthy: 1 })) {
query = query.where("campaign.due_by", ">", new Date());
}
Expand Down

0 comments on commit 844ca04

Please sign in to comment.