parent
d3de97b244
commit
05e9798027
6 changed files with 18 additions and 10 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Don't hide posts when blocking someone from the profile [#7379](https://github.com/diaspora/diaspora/pull/7379)
|
* Don't hide posts when blocking someone from the profile [#7379](https://github.com/diaspora/diaspora/pull/7379)
|
||||||
* Disable autocomplete for the conversation form recipient input [#7375](https://github.com/diaspora/diaspora/pull/7375)
|
* Disable autocomplete for the conversation form recipient input [#7375](https://github.com/diaspora/diaspora/pull/7375)
|
||||||
|
* Fix sharing indicator on profile page for blocked users [#7382](https://github.com/diaspora/diaspora/pull/7382)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* Add links to liked and commented pages [#5502](https://github.com/diaspora/diaspora/pull/5502)
|
* Add links to liked and commented pages [#5502](https://github.com/diaspora/diaspora/pull/5502)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ app.models.Person = Backbone.Model.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
isBlocked: function() {
|
isBlocked: function() {
|
||||||
return (this.get('relationship') === 'blocked');
|
return (this.get("block") !== false);
|
||||||
},
|
},
|
||||||
|
|
||||||
block: function() {
|
block: function() {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ class PersonPresenter < BasePresenter
|
||||||
|
|
||||||
def relationship
|
def relationship
|
||||||
return false unless current_user
|
return false unless current_user
|
||||||
return :blocked if is_blocked?
|
|
||||||
|
|
||||||
contact = current_user_person_contact
|
contact = current_user_person_contact
|
||||||
return :not_sharing unless contact
|
return :not_sharing unless contact
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ describe("app.models.Person", function() {
|
||||||
this.mutualContact = factory.person({relationship: "mutual"});
|
this.mutualContact = factory.person({relationship: "mutual"});
|
||||||
this.sharingContact = factory.person({relationship: "sharing"});
|
this.sharingContact = factory.person({relationship: "sharing"});
|
||||||
this.receivingContact = factory.person({relationship: "receiving"});
|
this.receivingContact = factory.person({relationship: "receiving"});
|
||||||
this.blockedContact = factory.person({relationship: "blocked", block: {id: 1}});
|
this.blockedContact = factory.person({relationship: "sharing", block: {id: 1}});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("initialize", function() {
|
describe("initialize", function() {
|
||||||
|
|
@ -20,9 +20,9 @@ describe("app.models.Person", function() {
|
||||||
it("indicates if the person is sharing", function() {
|
it("indicates if the person is sharing", function() {
|
||||||
expect(this.mutualContact.isSharing()).toBeTruthy();
|
expect(this.mutualContact.isSharing()).toBeTruthy();
|
||||||
expect(this.sharingContact.isSharing()).toBeTruthy();
|
expect(this.sharingContact.isSharing()).toBeTruthy();
|
||||||
|
expect(this.blockedContact.isSharing()).toBeTruthy();
|
||||||
|
|
||||||
expect(this.receivingContact.isSharing()).toBeFalsy();
|
expect(this.receivingContact.isSharing()).toBeFalsy();
|
||||||
expect(this.blockedContact.isSharing()).toBeFalsy();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,7 @@ var factory = {
|
||||||
"name": "Bob Grimm",
|
"name": "Bob Grimm",
|
||||||
"diaspora_id": "bob@localhost:3000",
|
"diaspora_id": "bob@localhost:3000",
|
||||||
"relationship": "sharing",
|
"relationship": "sharing",
|
||||||
|
"block": false,
|
||||||
"is_own_profile": false
|
"is_own_profile": false
|
||||||
};
|
};
|
||||||
return _.extend({}, defaults, overrides);
|
return _.extend({}, defaults, overrides);
|
||||||
|
|
|
||||||
|
|
@ -92,12 +92,6 @@ describe PersonPresenter do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "relationship" do
|
context "relationship" do
|
||||||
it "is blocked?" do
|
|
||||||
allow(current_user).to receive(:block_for) { double(id: 1) }
|
|
||||||
allow(current_user).to receive(:contact_for) { non_contact }
|
|
||||||
expect(@p.full_hash[:relationship]).to be(:blocked)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "is mutual?" do
|
it "is mutual?" do
|
||||||
allow(current_user).to receive(:contact_for) { mutual_contact }
|
allow(current_user).to receive(:contact_for) { mutual_contact }
|
||||||
expect(@p.full_hash[:relationship]).to be(:mutual)
|
expect(@p.full_hash[:relationship]).to be(:mutual)
|
||||||
|
|
@ -118,6 +112,19 @@ describe PersonPresenter do
|
||||||
expect(@p.full_hash[:relationship]).to be(:not_sharing)
|
expect(@p.full_hash[:relationship]).to be(:not_sharing)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "block" do
|
||||||
|
it "contains the block id if it exists" do
|
||||||
|
allow(current_user).to receive(:contact_for) { non_contact }
|
||||||
|
allow(current_user).to receive(:block_for) { double(id: 1) }
|
||||||
|
expect(@p.full_hash[:block][:id]).to be(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "is false if no block is present" do
|
||||||
|
allow(current_user).to receive(:contact_for) { non_contact }
|
||||||
|
expect(@p.full_hash[:block]).to be(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#hovercard" do
|
describe "#hovercard" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue