Skip to content

Commit 7352d4e

Browse files
committed
Merge branch 'hotfix-19.1' into develop
2 parents b186fa2 + b93b009 commit 7352d4e

11 files changed

Lines changed: 141 additions & 14 deletions

File tree

Rock.Blocks/Engagement/ConnectionsHub.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -360,28 +360,33 @@ private ConnectionsHubOptionsBag GetOptions()
360360
var delimitedBadgeGuids = GetAttributeValue( AttributeKey.Badges );
361361
options.BadgeGuids = delimitedBadgeGuids.SplitDelimitedValues().AsGuidList();
362362

363-
var manualWorkflows = new List<ConnectionWorkflow>();
364-
var authorizedWorkflowItems = new List<ListItemBag>();
363+
var manualWorkflows = new List<(ConnectionWorkflow Workflow, Guid? OpportunityGuid)>();
364+
var authorizedWorkflowItems = new List<ConnectionWorkflowBag>();
365365

366366
manualWorkflows.AddRange( connectionType.ConnectionWorkflows
367367
.Where( w => w.TriggerType == ConnectionWorkflowTriggerType.Manual && ( w.WorkflowType.IsActive ?? true ) ) // Mirroring Webforms by setting IsActive to true by default.
368+
.Select( w => ( w, ( Guid? ) null ) )
368369
.ToList() );
369370

370371
manualWorkflows.AddRange( connectionType.ConnectionOpportunities
371-
.SelectMany( o => o.ConnectionWorkflows )
372-
.Where( w => w.TriggerType == ConnectionWorkflowTriggerType.Manual && ( w.WorkflowType.IsActive ?? true ) ) // Mirroring Webforms by setting IsActive to true by default.
372+
.SelectMany( o => o.ConnectionWorkflows.Select( w => (Workflow: w, OpportunityGuid: ( Guid? ) o.Guid) ) )
373+
.Where( x => x.Workflow.TriggerType == ConnectionWorkflowTriggerType.Manual && ( x.Workflow.WorkflowType.IsActive ?? true ) ) // Mirroring Webforms by setting IsActive to true by default.
373374
.ToList()
374375
);
375376

