Skip to content

Commit

Permalink
Merge pull request #18 from guerler/fix_communication_settings
Browse files Browse the repository at this point in the history
Remove unused field value update, and api request parameters
  • Loading branch information
anuprulez authored Sep 9, 2016
2 parents 46cd30b + 399f4ae commit 4b7324b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
8 changes: 1 addition & 7 deletions client/galaxy/scripts/mvc/user/change-communication.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,18 @@ define( [ 'mvc/form/form-view', 'mvc/ui/ui-misc' ], function( Form, Ui ) {
})
},
onchange: function() {
console.log( 'change' );
//self.saveCommunicationChanges();
self.saveCommunicationChanges();
}
});
this.setElement( this.form.$el );

},


/** saves the change in communication setting */
/** Saves changes */
saveCommunicationChanges: function() {
var self = this;
var data = { 'enable_communication_server': self.form.data.create()[ 'change-communication' ] };
$.getJSON( Galaxy.root + 'api/user_preferences/change_communication', data, function( response ) {
var input_id = self.form.data.match( 'change-communication' );
var field = self.form.field_list[ input_id ];
field.value( response.activated );
self.form.message.update({
message : response.message,
status : response.status === 'error' ? 'danger' : 'success'
Expand Down
10 changes: 3 additions & 7 deletions lib/galaxy/webapps/galaxy/api/user_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,20 +834,17 @@ def edit_toolbox_filters( self, trans, cntrller='user_preferences', **kwd ):
@expose_api
def change_communication( self, trans, cntrller='user_preferences', **kwd):
"""
Provides a form with which the user can activate/deactivate
the commnication server.
Allows the user to activate/deactivate the commnication server.
"""
params = util.Params( kwd )
is_admin = cntrller == 'admin' and trans.user_is_admin()
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
message = 'Communication server settings unchanged.'
status = 'done'
user_id = params.get( 'user_id', None )

if user_id and is_admin:
user = trans.sa_session.query( trans.app.model.User ).get( trans.security.decode_id( user_id ) )
else:
user = trans.user

enabled_comm = params.get( 'enable_communication_server', None )
if user and enabled_comm is not None:
if enabled_comm == 'true':
Expand All @@ -857,7 +854,6 @@ def change_communication( self, trans, cntrller='user_preferences', **kwd):
user.preferences[ 'communication_server' ] = enabled_comm
trans.sa_session.add( user )
trans.sa_session.flush()

return {
'message' : message,
'status' : status,
Expand Down
4 changes: 2 additions & 2 deletions static/scripts/bundled/libs.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/libs.bundled.js.map

Large diffs are not rendered by default.

0 comments on commit 4b7324b

Please sign in to comment.