Sha256: c5e0eb178225e012ba0c0ca94f7504541bd636480b838a293372242bcf4bae6d
Contents?: true
Size: 823 Bytes
Versions: 2
Compression:
Stored size: 823 Bytes
Contents
module Wupee class Api::NotificationsController < ApplicationController def index scopes = params[:scopes].present? ? params[:scopes].split(',') : [] scopes = ['read', 'unread', 'wanted', 'unwanted', 'ordered'] & scopes @notifications = current_user.notifications scopes.each do |scope| @notifications = @notifications.public_send(scope) end end def show @notification = find_notification end def mark_as_read @notification = find_notification @notification.mark_as_read render :show end def mark_all_as_read current_user.notifications.unread.update_all(is_read: true) head :no_content end private def find_notification current_user.notifications.find(params[:id]) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wupee-2.0.0.beta2 | app/controllers/wupee/api/notifications_controller.rb |
wupee-2.0.0.beta1 | app/controllers/wupee/api/notifications_controller.rb |