Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1657 | Rev 1662 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1657 Rev 1661
Línea 47... Línea 47...
47
        loading: false
47
        loading: false
48
      }
48
      }
49
    }
49
    }
Línea 50... Línea 50...
50
 
50
 
51
    case feedActionTypes.REMOVE_COMMENT: {
51
    case feedActionTypes.REMOVE_COMMENT: {
52
      const { feedId, commentId, totalComments } = payload
52
      const { feedId, commentId } = payload
53
      const feed = state.feeds.byId[feedId]
-
 
54
      feed.owner_comments = totalComments
-
 
55
      feed.comments = feed.comments.filter(
-
 
56
        (comment) => comment.id !== commentId
-
 
Línea 57... Línea 53...
57
      )
53
      const feed = state.feeds.byId[feedId]
58
 
54
 
59
      return {
55
      return {
60
        ...state,
56
        ...state,
-
 
57
        feeds: {
61
        feeds: {
58
          ...state.feeds,
-
 
59
          byId: {
-
 
60
            ...state.feeds.byId,
-
 
61
            [feedId]: {
-
 
62
              ...feed,
-
 
63
              comments: (feed.comments = feed.comments.filter(
-
 
64
                (comment) => comment.id !== commentId
-
 
65
              )),
-
 
66
              owner_comments: feed.owner_comments - 1
62
          ...state.feeds,
67
            }
63
          byId: { ...state.feeds.byId, [feedId]: feed }
68
          }
64
        }
69
        }
Línea 65... Línea 70...
65
      }
70
      }
66
    }
71
    }
67
 
72
 
Línea 68... Línea 73...
68
    case feedActionTypes.ADD_COMMENT: {
73
    case feedActionTypes.ADD_COMMENT: {
69
      const { feedId, comment, totalComments } = payload
74
      const { feedId, comment } = payload
70
      const feed = state.feeds.byId[feedId]
75
      const feed = state.feeds.byId[feedId]
71
 
76
 
72
      return {
77
      return {
73
        ...state,
78
        ...state,
74
        feeds: {
79
        feeds: {
75
          ...state.feeds,
80
          ...state.feeds,
76
          byId: {
81
          byId: {
77
            ...state.feeds.byId,
82
            ...state.feeds.byId,
78
            [feedId]: {
83
            [feedId]: {
79
              ...feed,
84
              ...feed,
80
              owner_comments: totalComments,
85
              owner_comments: feed.owner_comments + 1,
81
              comments: [comment, ...feed.comments]
86
              comments: [...feed.comments, comment]
82
            }
87
            }