Skip to content

Commit

Permalink
Fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev committed May 3, 2024
1 parent b66b3b1 commit 5e1e4dd
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private async Task<IList<PushMessageRecipient>> GetNewRecipients(PushMessage mes
searchCriteria.Take = await _settingsManager.GetValueAsync<int>(GeneralSettings.BatchSize);
var queue = new Queue<Member>();

if (message.MemberIds != null && message.MemberIds.Count > 0)
if (!message.MemberIds.IsNullOrEmpty())
{
var members = await _memberService.GetByIdsAsync(message.MemberIds.ToArray(), searchCriteria.ResponseGroup);
members.Apply(EnqueueMember);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@ public async Task StartStopRecurringJobs()

public virtual async Task Handle(ObjectSettingChangedEvent message)
{
foreach (var entry in message.ChangedEntries)
foreach (var entry in message.ChangedEntries.Where(x => x.EntryState is EntryState.Modified or EntryState.Added))
{
if (entry.EntryState is EntryState.Modified or EntryState.Added)
var job = RecurringJobs.FirstOrDefault(job => job.EnableSetting.Name == entry.NewEntry.Name || job.CronSetting.Name == entry.NewEntry.Name);
if (job != null)
{
var job = RecurringJobs.FirstOrDefault(job => job.EnableSetting.Name == entry.NewEntry.Name || job.CronSetting.Name == entry.NewEntry.Name);
if (job != null)
{
await StartStopRecurringJob(job);
}
await StartStopRecurringJob(job);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ protected override void ClearCache(IList<PushMessage> models)
{
base.ClearCache(models);

// TODO: ???
GenericCachingRegion<PushMessageRecipient>.ExpireRegion();
GenericSearchCachingRegion<PushMessageRecipient>.ExpireRegion();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export interface PushMessageListScope extends ListBaseBladeScope {}

export default () => {
const listFactory = useListFactory<PushMessage[], IPushMessageSearchCriteria>({
load: async (query) => {
const criteria = { ...(query || {}) } as PushMessageSearchCriteria;
load: async (_query) => {
const criteria = { ...(_query || {}) } as PushMessageSearchCriteria;
criteria.statuses = ["Draft"];
criteria.responseGroup = "None";
return (await getApiClient()).search(criteria);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export interface PushMessageListScope extends ListBaseBladeScope {}

export default () => {
const listFactory = useListFactory<PushMessage[], IPushMessageSearchCriteria>({
load: async (query) => {
const criteria = { ...(query || {}) } as PushMessageSearchCriteria;
load: async (_query) => {
const criteria = { ...(_query || {}) } as PushMessageSearchCriteria;
criteria.responseGroup = "None";
return (await getApiClient()).search(criteria);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export default (args: {
mounted: Ref<boolean>;
}) => {
const listFactory = useListFactory<PushMessageRecipient[], PushMessageRecipientSearchCriteria>({
load: async (query) => {
const criteria = { ...(query || {}) } as PushMessageRecipientSearchCriteria;
load: async (_query) => {
const criteria = { ...(_query || {}) } as PushMessageRecipientSearchCriteria;
criteria.messageId = args.props.options.messageId;
criteria.withHidden = true;
return (await getApiClient()).searchRecipients(criteria);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export interface PushMessageListScope extends ListBaseBladeScope {}

export default () => {
const listFactory = useListFactory<PushMessage[], IPushMessageSearchCriteria>({
load: async (query) => {
const criteria = { ...(query || {}) } as PushMessageSearchCriteria;
load: async (_query) => {
const criteria = { ...(_query || {}) } as PushMessageSearchCriteria;
criteria.statuses = ["Scheduled"];
criteria.responseGroup = "None";
return (await getApiClient()).search(criteria);
Expand Down

0 comments on commit 5e1e4dd

Please sign in to comment.