You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I dismiss announcements on the main page of the site, they don't stay dismissed, returning on page refresh.
Investigation so far
Looking at the code in site-announcements.js, clicking the cross dismiss button sends a post request to the back-end, presumably saving to a database the announcements a user has seen to filter them out.
Front-end
Fetch to get announcements
The call is made to https://kitsu.io/api/edge/feeds/site_announcements/57044?include=subject. I believe 57044 here is my user id.
The data returns 4 announcements. Each announcement seems to be split between two objects. The first has an id and a link to the second object. The second object contains the content to be shown in the announcement. This is probably linked to the "data enrichment" mentioned by the site-announcements.js.
Bear with me here, as I have never even seen ruby code before.
The controller routes seem to be defined in routes.rb. The relevant resource seems to be jsonapi_resources :site_announcements on line 142, with the appropriate route being
post '/feeds/:group/:id/_read', to: 'feeds#mark_read'
There seems to be a site_announcements controller, but that is basically empty.
Otherwise, the controller for feeds is feeds_controller.rb, which contains the mark_read action.
def mark_read
activities = feed.activities.mark(:read, params[:_json])
render_jsonapi stringify_activities(activities)
end
mark() here appears to be the function defined in activity_list.rb:
def mark(type, values = true)
values = [values] if values.is_a? String
data["mark_#{type}"] = values
self
end
This seems to set the field "mark_read" to true depending on the passed in json, though I'm not sure.
this bit in activity_list.rb may also be relevant:
%i[limit offset ranking mark_read mark_seen].each do |key|
define_method(key) do |value|
data[key] = value
self
end
end
To be honest, though I can find related pieces of code on the back-end, I am struggling to find whats wrong given that I do not know the language. Hopefully the stuff I've done above will be helpful and someone can find whats wrong.
The text was updated successfully, but these errors were encountered:
This is my first submitted issue! Yay!
The issue
When I dismiss announcements on the main page of the site, they don't stay dismissed, returning on page refresh.
Investigation so far
Looking at the code in
site-announcements.js
, clicking the cross dismiss button sends a post request to the back-end, presumably saving to a database the announcements a user has seen to filter them out.Front-end
Fetch to get announcements
The call is made to https://kitsu.io/api/edge/feeds/site_announcements/57044?include=subject. I believe 57044 here is my user id.
The data returns 4 announcements. Each announcement seems to be split between two objects. The first has an id and a link to the second object. The second object contains the content to be shown in the announcement. This is probably linked to the "data enrichment" mentioned by the
site-announcements.js
.Fetch to dismiss
Once I click on the dismiss button, the correct announcemment id seems to be sent to the back-end.
The url has a matching id. https://kitsu.io/api/edge/feeds/site_announcements/57044/_read
The response is a 200 success code.
Back-end
Bear with me here, as I have never even seen ruby code before.
The controller routes seem to be defined in routes.rb. The relevant resource seems to be
jsonapi_resources :site_announcements
on line 142, with the appropriate route beingThere seems to be a site_announcements controller, but that is basically empty.
Otherwise, the controller for feeds is
feeds_controller.rb
, which contains themark_read
action.mark()
here appears to be the function defined inactivity_list.rb
:This seems to set the field "mark_read" to true depending on the passed in json, though I'm not sure.
this bit in
activity_list.rb
may also be relevant:To be honest, though I can find related pieces of code on the back-end, I am struggling to find whats wrong given that I do not know the language. Hopefully the stuff I've done above will be helpful and someone can find whats wrong.
The text was updated successfully, but these errors were encountered: