Commit ebd1b28b authored by movilla's avatar movilla

Fix problem javascript with read-unread notifications on notifications popup

parent 83c2458d
# 0.0.2.0pre
Add password_confirmation field to registration page
Fix error with open/close registrations.
Fix javascripts error in invitations facebox.
Fix css overflow problem in aspect dropdown on welcome page.
## Add Features
* Add password_confirmation field to registration page. [#3647](https://github.com/diaspora/diaspora/pull/3647)
## Bug Fixes
* Fix javascripts problem with read/unread notifications. [#3656](https://github.com/diaspora/diaspora/pull/3656)
* Fix error with open/close registrations. [#3649](https://github.com/diaspora/diaspora/pull/3649)
* Fix javascripts error in invitations facebox. [#3638](https://github.com/diaspora/diaspora/pull/3638)
* Fix css overflow problem in aspect dropdown on welcome page. [#3637](https://github.com/diaspora/diaspora/pull/3637)
# 0.0.1.1
......
......@@ -54,7 +54,7 @@
}
this.unreadClick = function() {
$.ajax({
url: "/notifications/" + $(this).closest(".stream_element").data("guid"),
url: "/notifications/" + $(this).closest(".stream_element,.notification_element").data("guid"),
data: { set_unread: true },
type: "PUT",
success: self.clickSuccess
......
.notification_element{:data=>{:guid => n.id},:class => (n.unread ? "unread" : "read")}
.notification_element{:data=>{:guid => n.id}, :class => (n.unread ? "unread" : "read")}
%img{:src => n.actors.first.image_url(:thumb_medium)}
= notification_message_for(n)
%br/
%abbr.timeago{:title=>n.created_at.iso8601}
%a{:class => 'unread-setter'}
= t('notifications.index.mark_unread')
= notification_message_for(n)
%div
%time
= timeago(n.created_at)
= link_to t('notifications.index.mark_unread'), "#", :class => "unread-setter"
......@@ -17,7 +17,7 @@ describe("Diaspora.Widgets.Notifications", function() {
});
describe("clickSuccess", function(){
it("changes the css to a read cell", function() {
it("changes the css to a read cell at stream element", function() {
this.view.$(".notifications").html(
'<div id="1" class="stream_element read" data-guid=1></div>' +
'<div id="2" class="stream_element unread" data-guid=2></div>'
......@@ -25,7 +25,15 @@ describe("Diaspora.Widgets.Notifications", function() {
notifications.clickSuccess({guid:2,unread:false});
expect( this.view.$('.stream_element#2')).toHaveClass("read");
});
it("changes the css to an unread cell", function() {
it("changes the css to a read cell at notications element", function() {
this.view.$(".notifications").html(
'<div id="1" class="notification_element read" data-guid=1></div>' +
'<div id="2" class="notification_element unread" data-guid=2></div>'
);
notifications.clickSuccess({guid:2,unread:false});
expect( this.view.$('.notification_element#2')).toHaveClass("read");
});
it("changes the css to an unread cell at stream element", function() {
this.view.$(".notifications").html(
'<div id="1" class="stream_element read" data-guid=1></div>' +
'<div id="2" class="stream_element unread" data-guid=2></div>'
......@@ -33,13 +41,21 @@ describe("Diaspora.Widgets.Notifications", function() {
notifications.clickSuccess({guid:1,unread:true});
expect( this.view.$('.stream_element#1')).toHaveClass("unread");
});
it("changes the css to an unread cell at notications element", function() {
this.view.$(".notifications").html(
'<div id="1" class="notification_element read" data-guid=1></div>' +
'<div id="2" class="notification_element unread" data-guid=2></div>'
);
notifications.clickSuccess({guid:1,unread:true});
expect( this.view.$('.notification_element#1')).toHaveClass("unread");
});
it("calls Notifications.decrementCount on a read cell", function() {
it("calls Notifications.decrementCount on a read cell at stream/notification element", function() {
notifications.clickSuccess(JSON.stringify({guid:1,unread:false}));
expect(notifications.decrementCount).toHaveBeenCalled();
});
it("calls Notifications.incrementCount on a unread cell", function() {
it("calls Notifications.incrementCount on a unread cell at stream/notification element", function() {
notifications.clickSuccess({guid:1,unread:true});
expect(notifications.incrementCount).toHaveBeenCalled();
});
......@@ -103,4 +119,4 @@ describe("Diaspora.Widgets.Notifications", function() {
});
});
});
\ No newline at end of file
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment