|
241 | 241 | this.element.on('click', '.ack', function(event){
|
242 | 242 | var postid = $(this).data('id');
|
243 | 243 | var me = $(this);
|
244 |
| - $.getJSON(self.options.baseUrl + '/mattermost/MattermostChat/ack?postid='+postid, function(data){ |
| 244 | + $.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/ack?postid='+postid, function(data){ |
245 | 245 | if(self.connFailCount !== 0) {
|
246 | 246 | //if no websocket, we rely on status code to know if reaction correctly added
|
247 | 247 | if(data.result == 200) {
|
|
253 | 253 |
|
254 | 254 | this.element.on('click', "#previousMessages", function(e){
|
255 | 255 | var postid = self.element.find("#conversation .message-body").first().data('id');
|
256 |
| - $.getJSON(self.options.baseUrl + '/mattermost/MattermostChat/getLastPosts?channelid='+self.currentChannelId+'&beforeid='+postid, function(data){ |
| 256 | + $.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/getLastPosts?channelid='+self.currentChannelId+'&beforeid='+postid, function(data){ |
257 | 257 | self._addPosts(data, true, false);
|
258 | 258 | });
|
259 | 259 | });
|
|
274 | 274 | $.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/getDefaultChannelId?teamid=' + self.options.teamName, function (data) {
|
275 | 275 | self.currentChannelId = data.channelid;
|
276 | 276 | }),
|
277 |
| - $.getJSON(self.options.baseUrl + '/mattermost/MattermostChat/getMyID', function(data){ |
| 277 | + $.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/getMyID', function(data){ |
278 | 278 | self.myId = data.id;
|
279 | 279 | })
|
280 | 280 | ).then(function(data, textStatus, jqHXR){
|
|
288 | 288 | });
|
289 | 289 | //get my groups once and for all
|
290 | 290 | self.element.find('.compose-sideBar ul').empty();
|
291 |
| - $.getJSON(self.options.baseUrl + '/mattermost/mattermostChat/getMyChannels?teamid=' + self.options.teamName, function (data) { |
| 291 | + $.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/getMyChannels?teamid=' + self.options.teamName, function (data) { |
292 | 292 | self._addGroups(data);
|
293 | 293 | });
|
294 | 294 | }).fail(function(data, textStatus, jqHXR){
|
|
342 | 342 | }
|
343 | 343 | });
|
344 | 344 |
|
345 |
| - $.when($.getJSON(self.options.baseUrl + '/mattermost/MattermostChat/getMyToken', function(data){ |
| 345 | + $.when($.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/getMyToken', function(data){ |
346 | 346 | self.options.token = data.token;
|
347 | 347 | })).then(function(){
|
348 | 348 | self._websocketConnect();
|
|
375 | 375 | this.element.find('.groupid[data-id="' + channelId + '"] .sideBar-time').append('<i class="fa fa-check fa-2x"></i>');
|
376 | 376 | }
|
377 | 377 | self.currentChannelId = channelId;
|
378 |
| - $.getJSON(self.options.baseUrl + '/mattermost/MattermostChat/getLastPosts?channelid='+self.currentChannelId, function(data, textStatus, jqHXR){ |
| 378 | + $.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/getLastPosts?channelid='+self.currentChannelId, function(data, textStatus, jqHXR){ |
379 | 379 | self._addPosts(data, false, alert);
|
380 | 380 | if(self.connFailCount !== 0) { //no websocket : start polling
|
381 | 381 | //periodic refresh
|
|
387 | 387 | });
|
388 | 388 | //fetch members
|
389 | 389 | $.when(
|
390 |
| - $.getJSON(self.options.baseUrl + '/mattermost/MattermostChat/getChannelMembers?channelid='+self.currentChannelId, function(data){ |
| 390 | + $.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/getChannelMembers?channelid='+self.currentChannelId, function(data){ |
391 | 391 | self._addUsers(data);
|
392 | 392 | })
|
393 | 393 | ).then(
|
|
427 | 427 | 'comment': message,
|
428 | 428 | 'postId': postId
|
429 | 429 | };
|
430 |
| - $.post(this.options.baseUrl+'/mattermost/MattermostChat/patchMessage', post, function (data) { |
| 430 | + $.post(this.options.baseUrl+'/mattermost/mattermostchat/patchMessage', post, function (data) { |
431 | 431 | if(successCallback !== undefined) {
|
432 | 432 | successCallback(data);
|
433 | 433 | }
|
|
594 | 594 | //this key exists only if posts came from websocket
|
595 | 595 | //we need to request the server via api
|
596 | 596 | var self = this;
|
597 |
| - $.getJSON(this.options.baseUrl + '/mattermost/MattermostChat/getImages?filesId='+data.file_ids, function(data){ |
| 597 | + $.getJSON(this.options.baseUrl + '/mattermost/mattermostchat/getImages?filesId='+data.file_ids, function(data){ |
598 | 598 | self._addImagesToPost(data, post);
|
599 | 599 | });
|
600 | 600 | }
|
|
647 | 647 | '</div>' +
|
648 | 648 | '</div>');
|
649 | 649 | if(this.options.acknowledgement == true) {
|
650 |
| - $.getJSON(this.options.baseUrl + '/mattermost/MattermostChat/isack?postid=' + postid, function (data) { |
| 650 | + $.getJSON(this.options.baseUrl + '/mattermost/mattermostchat/isack?postid=' + postid, function (data) { |
651 | 651 | if (data.ack == true) {
|
652 | 652 | post.find('.message-main-sender').append('<div class="ack ack-sent"><span class="fa fa-check-square-o"></span></div>');
|
653 | 653 | } else {
|
|
659 | 659 | //this key exists only if posts came from websocket
|
660 | 660 | //we need to request the server via api
|
661 | 661 | var self = this;
|
662 |
| - $.getJSON(this.options.baseUrl + '/mattermost/MattermostChat/getImages?filesId='+data.file_ids, function(data){ |
| 662 | + $.getJSON(this.options.baseUrl + '/mattermost/mattermostchat/getImages?filesId='+data.file_ids, function(data){ |
663 | 663 | self._addImagesToPost(data, post);
|
664 | 664 | });
|
665 | 665 | }
|
|
767 | 767 | var self = this;
|
768 | 768 | $('.user').each(function(index){
|
769 | 769 | var me = $(this);
|
770 |
| - $.getJSON(self.options.baseUrl + '/mattermost/MattermostChat/getUserStatus?userid='+$(this).data('id'), function(data){ |
| 770 | + $.getJSON(self.options.baseUrl + '/mattermost/mattermostchat/getUserStatus?userid='+$(this).data('id'), function(data){ |
771 | 771 | self._changeStatus(me.find('.user-status'), data.status);
|
772 | 772 | });
|
773 | 773 | });
|
|
0 commit comments