<commit_before>'use strict';

angular.module('eMarketApp')
    .directive('notifications', function(User, Restangular) {
      return {
        templateUrl: 'views/notifications.html',
        restrict: 'E',
        scope: {},
        replace: true,
        controller: function($scope) {
          $scope.getStatus = function(notification) {
            return notification.isRead ? 'Read' : 'Unread';
          };
        },
        link: function(scope, elem) {
          var page = $(elem[0]);
          var notificationList = page.find('#notificationList');
          var notificationPopUp = page.find('#notificationMessage');

          scope.readMessage = function(notification) {
            notificationPopUp.text(notification.message);
            notification.isRead = true;
          };

          page.on('pagebeforeshow', function() {
            User.me().getList('notifications').then(function(notifications) {
              scope.notifications = notifications;
            });
          });

          page.on('pageshow', function() {
            notificationList.listview('refresh');
          });
        }<commit_msg>improved notification list refresh.<commit_after>'use strict';

angular.module('eMarketApp')
    .directive('notifications', function(User, Restangular) {
      return {
        templateUrl: 'views/notifications.html',
        restrict: 'E',
        scope: {},
        replace: true,
        controller: function($scope) {
          $scope.getStatus = function(notification) {
            return notification.isRead ? 'Read' : 'Unread';
          };
        },
        link: function(scope, elem) {
          var page = $(elem[0]);
          var notificationList = page.find('#notificationList');
          var notificationPopUp = page.find('#notificationMessage');

          scope.readMessage = function(notification) {
            notificationPopUp.text(notification.message);
            notification.isRead = true;
          };

          page.on('pagebeforeshow', function() {
            User.me().getList('notifications').then(function(notifications) {
              scope.notifications = notifications;
              setTimeout(function() {
                notificationList.listview('refresh');
              });
            });
          });
        }
{'fraction_non_alphanumeric': 0.13011314186248912, 'fraction_numerical': 0.0008703220191470844, 'mean_word_length': 2.09005376344086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3000107', 'n_tokens_mistral': 571, 'n_tokens_neox': 559, 'n_words': 96}