376377
foreach ( var manualWorkflow in manualWorkflows )
377378
{
378-
if ( manualWorkflow.WorkflowType.IsAuthorized( Authorization.VIEW, RequestContext.CurrentPerson ) )
379+
if ( manualWorkflow.Workflow.WorkflowType.IsAuthorized( Authorization.VIEW, RequestContext.CurrentPerson ) )
379380
{
380-
authorizedWorkflowItems.Add( new ListItemBag
381+
authorizedWorkflowItems.Add( new ConnectionWorkflowBag
381382
{
382-
Text = manualWorkflow.WorkflowType.Name,
383-
Value = manualWorkflow.Guid.ToString(),
384-
Category = manualWorkflow.ConnectionTypeId.HasValue ? "Connection Type Workflows" : "Connection Opportunity Workflows"
383+
ListItemBag = new ListItemBag
384+
{
385+
Text = manualWorkflow.Workflow.WorkflowType.Name,
386+
Value = manualWorkflow.Workflow.Guid.ToString(),
387+
Category = manualWorkflow.Workflow.ConnectionTypeId.HasValue ? "Connection Type Workflows" : "Connection Opportunity Workflows"
388+
},
389+
ConnectionOpportunityGuid = manualWorkflow.OpportunityGuid
385390
} );
386391
}
387392
}
@@ -747,6 +752,11 @@ private List<int> GetDataViewValues( int dataViewId )
747752
/// <returns>True if the Connection Request meets all criteria for the Connection Workflow; otherwise false.</returns>
748753
private bool IsEligibleForWorkflow( ConnectionWorkflow cw, ConnectionRequest request, List<int> includeIds, List<int> excludeIds )
749754
{
755+
if ( cw.ConnectionOpportunityId.HasValue && cw.ConnectionOpportunityId != request.ConnectionOpportunityId )
756+
{
757+
return false;
758+
}
759+
750760
if ( cw.ManualTriggerFilterConnectionStatusId.HasValue && cw.ManualTriggerFilterConnectionStatusId != request.ConnectionStatusId )
751761
{
752762
return false;
@@ -2185,6 +2195,7 @@ private ConnectionRequestDetailsBag GetConnectionRequestDetailsBag( ConnectionRe
21852195
IsDefaultStatus = connectionRequest.ConnectionStatus.IsDefault
21862196
} : null,
21872197
FollowUpDate = connectionRequest.FollowupDate?.ToRockDateTimeOffset(),
2198+
ConnectionOpportunityGuid = connectionRequest.ConnectionOpportunity.Guid,
21882199
ConnectionOpportunityName = connectionRequest.ConnectionOpportunity.Name,
21892200
ConnectionOpportunityIcon = connectionRequest.ConnectionOpportunity.IconCssClass,
21902201
Campus = connectionRequest.Campus?.Name,

Rock.JavaScript.Obsidian.Blocks/src/Engagement/ConnectionsHub/launchWorkflowModal.partial.obs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="row">
1818
<div class="col-md-4">
1919
<DropDownList v-model="workflow"
20-
:items="workflowItems"
20+
:items="workflowDropDownItems"
2121
label="Workflow"
2222
rules="required"
2323
showBlankItem
@@ -36,10 +36,11 @@
3636
import NotificationBox from "@Obsidian/Controls/notificationBox.obs";
3737
import DropDownList from "@Obsidian/Controls/dropDownList.obs";
3838
import RequestTable from "./requestTable.partial.obs";
39-
import { ref, PropType, watch } from "vue";
39+
import { computed, ref, PropType, watch } from "vue";
4040
import { isNullOrWhiteSpace } from "@Obsidian/Utility/stringUtils";
4141
import { useVModelPassthrough } from "@Obsidian/Utility/component";
4242
import { BulkRequestViewBag } from "@Obsidian/ViewModels/Blocks/Engagement/ConnectionsHub/bulkRequestViewBag";
43+
import { ConnectionWorkflowBag } from "@Obsidian/ViewModels/Blocks/Engagement/ConnectionsHub/connectionWorkflowBag";
4344
import { ListItemBag } from "@Obsidian/ViewModels/Utility/listItemBag";
4445
import { ViewOptions } from "./types.partial";
4546
import { LaunchWorkflowBag } from "@Obsidian/ViewModels/Blocks/Engagement/ConnectionsHub/launchWorkflowBag";
@@ -51,7 +52,7 @@
5152
},
5253

5354
workflowItems: {
54-
type: Array as PropType<ListItemBag[]>,
55+
type: Array as PropType<ConnectionWorkflowBag[]>,
5556
required: true
5657
},
5758

@@ -85,6 +86,23 @@
8586

8687
const isVisible = useVModelPassthrough(props, "visible", emit);
8788

89+
const requestOpportunityGuids = computed<string[]>(() => {
90+
return [...new Set(
91+
props.requestDetails
92+
.map(r => r.connectionOpportunityGuid)
93+
.filter((g): g is string => !!g)
94+
)];
95+
});
96+
97+
const workflowDropDownItems = computed<ListItemBag[]>(() => {
98+
const opportunityGuids = requestOpportunityGuids.value;
99+
100+
return props.workflowItems
101+
.filter(w => !w.connectionOpportunityGuid || opportunityGuids.includes(w.connectionOpportunityGuid))
102+
.map(w => w.listItemBag)
103+
.filter((item): item is ListItemBag => item != null);
104+
});
105+
88106
const workflow = ref();
89107

90108
function onSave(): void {

Rock.JavaScript.Obsidian.Blocks/src/Engagement/connectionsHub.obs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,7 @@
15381538
}
15391539

15401540
const connectionOpportunity = row["connectionOpportunity"] as string | null | undefined;
1541+
const connectionOpportunityGuid = row["connectionOpportunityGuid"] as string | null | undefined;
15411542
const connectionStatus = row["connectionStatus"] as ConnectionStatusBag | null | undefined;
15421543
const connectionTypeSource = row["connectionTypeSource"] as string | null | undefined;
15431544
const connector = row["connectorDetails"] as ListItemBag | null | undefined;
@@ -1549,6 +1550,7 @@
15491550
return {
15501551
idKey,
15511552
connectionOpportunity,
1553+
connectionOpportunityGuid,
15521554
connectionStatus,
15531555
connectionTypeSource,
15541556
connector,
@@ -1570,6 +1572,7 @@
15701572
const bag = <BulkRequestViewBag>{
15711573
idKey: box.entity.connectionRequestIdKey,
15721574
connectionOpportunity: box.entity.connectionOpportunityName,
1575+
connectionOpportunityGuid: box.entity.connectionOpportunityGuid,
15731576
connectionStatus: box.entity.connectionStatus,
15741577
connectionTypeSource: box.entity.connectionTypeSource,
15751578
connector: connector,

Rock.JavaScript.Obsidian/Framework/ViewModels/Blocks/Engagement/ConnectionsHub/bulkRequestViewBag.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// </copyright>
2222
//
2323

24+
import { Guid } from "@Obsidian/Types";
2425
import { ConnectionStatusBag } from "@Obsidian/ViewModels/Blocks/Engagement/ConnectionsHub/connectionStatusBag";
2526
import { PersonFieldBag } from "@Obsidian/ViewModels/Core/Grid/personFieldBag";
2627
import { ListItemBag } from "@Obsidian/ViewModels/Utility/listItemBag";
@@ -33,6 +34,9 @@ export type BulkRequestViewBag = {
3334
/** Gets or sets the name of the connection opportunity this request is associated with. */
3435
connectionOpportunity?: string | null;
3536

37+
/** Gets or sets the conection opportunity Guid. */
38+
connectionOpportunityGuid?: Guid | null;
39+
3640
/** Gets or sets the current connection status of this request. */
3741
connectionStatus?: ConnectionStatusBag | null;
3842

Rock.JavaScript.Obsidian/Framework/ViewModels/Blocks/Engagement/ConnectionsHub/connectionRequestDetailsBag.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ export type ConnectionRequestDetailsBag = {
6262
/** Gets or sets the date by which this request was completed. */
6363
completedDateTime?: string | null;
6464

65+
/** Gets or sets the GUID of the connection opportunity this request belongs to. */
66+
connectionOpportunityGuid?: Guid | null;
67+
6568
/** Gets or sets the CSS icon class for the connection opportunity this request belongs to. */
6669
connectionOpportunityIcon?: string | null;
6770

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by the Rock.CodeGeneration project
4+
// Changes to this file will be lost when the code is regenerated.
5+
// </auto-generated>
6+
//------------------------------------------------------------------------------
7+
// <copyright>
8+
// Copyright by the Spark Development Network
9+
//
10+
// Licensed under the Rock Community License (the "License");
11+
// you may not use this file except in compliance with the License.
12+
// You may obtain a copy of the License at
13+
//
14+
// http://www.rockrms.com/license
15+
//
16+
// Unless required by applicable law or agreed to in writing, software
17+
// distributed under the License is distributed on an "AS IS" BASIS,
18+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
// See the License for the specific language governing permissions and
20+
// limitations under the License.
21+
// </copyright>
22+
//
23+
24+
import { Guid } from "@Obsidian/Types";
25+
import { ListItemBag } from "@Obsidian/ViewModels/Utility/listItemBag";
26+
27+
/** Represents a connection workflow that can be launched from the Connections Hub. */
28+
export type ConnectionWorkflowBag = {
29+
/**
30+
* Gets or sets the GUID of the Connection Opportunity this workflow belongs to,
31+
* or null if this is a Connection Type-level workflow.
32+
*/
33+
connectionOpportunityGuid?: Guid | null;
34+
35+
/** Gets or sets the workflow item details including the workflow type name and connection workflow identifier. */
36+
listItemBag?: ListItemBag | null;
37+
};

Rock.JavaScript.Obsidian/Framework/ViewModels/Blocks/Engagement/ConnectionsHub/connectionsHubOptionsBag.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { Guid } from "@Obsidian/Types";
2525
import { ConnectionActivityTypeBag } from "@Obsidian/ViewModels/Blocks/Engagement/ConnectionsHub/connectionActivityTypeBag";
2626
import { ConnectionOpportunityDetailBag } from "@Obsidian/ViewModels/Blocks/Engagement/ConnectionsHub/connectionOpportunityDetailBag";
2727
import { ConnectionStatusBag } from "@Obsidian/ViewModels/Blocks/Engagement/ConnectionsHub/connectionStatusBag";
28+
import { ConnectionWorkflowBag } from "@Obsidian/ViewModels/Blocks/Engagement/ConnectionsHub/connectionWorkflowBag";
2829
import { ListItemBag } from "@Obsidian/ViewModels/Utility/listItemBag";
2930
import { PublicAttributeBag } from "@Obsidian/ViewModels/Utility/publicAttributeBag";
3031

@@ -103,5 +104,5 @@ export type ConnectionsHubOptionsBag = {
103104
title?: string | null;
104105

105106
/** Gets or sets the list of workflows that can be launched from connection requests. */
106-
workflowItems?: ListItemBag[] | null;
107+
workflowItems?: ConnectionWorkflowBag[] | null;
107108
};

Rock.ViewModels/Blocks/Engagement/ConnectionsHub/BulkRequestViewBag.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public class BulkRequestViewBag
4545
/// </summary>
4646
public string ConnectionOpportunity { get; set; }
4747

48+
/// <summary>
49+
/// Gets or sets the conection opportunity Guid.
50+
/// </summary>
51+
public Guid? ConnectionOpportunityGuid { get; set; }
52+
4853
/// <summary>
4954
/// Gets or sets the display value of the request source (e.g., a defined value description).
5055
/// </summary>

Rock.ViewModels/Blocks/Engagement/ConnectionsHub/ConnectionRequestDetailsBag.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public class ConnectionRequestDetailsBag
6666
/// </summary>
6767
public DateTimeOffset? FollowUpDate { get; set; }
6868

69+
/// <summary>
70+
/// Gets or sets the GUID of the connection opportunity this request belongs to.
71+
/// </summary>
72+
public Guid? ConnectionOpportunityGuid { get; set; }
73+
6974
/// <summary>
7075
/// Gets or sets the name of the connection opportunity this request belongs to.
7176
/// </summary>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// <copyright>
2+
// Copyright by the Spark Development Network
3+
//
4+
// Licensed under the Rock Community License (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.rockrms.com/license
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
// </copyright>
16+
//
17+
18+
using System;
19+
20+
using Rock.ViewModels.Utility;
21+
22+
namespace Rock.ViewModels.Blocks.Engagement.ConnectionsHub
23+
{
24+
/// <summary>
25+
/// Represents a connection workflow that can be launched from the Connections Hub.
26+
/// </summary>
27+
public class ConnectionWorkflowBag
28+
{
29+
/// <summary>
30+
/// Gets or sets the workflow item details including the workflow type name and connection workflow identifier.
31+
/// </summary>
32+
public ListItemBag ListItemBag { get; set; }
33+
34+
/// <summary>
35+
/// Gets or sets the GUID of the Connection Opportunity this workflow belongs to,
36+
/// or <c>null</c> if this is a Connection Type-level workflow.
37+
/// </summary>
38+
public Guid? ConnectionOpportunityGuid { get; set; }
39+
}
40+
}

0 commit comments

Comments
 (0)