Skip to content

Commit

Permalink
Merge pull request #3006 from zlamalp/auditfix
Browse files Browse the repository at this point in the history
Fixed usage of LocalDate in audit messages
  • Loading branch information
zlamalp committed Nov 26, 2020
1 parent c2a9e6d commit 7e7a396
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SponsorshipEstablished extends AuditEvent {
private Member sponsoredMember;
private User sponsor;
private String message;
private LocalDate validity;
private String validity;

@SuppressWarnings("unused") // used by jackson mapper
public SponsorshipEstablished() {
Expand All @@ -20,9 +20,9 @@ public SponsorshipEstablished() {
public SponsorshipEstablished(Member sponsoredMember, User sponsor, LocalDate validityTo) {
this.sponsoredMember = sponsoredMember;
this.sponsor = sponsor;
this.validity = validityTo;
this.validity = (validityTo == null) ? "FOREVER" : validityTo.toString();
this.message = formatMessage("Sponsorship of %s by %s established with validity to %s.",
sponsoredMember, sponsor, validityTo == null ? "FOREVER" : validityTo.toString());
sponsoredMember, sponsor, validity);
}

@Override
Expand All @@ -38,7 +38,7 @@ public User getSponsor() {
return sponsor;
}

public LocalDate getValidity() {
public String getValidity() {
return validity;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class SponsorshipValidityUpdated extends AuditEvent {
private Member sponsoredMember;
private User sponsor;
private String message;
private LocalDate validity;
private String validity;

@SuppressWarnings("unused") // used by jackson mapper
public SponsorshipValidityUpdated() {
Expand All @@ -23,9 +23,9 @@ public SponsorshipValidityUpdated() {
public SponsorshipValidityUpdated(Member sponsoredMember, User sponsor, LocalDate validityTo) {
this.sponsoredMember = sponsoredMember;
this.sponsor = sponsor;
this.validity = validityTo;
this.validity = (validityTo == null) ? "FOREVER" : validityTo.toString();
this.message = formatMessage("Validity of sponsorship of %s by %s changed to %s.",
sponsoredMember, sponsor, validityTo == null ? "FOREVER" : validityTo.toString());
sponsoredMember, sponsor, validity);
}

@Override
Expand All @@ -41,7 +41,13 @@ public User getSponsor() {
return sponsor;
}

public LocalDate getValidity() {
public String getValidity() {
return validity;
}

@Override
public String toString() {
return message;
}

}

0 comments on commit 7e7a396

Please sign in to comment.