File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11$ ( ( ) => {
2+ /**
3+ * @param {QPixelNotification } notification
4+ */
25 const makeNotification = ( notification ) => {
36 const template = `<div class="js-notification widget h-m-0 h-m-b-2 ${ notification . is_read ? 'read' : 'is-teal' } ">
47 <div class="widget--body h-p-2">
Original file line number Diff line number Diff line change 11# Provides web and API actions relating to user notifications.
22class NotificationsController < ApplicationController
3+ include CommentsHelper
4+
35 before_action :authenticate_user! , only : [ :index ]
46
57 def index
68 @notifications = Notification . unscoped . where ( user : current_user ) . paginate ( page : params [ :page ] , per_page : 100 )
79 . order ( Arel . sql ( 'is_read ASC, created_at DESC' ) )
810 respond_to do |format |
911 format . html { render :index , layout : 'without_sidebar' }
10- format . json { render json : @notifications , methods : :community_name }
12+ format . json do
13+ render json : ( @notifications . to_a . map do |notif |
14+ notif . as_json . merge ( content : helpers . render_pings_text ( notif . content ) )
15+ end ) , methods : :community_name
16+ end
1117 end
1218 end
1319
Original file line number Diff line number Diff line change 66<% @notifications . each do |notif | %>
77 < div class ="notification ">
88 < div class ="form-caption "> <%= CGI . unescape_html ( notif . created_at . strftime ( '%b %-d, %Y at %H:%M' ) ) . html_safe %> </ div >
9- < a href ="<%= notif . link %> "> <%= notif . content %> </ a >
9+ < a href ="<%= notif . link %> "> <%= render_pings_text ( notif . content ) %> </ a >
1010 </ div >
1111<% end %>
1212
Original file line number Diff line number Diff line change @@ -65,6 +65,18 @@ interface QPixelKeyboard {
6565 updateSelected : ( ) => void ;
6666}
6767
68+ type QPixelNotification = {
69+ community_id : number ,
70+ community_name : string ,
71+ content : string ,
72+ created_at : string ,
73+ id : number ,
74+ is_read : boolean ,
75+ link : string ,
76+ updated_at : string ,
77+ user_id : number
78+ }
79+
6880type NotificationType = "warning" | "success" | "danger" ;
6981
7082type QPixelPopupCallback = ( ev : JQuery . ClickEvent , popup : QPixelPopup ) => void
You can’t perform that action at this time.
0 commit comments