<% if notification.action == "Reaction" %>
  <%= render "reaction", notification: notification %>
<% else %>
  <% json_data = notification.json_data %>
  <% cache "activity-profile-pic-#{json_data["user"]["id"]}-#{json_data["user"]["profile_image_90"]}" do %>
    <a href="<%= json_data["user"]["path"] %>" class="small-pic-link-wrapper">
      <div class="small-pic">
        <img src="<%= json_data["user"]["profile_image_90"] %>" alt="link to <%= json_data["user"]["username"] %>'s profile">
      </div>
    </a>
  <% end %>
  <div class="content notification-content article-content">
    <% cache "activity-published-article-#{json_data["article"]["id"]}-#{json_data["article"]["updated_at"]}" do %>
      <a href="<%= json_data["user"]["path"] %>">
        <%= json_data["user"]["name"] %>
      </a>
      made a new post:
      <a href="<%= json_data["article"]["path"] %>">
        <div class="notification-new-post">
          <div class="notification-new-post-title">
            <%= sanitize(json_data["article"]["title"]) %>
          </div>
          <div class="notification-new-post-tags">
            <% json_data["article"]["cached_tag_list_array"].each do |tag| %>
              #<%= tag %>
            <% end %>
          </div>
        </div>
      </a>
    <% end %>
    <% cache "activity-published-article-reactions-#{@last_user_reaction}-#{json_data["article"]["updated_at"]}-#{json_data["article"]["id"]}" do %>
      <div class="comment-actions">
        <button class="reaction-button <%= Reaction.cached_any_reactions_for?(notification.mocked_object("article"), current_user, "like") ? "reacted" : "" %>" data-reactable-id="<%=json_data["article"]["id"]%>" data-category="like" data-reactable-type="Article">
          <%= image_tag "favorite-heart-outline-button.svg" %>
          <img class="reacted-emoji" src="<%= asset_path("emoji/emoji-one-heart.png") %>"/>
        </button>
        <button class="reaction-button readinglist-button <%= Reaction.cached_any_reactions_for?(notification.mocked_object("article"), current_user, "readinglist") ? "reacted" : "" %>" data-reactable-id="<%=json_data["article"]["id"]%>" data-category="readinglist" data-reactable-type="Article">
          <span class="reaction-button-text">SAVE</span>
          <img class="reacted-emoji reaction-button-reacted-emoji" src="<%= asset_path("readinglist-button.png") %>"/>
        </button>
      </div>
    <% end %>
  </div>
<% end %>
