Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove notifications #430

Merged
merged 5 commits into from
Jun 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 0 additions & 33 deletions app/assets/stylesheets/main.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1914,39 +1914,6 @@ a.lightbox-x {

}

/*
-------------------
Inbox notifications
-------------------
*/

.inbox-notifications {

.notification {
position: relative;
border-top: 1px dotted $border;
min-height: lines(2);
padding: lines(0.5) 0;
}

.notification-text {
padding: em(5) lines(0.5) em(10) lines(2);
}

.notification-icon {
position: absolute;
top: em(19);
left: em(17);
}

small {
margin-top: lines(0.25);
display: block;
color: $aside;
}

}

/*
-------------------
Single conversation
Expand Down
8 changes: 0 additions & 8 deletions app/controllers/conversations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ def received
request.xhr? ? (render :partial => "additional_messages") : (render :action => :index)
end

def notifications
@selected_left_navi_link = "notifications"
@notifications = @current_user.notifications.paginate(:per_page => 20, :page => params[:page])
@unread_notifications = @current_user.notifications.unread.all
@current_user.mark_all_notifications_as_read
render :partial => "additional_notifications" if request.xhr?
end

def show
@selected_left_navi_link = "messages"
@current_user.read(@conversation) unless @conversation.read_by?(@current_user)
Expand Down
18 changes: 0 additions & 18 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -753,24 +753,6 @@ def admin_links_for(community)
links
end

# Inbox view left hand navigation content
def inbox_links_for(person)
[
{
:text => t("layouts.conversations.messages"),
:icon_class => icon_class("mail"),
:path => received_person_messages_path(:person_id => person.id.to_s),
:name => "messages"
},
{
:text => t("layouts.conversations.notifications"),
:icon_class => icon_class("notifications"),
:path => notifications_person_messages_path(:person_id => person.id.to_s),
:name => "notifications"
}
]
end

# Settings view left hand navigation content
def settings_links_for(person, community=nil)
links = [
Expand Down
13 changes: 0 additions & 13 deletions app/models/badge_notification.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class Comment < ActiveRecord::Base

belongs_to :author, :class_name => "Person"
belongs_to :listing, :counter_cache => true
has_many :notifications, :as => :notifiable, :dependent => :destroy

attr_accessor :author_follow_status

Expand All @@ -13,7 +12,6 @@ class Comment < ActiveRecord::Base
# Creates notifications related to this comment and sends notification emails
def send_notifications(community)
if !listing.author.id.eql?(author.id)
Notification.create(:notifiable_id => id, :notifiable_type => "Comment", :receiver_id => listing.author.id, :description => "to_own_listing")
if listing.author.should_receive?("email_about_new_comments_to_own_listing")
PersonMailer.new_comment_to_own_listing_notification(self, community).deliver
end
Expand Down
3 changes: 0 additions & 3 deletions app/models/listing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Listing < ActiveRecord::Base
has_many :listing_images, :dependent => :destroy

has_many :conversations
has_many :notifications, :as => :notifiable, :dependent => :destroy
has_many :comments, :dependent => :destroy
has_many :custom_field_values, :dependent => :destroy
has_many :custom_dropdown_field_values, :class_name => "DropdownFieldValue"
Expand Down Expand Up @@ -318,10 +317,8 @@ def notify_followers(community, current_user, update)
followers.each do |follower|
unless follower.id == current_user.id
if update
Notification.create(:notifiable_id => self.id, :notifiable_type => "Listing", :receiver_id => follower.id, :description => "updated")
PersonMailer.new_update_to_followed_listing_notification(self, follower, community).deliver
else
Notification.create(:notifiable_id => comments.last.id, :notifiable_type => "Comment", :receiver_id => follower.id, :description => "to_followed_listing")
PersonMailer.new_comment_to_followed_listing_notification(comments.last, follower, community).deliver
end
end
Expand Down
19 changes: 0 additions & 19 deletions app/models/notification.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class Person < ActiveRecord::Base
has_many :received_negative_testimonials, :class_name => "Testimonial", :foreign_key => "receiver_id", :conditions => "grade IN (0.0,0.25)", :order => "id DESC"
has_many :messages, :foreign_key => "sender_id"
has_many :badges, :dependent => :destroy
has_many :notifications, :foreign_key => "receiver_id", :order => "id DESC", :dependent => :destroy
has_many :authored_comments, :class_name => "Comment", :foreign_key => "author_id", :dependent => :destroy
has_many :community_memberships, :dependent => :destroy
has_many :communities, :through => :community_memberships, :conditions => ['status = ?', 'accepted']
Expand Down Expand Up @@ -359,7 +358,6 @@ def read(conversation)
def give_badge(badge_name, community)
unless has_badge?(badge_name) || ! community.badges_in_use
badge = Badge.create(:person_id => id, :name => badge_name)
Notification.create(:notifiable_id => badge.id, :notifiable_type => "Badge", :receiver_id => id)
if should_receive?("email_about_new_badges")
PersonMailer.new_badge(badge, community).deliver
end
Expand All @@ -370,10 +368,6 @@ def has_badge?(badge)
! badges.find_by_name(badge).nil?
end

def mark_all_notifications_as_read
Notification.update_all("is_read = 1", ["is_read = 0 AND receiver_id = ?", id])
end

def grade_amounts
grade_amounts = []
Testimonial::GRADES.each_with_index do |grade, index|
Expand Down Expand Up @@ -596,7 +590,6 @@ def merge(source_person)
source_person.received_testimonials.each { |asset| asset.receiver = self ; asset.save(:validate => false) }
source_person.messages.each { |asset| asset.sender = self ; asset.save(:validate => false) }
source_person.badges.each { |asset| asset.person = self ; asset.save(:validate => false) }
source_person.notifications.each { |asset| asset.receiver = self ; asset.save(:validate => false) }
source_person.authored_comments.each { |asset| asset.author = self ; asset.save(:validate => false) }
source_person.community_memberships.each { |asset| asset.person = self ; asset.save(:validate => false)}
source_person.invitations.each { |asset| asset.inviter = self ; asset.save(:validate => false) }
Expand Down
3 changes: 0 additions & 3 deletions app/models/testimonial.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class Testimonial < ActiveRecord::Base
belongs_to :receiver, :class_name => "Person"
belongs_to :participation

has_one :notification, :as => :notifiable, :dependent => :destroy

validates_inclusion_of :grade, :in => 0..1, :allow_nil => false

scope :positive, where("grade >= 0.5")
Expand All @@ -21,7 +19,6 @@ def displayed_grade
end

def notify_receiver(community)
Notification.create(:notifiable_id => id, :notifiable_type => "Testimonial", :receiver_id => receiver.id)
if receiver.should_receive?("email_about_new_received_testimonials")
begin
PersonMailer.new_testimonial(self, community).deliver
Expand Down
13 changes: 0 additions & 13 deletions app/models/testimonial_notification.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/views/conversations/_additional_notifications.haml

This file was deleted.

7 changes: 0 additions & 7 deletions app/views/conversations/_notification.haml

This file was deleted.

4 changes: 1 addition & 3 deletions app/views/conversations/index.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
= render :partial => "layouts/left_hand_navigation", :locals => { :links => inbox_links_for(@current_user) }

- content_for :title_header do
%h1= t("layouts.no_tribe.inbox")

#conversations.inbox-feed.left-navi-section
#conversations.inbox-feed.centered-section-wide
- if @conversations && !@conversations.empty?
= render :partial => @conversations
= will_paginate(@conversations)
Expand Down
12 changes: 0 additions & 12 deletions app/views/conversations/notifications.haml

This file was deleted.

6 changes: 0 additions & 6 deletions app/views/conversations/notifications/_badgenotification.haml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 5 additions & 5 deletions app/views/conversations/show.haml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
- content_for :javascript do
initialize_reply_form('#{I18n.locale}');

= render :partial => "layouts/left_hand_navigation", :locals => { :links => inbox_links_for(@current_user) }

- content_for :title_header do
%h1= t("layouts.no_tribe.inbox")
%h1
= link_to received_person_messages_path(:person_id => @current_user.id) do
= t("layouts.no_tribe.inbox")
| #{@conversation.title}

.left-navi-section.conversation
%h2= @conversation.title
.centered-section-wide.conversation
.avatar-container
.avatar
= small_avatar_thumb @other_party
Expand Down
22 changes: 0 additions & 22 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,28 +420,6 @@ en:
you_will_get_notified: "You will get an email notification when %{person} answers you."
title: Title
send_message_to_user: "Send message to %{person}"
notifications:
badgenotification:
see_all_your_badges: "See all your badges"
you_have_earned_badge: "You have earned the badge"
comment_to_followed_listing_notification:
has_commented: "%{author} has commented on"
offer_you_follow: "an offer you follow"
request_you_follow: "a request you follow"
listing_updated_notification:
has_updated: "has updated"
offer_you_follow: "an offer you follow"
request_you_follow: "a request you follow"
comment_to_own_listing_notification:
has_commented: "%{author} has commented on"
your_offer: "your offer"
your_request: "your request"
loading_more_notifications: "Loading more notifications"
no_notifications: "No notifications."
testimonialnotification:
give_feedback_to: "Give feedback to %{name}"
has_given_you_feedback_on_event: "has given you feedback on event"
see_all_the_feedback_you_have_received: "see all the feedback you have received"
show:
in_response_to_listing: "about listing"
message_sent_by: "Message sent by"
Expand Down
22 changes: 0 additions & 22 deletions config/locales/fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,28 +420,6 @@ fi:
you_will_get_notified: "Saat sähköpostiisi tiedon, kun %{person} vastaa sinulle."
title: Otsikko
send_message_to_user: "Lähetä viesti käyttäjälle %{person}"
notifications:
badgenotification:
see_all_your_badges: "Katso kaikki ansiomerkkisi"
you_have_earned_badge: "Olet ansainnut ansiomerkin"
comment_to_followed_listing_notification:
has_commented: "%{author} kommentoi"
offer_you_follow: "seuraamaasi tarjousta"
request_you_follow: "seuraamaasi pyyntöä"
listing_updated_notification:
has_updated: "on päivittänyt"
offer_you_follow: "seuraamasi tarjouksen"
request_you_follow: "seuraamasi pyynnön"
comment_to_own_listing_notification:
has_commented: "%{author} kommentoi"
your_offer: tarjoustasi
your_request: pyyntöäsi
loading_more_notifications: "Ladataan lisää tiedotteita"
no_notifications: "Ei tiedotteita."
testimonialnotification:
give_feedback_to: "Anna palautetta käyttäjälle %{name}"
has_given_you_feedback_on_event: "on antanut sinulle palautetta tapahtumasta"
see_all_the_feedback_you_have_received: "katso kaikki saamasi palautteet"
show:
in_response_to_listing: "liittyen ilmoitukseen"
message_sent_by: "Viestin lähetti"
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
collection do
get :received
get :sent
get :notifications
end
member do
get :accept
Expand Down
3 changes: 0 additions & 3 deletions features/conversations/user_checks_inbox.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ Feature: User checks inbox
And I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see "Massage" within ".inbox-feed"
And I should see "Messages" within ".selected"
And I should see "Notifications" within ".left-navi"
And I should not see "Notifications" within ".selected"
And I should see "Test message" within ".inbox-feed"

Scenario: Viewing a single conversation
Expand Down