mirror of
https://github.com/nextcloud/ocsms.git
synced 2026-08-11 16:32:55 +00:00
Tiny fixes
This commit is contained in:
+40
-40
@@ -8,7 +8,7 @@
|
||||
* @copyright Loic Blot 2014-2018
|
||||
*/
|
||||
|
||||
var ContactList = new Vue({
|
||||
var Conversation = new Vue({
|
||||
el: '#ocsms-app-content',
|
||||
data: {
|
||||
selectedContact: {},
|
||||
@@ -20,45 +20,45 @@ var ContactList = new Vue({
|
||||
},
|
||||
methods: {
|
||||
fetchConversation: function (contact) {
|
||||
// If contact is not null, we will fetch a conversation for a new contact
|
||||
if (contact != null) {
|
||||
this.selectedContact = contact;
|
||||
this.isConvLoading = true;
|
||||
}
|
||||
|
||||
this.messages = [];
|
||||
this.lastConvMessageDate = 0;
|
||||
|
||||
var self = this;
|
||||
$.getJSON(Sms.generateURL('/front-api/v1/conversation'), {'phoneNumber': $scope.selectedContact.nav},
|
||||
function (jsondata, status) {
|
||||
var phoneNumberLabel = self.selectedContact.nav;
|
||||
|
||||
if (typeof jsondata['phoneNumbers'] !== 'undefined') {
|
||||
var phoneNumberList = arrayUnique(jsondata['phoneNumbers']);
|
||||
phoneNumberLabel = phoneNumberList.toString();
|
||||
}
|
||||
|
||||
// Reinit messages before showing conversation
|
||||
app.formatConversation(jsondata);
|
||||
|
||||
$scope.$apply(function () {
|
||||
if (typeof jsondata['contactName'] === 'undefined' || jsondata['contactName'] === '') {
|
||||
self.selectedContact.label = phoneNumberLabel;
|
||||
self.selectedContact.opt_numbers = "";
|
||||
}
|
||||
else {
|
||||
self.selectedContact.label = jsondata['contactName'];
|
||||
self.selectedContact.opt_numbers = phoneNumberLabel;
|
||||
}
|
||||
|
||||
self.totalMessageCount = jsondata['msgCount'] !== undefined ? jsondata['msgCount'] : 0;
|
||||
self.isConvLoading = false;
|
||||
});
|
||||
|
||||
$('#ocsms-app-content').scrollTop(1E10);
|
||||
// If contact is not null, we will fetch a conversation for a new contact
|
||||
if (contact != null) {
|
||||
this.selectedContact = contact;
|
||||
this.isConvLoading = true;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.messages = [];
|
||||
this.lastConvMessageDate = 0;
|
||||
|
||||
var self = this;
|
||||
$.getJSON(Sms.generateURL('/front-api/v1/conversation'), {'phoneNumber': $scope.selectedContact.nav},
|
||||
function (jsondata, status) {
|
||||
var phoneNumberLabel = self.selectedContact.nav;
|
||||
|
||||
if (typeof jsondata['phoneNumbers'] !== 'undefined') {
|
||||
var phoneNumberList = arrayUnique(jsondata['phoneNumbers']);
|
||||
phoneNumberLabel = phoneNumberList.toString();
|
||||
}
|
||||
|
||||
// Reinit messages before showing conversation
|
||||
app.formatConversation(jsondata);
|
||||
|
||||
$scope.$apply(function () {
|
||||
if (typeof jsondata['contactName'] === 'undefined' || jsondata['contactName'] === '') {
|
||||
self.selectedContact.label = phoneNumberLabel;
|
||||
self.selectedContact.opt_numbers = "";
|
||||
}
|
||||
else {
|
||||
self.selectedContact.label = jsondata['contactName'];
|
||||
self.selectedContact.opt_numbers = phoneNumberLabel;
|
||||
}
|
||||
|
||||
self.totalMessageCount = jsondata['msgCount'] !== undefined ? jsondata['msgCount'] : 0;
|
||||
self.isConvLoading = false;
|
||||
});
|
||||
|
||||
$('#ocsms-app-content').scrollTop(1E10);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user