mirror of
				https://github.com/nerzhul/ocsms.git
				synced 2025-10-28 00:49:11 +00:00 
			
		
		
		
	Reset message count and only add new messages on refresh. Fixes nerzhul/ocsms#117
This commit is contained in:
		
							parent
							
								
									cdfae91598
								
							
						
					
					
						commit
						a54bd58eee
					
				| @ -150,6 +150,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' | ||||
| 			} | ||||
| 
 | ||||
| 			$scope.messages = []; | ||||
| 			g_lastMsgDate = 0; | ||||
| 
 | ||||
| 			$.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'), {'phoneNumber': $scope.selectedContact.nav}, | ||||
| 				function(jsondata, status) { | ||||
| @ -437,12 +438,12 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' | ||||
| 				// Note: we divide by 100 because number compare too large integers
 | ||||
| 				if ((id/100) > (g_lastMsgDate/100)) { | ||||
| 					g_lastMsgDate = id; | ||||
| 				} | ||||
| 
 | ||||
| 				// Multiplicate ID to permit date to use it properly
 | ||||
| 				$scope.addConversationMessage({'id': id, 'type': msgClass, 'date': new Date(id * 1), 'content': vals['msg']}); | ||||
| 				buf = true; | ||||
| 				msgCount++; | ||||
| 					// Multiplicate ID to permit date to use it properly
 | ||||
| 					$scope.addConversationMessage({'id': id, 'type': msgClass, 'date': new Date(id * 1), 'content': vals['msg']}); | ||||
| 					buf = true; | ||||
| 					msgCount++; | ||||
| 				} | ||||
| 
 | ||||
| 			}); | ||||
| 			return [msgCount,buf]; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user