Skip to content

Commit

Permalink
SAK-43953 PA System: Modifing Banner priorities
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaljaykam committed Oct 9, 2023
1 parent 6ec64fd commit 7410985
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public void clearTemporaryDismissedForUser(String userId) {
@Override
public Void call(DBConnection db) throws SQLException {
db.run("DELETE FROM " + tableName + " WHERE state = ? AND user_id = ?")
.param(AcknowledgementType.TEMPORARY.dbValue())
.param(userId)
.executeUpdate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import org.sakaiproject.pasystem.api.Banner;
import org.sakaiproject.pasystem.api.PASystem;
import org.sakaiproject.pasystem.tool.forms.BannerForm;
import org.sakaiproject.user.api.User;
import org.sakaiproject.user.cover.UserDirectoryService;

/**
* A handler for creating and updating banners in the PA System administration tool.
Expand Down Expand Up @@ -89,6 +91,12 @@ protected void handleCreateOrUpdate(HttpServletRequest request, Map<String, Obje
String uuid = extractId(request);
BannerForm bannerForm = BannerForm.fromRequest(uuid, request);

User currentUser = UserDirectoryService.getCurrentUser();
if (currentUser == null) {
return;
}
String userId = currentUser.getId();

this.addErrors(bannerForm.validate());

if (hasErrors()) {
Expand All @@ -101,6 +109,7 @@ protected void handleCreateOrUpdate(HttpServletRequest request, Map<String, Obje
flash("info", "banner_created");
} else {
paSystem.getBanners().updateBanner(bannerForm.toBanner());
paSystem.getBanners().clearTemporaryDismissedForUser(userId);
flash("info", "banner_updated");
}

Expand Down

0 comments on commit 7410985

Please sign in to comment.