Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ protected override void OnLoad( EventArgs e )
pEntityType.IncludeGlobalOption = false;
pEntityType.EntityTypes = entityTypes;

cbShowComplete.Checked = GetBlockUserPreference( "ShowComplete" ).AsBoolean();
pEntityType.SelectedValue = GetBlockUserPreference( "EntityType" );
var preferences = GetBlockPersonPreferences();
cbShowComplete.Checked = preferences.GetValue( "ShowComplete" ).AsBoolean();
pEntityType.SelectedValue = preferences.GetValue( "EntityType" );

BindGrid();
}
Expand Down Expand Up @@ -133,8 +134,10 @@ protected void gRequests_RowSelected( object sender, Rock.Web.UI.Controls.RowEve

protected void fRequests_ApplyFilterClick( object sender, EventArgs e )
{
SetBlockUserPreference( "ShowComplete", cbShowComplete.Checked.ToString() );
SetBlockUserPreference( "EntityType", pEntityType.SelectedValue );
var preferences = GetBlockPersonPreferences();
preferences.SetValue( "ShowComplete", cbShowComplete.Checked.ToString() );
preferences.SetValue( "EntityType", pEntityType.SelectedValue );
preferences.Save();
BindGrid();
}

Expand Down
6 changes: 4 additions & 2 deletions Plugins/org.secc.Cms/org_secc/Cms/CacheTagsCheckList.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,14 @@ protected void GetCacheTags()

protected void Save()
{
SetUserPreference( "checkbox-selected-values-preference", GetSelectedValues() );
var preferences = GetBlockPersonPreferences();
preferences.SetValue( "checkbox-selected-values-preference", GetSelectedValues() );
preferences.Save();
Comment on lines +153 to +155
}
Comment on lines 151 to 156
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Switched both Save() and LoadPreferences() in CacheTagsCheckList.ascx.cs, and also the read in LoginStatus.ascx.cs line 213, from GetGlobalPersonPreferences() to GetBlockPersonPreferences(). This ensures preference values are scoped to each block instance rather than shared globally. Commit: c0b87c7


protected void LoadPreferences()
{
string usersselectedvalues = GetUserPreference( "checkbox-selected-values-preference" );
string usersselectedvalues = GetBlockPersonPreferences().GetValue( "checkbox-selected-values-preference" );
IEnumerable<string> setvalues = usersselectedvalues.Split( ',' ).ToList();
cbl.SetValues( setvalues );
}
Expand Down
4 changes: 2 additions & 2 deletions Plugins/org.secc.Cms/org_secc/Cms/ContactGroupLeaders.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace RockWeb.Plugins.org_secc.Cms
[BooleanField( "Save Communication History", "Should a record of this communication be saved to the recipient's profile", false, "", 14 )]
[LavaCommandsField( "Enabled Lava Commands", "The Lava commands that should be enabled for this HTML block.", false, order: 15 )]
[BooleanField( "Enable SMS", "Enable messages being sent by SMS when it is the user's preferred communication method.", false, order: 16 )]
[DefinedValueField( "611bde1f-7405-4d16-8626-ccfedb0e62be", "SMS From Number", "The SMS Phone Number that the message should come from", false, false, "86604119-a222-4b35-9cd3-1a78db1b7b17", "", order: 17 )]
[SystemPhoneNumberField( "SMS From Number", "The SMS Phone Number that the message should come from", false, false, "86604119-a222-4b35-9cd3-1a78db1b7b17", "", order: 17 )]
[CodeEditorField( "SMS Message Body", "The SMS message body.", CodeEditorMode.Lava, CodeEditorTheme.Rock, 200, false, "", "", 18 )]

public partial class ContactGroupLeaders : Rock.Web.UI.RockBlock
Expand Down Expand Up @@ -372,7 +372,7 @@ private void SendTextMessage( List<Person> smsRecipients, Dictionary<string, obj
communication.Subject = GetAttributeValue( "Subject" );
communication.Message = GetAttributeValue( "MessageBody" );

communication.SMSFromDefinedValueId = DefinedValueCache.GetId( GetAttributeValue( "SMSFromNumber" ).AsGuid() );
communication.SmsFromSystemPhoneNumberId = SystemPhoneNumberCache.Get( GetAttributeValue( "SMSFromNumber" ).AsGuid() )?.Id;
communication.SMSMessage = GetAttributeValue( "SMSMessageBody" );
communication.FutureSendDateTime = null;

Expand Down
6 changes: 4 additions & 2 deletions Plugins/org.secc.Cms/org_secc/Cms/LoginStatus.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ protected override void OnLoad( EventArgs e )
//Reset our clock when we look at our dashboard.
if ( PageCache.Guid == GetAttributeValue( "MyDashboardPage" ).AsGuid() )
{
SetUserPreference( "LastViewedDashboard", Rock.RockDateTime.Now.ToString() );
var preferences = GetBlockPersonPreferences();
preferences.SetValue( "LastViewedDashboard", Rock.RockDateTime.Now.ToString() );
preferences.Save();
}

phHello.Visible = true;
Expand Down Expand Up @@ -208,7 +210,7 @@ protected override void OnLoad( EventArgs e )

private int GetNotificationCount()
{
var lastChecked = GetUserPreference( "LastViewedDashboard" ).AsDateTime();
var lastChecked = GetBlockPersonPreferences().GetValue( "LastViewedDashboard" ).AsDateTime();
if ( !lastChecked.HasValue )
{
lastChecked = RockDateTime.Now.AddMonths( -3 );
Expand Down