Skip to content

Commit

Permalink
Fix broken project slack notifications settings
Browse files Browse the repository at this point in the history
Parameters supplied in the wrong order breaks updating notifications
  • Loading branch information
PeteGoo committed Dec 27, 2015
1 parent 08edf95 commit b840679
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public class SlackNotificationAjaxEditPageController extends BaseController {
private ProjectSettingsManager mySettings;
private final String myPluginPath;
private final SlackNotificationPayloadManager myManager;
public SlackNotificationAjaxEditPageController(SBuildServer server, WebControllerManager webManager,

public SlackNotificationAjaxEditPageController(SBuildServer server, WebControllerManager webManager,
ProjectSettingsManager settings, SlackNotificationProjectSettings whSettings, SlackNotificationPayloadManager manager,
PluginDescriptor pluginDescriptor, SlackNotificationMainSettings mainSettings) {
super(server);
Expand Down Expand Up @@ -91,7 +91,7 @@ protected ModelAndView doHandle(HttpServletRequest request, HttpServletResponse
SUser myUser = SessionUser.getUser(request);
SProject myProject = null;
SlackNotificationProjectSettings projSettings = null;

if (request.getMethod().equalsIgnoreCase("post")){
if ((request.getParameter("projectId") != null)
&& request.getParameter("projectId").startsWith("project")){
Expand Down Expand Up @@ -201,19 +201,19 @@ protected ModelAndView doHandle(HttpServletRequest request, HttpServletResponse
}

if (request.getParameter("slackNotificationId").equals("new")){
projSettings.addNewSlackNotification(myProject.getProjectId(),request.getParameter("token"),request.getParameter("channel"), request.getParameter("team"), enabled,
states, buildTypeAll, buildTypeSubProjects, buildTypes, mentionChannelEnabled, mentionSlackUserEnabled);
projSettings.addNewSlackNotification(myProject.getProjectId(), request.getParameter("token"), request.getParameter("channel"), request.getParameter("team"), enabled,
states, buildTypeAll, buildTypeSubProjects, buildTypes, mentionChannelEnabled, mentionSlackUserEnabled);
if(projSettings.updateSuccessful()){
myProject.persist();
params.put("messages", "<errors />");
} else {
params.put("message", "<errors><error id=\"\">" + projSettings.getUpdateMessage() + "</error>");
}
} else {
projSettings.updateSlackNotification(myProject.getProjectId(),request.getParameter("slackNotificationId"),
request.getParameter("token"),request.getParameter("channel"), enabled,
states, buildTypeAll, buildTypeSubProjects, buildTypes, mentionChannelEnabled,
mentionSlackUserEnabled, content);
projSettings.updateSlackNotification(myProject.getProjectId(), request.getParameter("token"),
request.getParameter("slackNotificationId"), request.getParameter("channel"), enabled,
states, buildTypeAll, buildTypeSubProjects, buildTypes, mentionChannelEnabled,
mentionSlackUserEnabled, content);
if(projSettings.updateSuccessful()){
myProject.persist();
params.put("messages", "<errors />");
Expand Down

0 comments on commit b840679

Please sign in to comment.