From eba9e8f829c6af0bc1ae40a8e7c615c2d31379ca Mon Sep 17 00:00:00 2001 From: Dennis Schubert Date: Wed, 30 Mar 2016 16:52:00 +0200 Subject: [PATCH 1/7] Prepare 0.5.9.0 cycle [ci skip] --- Changelog.md | 8 ++++++++ config/defaults.yml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index d3e6a457f..fe84ef06d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,11 @@ +# 0.5.9.0 + +## Refactor + +## Bug fixes + +## Features + # 0.5.8.0 ## Refactor diff --git a/config/defaults.yml b/config/defaults.yml index 3bf62ab66..11a28906c 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -4,7 +4,7 @@ defaults: version: - number: "0.5.7.99" # Do not touch unless doing a release, do not backport the version number that's in master + number: "0.5.9.99" # Do not touch unless doing a release, do not backport the version number that's in master heroku: false environment: url: "http://localhost:3000/" From 52d1084cb1895326e072b5bc94a338488d57d795 Mon Sep 17 00:00:00 2001 From: Flaburgan Date: Mon, 4 Apr 2016 11:16:29 +0200 Subject: [PATCH 2/7] Fix back to top icon not appearing on webkit browsers --- app/assets/javascripts/app/views/back_to_top_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/views/back_to_top_view.js b/app/assets/javascripts/app/views/back_to_top_view.js index 66c516475..0289c8fb0 100644 --- a/app/assets/javascripts/app/views/back_to_top_view.js +++ b/app/assets/javascripts/app/views/back_to_top_view.js @@ -16,7 +16,7 @@ app.views.BackToTop = Backbone.View.extend({ }, toggleVisibility: function() { - if($("html, body").scrollTop() > 1000) { + if($(document).scrollTop() > 1000) { $("#back-to-top").addClass("visible"); } else { $("#back-to-top").removeClass("visible"); From 61d27c3391e5702552f04abd4d973517eda19d12 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Wed, 13 Apr 2016 22:16:13 +0200 Subject: [PATCH 3/7] Add Changelog for #6782 [ci skip] --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index fe84ef06d..cd5d8d618 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ ## Refactor ## Bug fixes +* Fix back to top button not appearing on Webkit browsers [#6782](https://github.com/diaspora/diaspora/pull/6782) ## Features From 8fe11d7da798f7b66b4abba2a117faa7d8cd6809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Wed, 27 Apr 2016 11:52:07 +0200 Subject: [PATCH 4/7] Workaround https://github.com/travis-ci/travis-ci/issues/329 by encrypting the channel setting Courtesy of https://github.com/mozilla/build-tools/commit/c13a297 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5c042de70..6d57bbc8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,6 @@ script: "./script/ci/build.sh" notifications: irc: channels: - - "irc.freenode.org:6667#diaspora-dev" + - secure: YvYkeTAw+5oOl/RaXVwu7JkKGNWPoFosNQRmLvJkBFbWzZ1s5LZD1u3+Qj819bT3lGzJu9pxmJg765IRYrGWmBi4mcAV3dpO6qowVdFTcorf0JsnLw3Kvkga9rrDunsRNr21KTAQqHOO5mKUzw9DtMzd52BiWuZwIj3xcl72gQI= template: - "%{repository_slug}#%{commit} (%{branch} - %{commit_subject}): %{message} %{build_url}" From ce6b1a3c0c2c56ab90ff1a91152dfaf5d827e955 Mon Sep 17 00:00:00 2001 From: Senya Date: Thu, 21 Apr 2016 16:11:39 +0300 Subject: [PATCH 5/7] Clear unused regex in mention.rb The REGEX is unused closes #6810 --- Changelog.md | 1 + app/models/mention.rb | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index cd5d8d618..6ecc0ce22 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ # 0.5.9.0 ## Refactor +* Remove unused mentions regex [#6810](https://github.com/diaspora/diaspora/pull/6810) ## Bug fixes * Fix back to top button not appearing on Webkit browsers [#6782](https://github.com/diaspora/diaspora/pull/6782) diff --git a/app/models/mention.rb b/app/models/mention.rb index 47c2f719a..caab2a8b2 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -3,8 +3,6 @@ # the COPYRIGHT file. class Mention < ActiveRecord::Base - REGEX = /@\{([^;]+); ([^\}]+)\}/ - belongs_to :post belongs_to :person validates :post, :presence => true From 4cd2f1d9c165807ce83dd79684380885baaf7756 Mon Sep 17 00:00:00 2001 From: sjain1107 Date: Fri, 29 Apr 2016 23:39:28 +0530 Subject: [PATCH 6/7] Add inviter diaspora-ID to the invite email #6796 closes #6817 --- Changelog.md | 2 ++ app/controllers/invitations_controller.rb | 2 +- app/views/notifier/invite.markerb | 2 +- config/locales/diaspora/en.yml | 4 +++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 6ecc0ce22..1f4915fbe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,8 @@ ## Features +* The sender's diaspora-ID is now shown in invitation mails [#6817](https://github.com/diaspora/diaspora/pull/6817) + # 0.5.8.0 ## Refactor diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 1801c39fe..6acf3602d 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -39,7 +39,7 @@ class InvitationsController < ApplicationController else params[:invitation_code] end - + @inviter = user || InvitationCode.where(id: params[:invitation_code]).first.try(:user) if @invitation_code.present? render 'notifier/invite', :layout => false else diff --git a/app/views/notifier/invite.markerb b/app/views/notifier/invite.markerb index f5222067b..1e00c6c0a 100644 --- a/app/views/notifier/invite.markerb +++ b/app/views/notifier/invite.markerb @@ -1 +1 @@ -<%= t('.message', :invite_url => invite_code_url(@invitation_code), :diasporafoundation_url => 'https://diasporafoundation.org/') %> +<%= t('.message', :invite_url => invite_code_url(@invitation_code), :diasporafoundation_url => 'https://diasporafoundation.org/', :diaspora_id => @inviter.try(:diaspora_handle)) %> diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index a74e956fb..36354accd 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -838,12 +838,14 @@ en: message: |- Hello! - You have been invited to join diaspora*! + You have been invited to join diaspora* by %{diaspora_id}! Click this link to get started [%{invite_url}][1] + Or you can add %{diaspora_id} to your contacts if you already have an account. + Love, From 1773e3e35d3cf706a06088d4c36155a5ff4ab916 Mon Sep 17 00:00:00 2001 From: Ralin Chimev Date: Fri, 6 May 2016 23:46:34 +0300 Subject: [PATCH 7/7] Do not change notification timestamp when making it read or unread. Marking a notification as unread resets the timeago stamp causing the times to look wrong. It can be reproduced by marking an old notification as unread. Using the update_column instead of update_attribute will not touch the updated_at attribute, and thus will not affect the updated time ago in the view. Fixes #6798. closes #6821 --- Changelog.md | 1 + app/models/notification.rb | 6 +++--- spec/controllers/notifications_controller_spec.rb | 13 +++++++++++++ spec/models/notification_spec.rb | 4 +++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 1f4915fbe..fda559717 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ ## Bug fixes * Fix back to top button not appearing on Webkit browsers [#6782](https://github.com/diaspora/diaspora/pull/6782) +* Don't reset the notification timestamp when marking them as read [#6821](https://github.com/diaspora/diaspora/pull/6821) ## Features diff --git a/app/models/notification.rb b/app/models/notification.rb index 4cec79128..91d697a47 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -9,7 +9,7 @@ class Notification < ActiveRecord::Base belongs_to :target, :polymorphic => true attr_accessor :note_html - + def self.for(recipient, opts={}) self.where(opts.merge!(:recipient_id => recipient.id)).order('updated_at desc') end @@ -29,7 +29,7 @@ class Notification < ActiveRecord::Base actor, note_type) end return_note.email_the_user(target, actor) if return_note - return_note + return_note end def as_json(opts={}) @@ -41,7 +41,7 @@ class Notification < ActiveRecord::Base end def set_read_state( read_state ) - self.update_attributes( :unread => !read_state ) + update_column(:unread, !read_state) end def mail_job diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index 2e79d431d..c8ef2dc22 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -31,6 +31,19 @@ describe NotificationsController, :type => :controller do get :update, "id" => note.id, :set_unread => "true", :format => :json end + it "marks a notification as unread without timestamping" do + note = Timecop.travel(1.hour.ago) do + FactoryGirl.create(:notification, recipient: alice, unread: false) + end + + get :update, "id" => note.id, :set_unread => "true", :format => :json + expect(response).to be_success + + updated_note = Notification.find(note.id) + expect(updated_note.unread).to eq(true) + expect(updated_note.updated_at.iso8601).to eq(note.updated_at.iso8601) + end + it 'only lets you read your own notifications' do user2 = bob diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index b7bd65f71..34317494b 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -41,15 +41,17 @@ describe Notification, :type => :model do describe 'set_read_state method' do it "should set an unread notification to read" do @note.unread = true + @note.save @note.set_read_state( true ) expect(@note.unread).to eq(false) end + it "should set an read notification to unread" do @note.unread = false + @note.save @note.set_read_state( false ) expect(@note.unread).to eq(true) end - end