Merge branch 'next-minor' into develop
This commit is contained in:
commit
064fc3cc45
7 changed files with 73 additions and 24 deletions
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
## Bug fixes
|
||||
* Make photo upload button hover text translatable [#7429](https://github.com/diaspora/diaspora/pull/7429)
|
||||
* Fix first comment in mobile view with french locale [#7441](https://github.com/diaspora/diaspora/pull/7441)
|
||||
* Use post page title and post author in atom feed [#7420](https://github.com/diaspora/diaspora/pull/7420)
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@
|
|||
increaseReactionCount: function(bottomBar) {
|
||||
var toggleReactionsLink = bottomBar.find(".show-comments").first();
|
||||
var count = toggleReactionsLink.text().match(/.*(\d+).*/);
|
||||
count = parseInt(count, 10);
|
||||
count = parseInt(count, 10) || 0;
|
||||
var text = Diaspora.I18n.t("stream.comments", {count: count + 1});
|
||||
|
||||
// No previous comment
|
||||
|
|
|
|||
12
app/helpers/activity_streams_helper.rb
Normal file
12
app/helpers/activity_streams_helper.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
module ActivityStreamsHelper
|
||||
def add_activitystreams_author(target, person)
|
||||
target.author do |author|
|
||||
author.name person.name
|
||||
author.uri local_or_remote_person_path(person, absolute: true)
|
||||
|
||||
author.tag! "activity:object-type", "http://activitystrea.ms/schema/1.0/person"
|
||||
author.tag! "poco:preferredUsername", person.username
|
||||
author.tag! "poco:displayName", person.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -17,21 +17,16 @@ atom_feed("xmlns:thr" => "http://purl.org/syndication/thread/1.0",
|
|||
'media:height' => '100', :href => "#{@user.image_url}"
|
||||
feed.tag! :link, :href => "#{AppConfig.environment.pubsub_server}", :rel => 'hub'
|
||||
|
||||
feed.author do |author|
|
||||
author.name @user.name
|
||||
author.uri local_or_remote_person_path(@user.person, :absolute => true)
|
||||
|
||||
author.tag! 'activity:object-type', 'http://activitystrea.ms/schema/1.0/person'
|
||||
author.tag! 'poco:preferredUsername', @user.username
|
||||
author.tag! 'poco:displayName', @user.name
|
||||
end
|
||||
add_activitystreams_author(feed, @user.person)
|
||||
|
||||
@posts.each do |post|
|
||||
feed.entry post, :url => "#{@user.url}p/#{post.id}",
|
||||
:id => "#{@user.url}p/#{post.id}" do |entry|
|
||||
|
||||
entry.title post.message.title
|
||||
entry.title post_page_title(post)
|
||||
entry.content post.message.markdownified(disable_hovercards: true), :type => 'html'
|
||||
add_activitystreams_author(entry, post.author)
|
||||
|
||||
entry.tag! 'activity:verb', 'http://activitystrea.ms/schema/1.0/post'
|
||||
entry.tag! 'activity:object-type', 'http://activitystrea.ms/schema/1.0/note'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
describe UsersController, :type => :controller do
|
||||
include_context :gon
|
||||
include PostsHelper
|
||||
|
||||
before do
|
||||
@user = alice
|
||||
|
|
@ -46,20 +47,40 @@ describe UsersController, :type => :controller do
|
|||
end
|
||||
|
||||
describe '#public' do
|
||||
it 'renders xml if atom is requested' do
|
||||
sm = FactoryGirl.create(:status_message, :public => true, :author => @user.person)
|
||||
get :public, :username => @user.username, :format => :atom
|
||||
expect(response.body).to include(sm.text)
|
||||
end
|
||||
|
||||
it 'renders xml if atom is requested with clickalbe urls' do
|
||||
sm = FactoryGirl.create(:status_message, :public => true, :author => @user.person)
|
||||
@user.person.posts.each do |p|
|
||||
p.text = "Goto http://diasporaproject.org/ now!"
|
||||
p.save
|
||||
context "entry xml contents" do
|
||||
before do
|
||||
@sm = FactoryGirl.create(
|
||||
:status_message,
|
||||
public: true,
|
||||
author: @user.person,
|
||||
text: "Go to http://diasporafoundation.org/ now!"
|
||||
)
|
||||
end
|
||||
|
||||
it "contains the text" do
|
||||
get :public, username: @user.username, format: :atom
|
||||
doc = Nokogiri::XML(response.body)
|
||||
expect(doc.css("entry content")[0].content).to eq(@sm.message.markdownified(disable_hovercards: true))
|
||||
end
|
||||
|
||||
it "contains the title" do
|
||||
get :public, username: @user.username, format: :atom
|
||||
doc = Nokogiri::XML(response.body)
|
||||
expect(doc.css("entry title")[0].content).to eq(post_page_title(@sm))
|
||||
end
|
||||
|
||||
it "contains the author" do
|
||||
get :public, username: @user.username, format: :atom
|
||||
doc = Nokogiri::XML(response.body)
|
||||
expect(doc.css("entry author name")[0].content).to eq(@sm.author_name)
|
||||
end
|
||||
|
||||
it "contains the original author for reshares" do
|
||||
FactoryGirl.create(:reshare, root: @sm, author: bob.person)
|
||||
get :public, username: bob.username, format: :atom
|
||||
doc = Nokogiri::XML(response.body)
|
||||
expect(doc.css("entry author name")[0].content).to eq(@sm.author_name)
|
||||
end
|
||||
get :public, :username => @user.username, :format => :atom
|
||||
expect(response.body).to include('a href')
|
||||
end
|
||||
|
||||
it 'includes reshares in the atom feed' do
|
||||
|
|
|
|||
|
|
@ -17,6 +17,13 @@ describe PostsHelper, :type => :helper do
|
|||
post_page_title(post)
|
||||
end
|
||||
end
|
||||
|
||||
context "with a reshare" do
|
||||
it "returns 'Reshare by...'" do
|
||||
reshare = FactoryGirl.create(:reshare, author: alice.person)
|
||||
expect(post_page_title(reshare)).to eq I18n.t("posts.show.reshare_by", author: reshare.author_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ describe("Diaspora.Mobile.Comments", function(){
|
|||
expect(this.toggleReactionsLink.text().trim()).toBe("6 comments");
|
||||
});
|
||||
|
||||
it("Creates the reaction link when no reactions", function(){
|
||||
it("Creates the reaction link when there are no reactions", function() {
|
||||
var parent = this.toggleReactionsLink.parent();
|
||||
var postGuid = this.bottomBar.parents(".stream-element").data("guid");
|
||||
this.toggleReactionsLink.remove();
|
||||
|
|
@ -155,6 +155,18 @@ describe("Diaspora.Mobile.Comments", function(){
|
|||
expect(this.toggleReactionsLink.text().trim()).toBe("1 comment");
|
||||
expect(this.toggleReactionsLink.attr("href")).toBe("/posts/" + postGuid + "/comments.mobile");
|
||||
});
|
||||
|
||||
it("Creates the reaction link when there are no reactions (french locale)", function() {
|
||||
var parent = this.toggleReactionsLink.parent();
|
||||
var postGuid = this.bottomBar.parents(".stream-element").data("guid");
|
||||
this.toggleReactionsLink.remove();
|
||||
parent.prepend($("<span/>", {"class": "show-comments"}).text("Aucun commentaire"));
|
||||
|
||||
Diaspora.Mobile.Comments.increaseReactionCount(this.bottomBar);
|
||||
this.toggleReactionsLink = this.bottomBar.find(".show-comments").first();
|
||||
expect(this.toggleReactionsLink.text().trim()).toBe("1 comment");
|
||||
expect(this.toggleReactionsLink.attr("href")).toBe("/posts/" + postGuid + "/comments.mobile");
|
||||
});
|
||||
});
|
||||
|
||||
describe("bottomBarLazy", function(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue