fixed markdown issues with reshares; removed puts from specs
This commit is contained in:
parent
687eb7ba0b
commit
e928cc805a
5 changed files with 34 additions and 16 deletions
|
|
@ -62,13 +62,8 @@ class Post < ActiveRecord::Base
|
||||||
self.class.name
|
self.class.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw_message
|
def raw_message; ""; end
|
||||||
""
|
def mentioned_people; []; end
|
||||||
end
|
|
||||||
|
|
||||||
def mentioned_people
|
|
||||||
[]
|
|
||||||
end
|
|
||||||
|
|
||||||
# gives the last three comments on the post
|
# gives the last three comments on the post
|
||||||
def last_three_comments
|
def last_three_comments
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,11 @@ class Reshare < Post
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw_message
|
def raw_message
|
||||||
self.root ? root.raw_message : ""
|
self.root ? root.raw_message : super
|
||||||
|
end
|
||||||
|
|
||||||
|
def mentioned_people
|
||||||
|
self.root ? root.mentioned_people : super
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive(recipient, sender)
|
def receive(recipient, sender)
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<%= root.text %>
|
<%= text %>
|
||||||
|
|
||||||
<% if(o_embed_cache) { %>
|
<% if(o_embed_cache) { %>
|
||||||
<%= root.o_embed_cache.posts.data.html %>
|
<%= root.o_embed_cache.posts.data.html %>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ describe PublicsController do
|
||||||
get :host_meta
|
get :host_meta
|
||||||
response.should be_success
|
response.should be_success
|
||||||
response.body.should =~ /webfinger/
|
response.body.should =~ /webfinger/
|
||||||
puts "Saving host-meta fixture to #{fixture_path}"
|
|
||||||
save_fixture(response.body, "host-meta", fixture_path)
|
save_fixture(response.body, "host-meta", fixture_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ describe("app.views.Post", function(){
|
||||||
|
|
||||||
this.collection = new app.collections.Stream(posts);
|
this.collection = new app.collections.Stream(posts);
|
||||||
this.statusMessage = this.collection.models[0];
|
this.statusMessage = this.collection.models[0];
|
||||||
|
this.reshare = this.collection.models[1];
|
||||||
})
|
})
|
||||||
|
|
||||||
it("displays a reshare count", function(){
|
it("displays a reshare count", function(){
|
||||||
|
|
@ -72,6 +73,17 @@ describe("app.views.Post", function(){
|
||||||
expect(view.$("h1:contains(parties)")).not.toExist();
|
expect(view.$("h1:contains(parties)")).not.toExist();
|
||||||
expect(view.$("a:contains('#parties')")).toExist();
|
expect(view.$("a:contains('#parties')")).toExist();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("works on reshares", function(){
|
||||||
|
this.statusMessage.set({text: "I love #parties"})
|
||||||
|
var reshare = new app.models.Reshare(factory.post({
|
||||||
|
text : this.statusMessage.get("text"),
|
||||||
|
root : this.statusMessage
|
||||||
|
}))
|
||||||
|
|
||||||
|
var view = new app.views.Post({model : reshare}).render();
|
||||||
|
expect(view.$("a:contains('#parties')").attr('href')).toBe('/tags/parties')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
context("changes mention markup to links", function(){
|
context("changes mention markup to links", function(){
|
||||||
|
|
@ -87,23 +99,31 @@ describe("app.views.Post", function(){
|
||||||
diaspora_id : "bob@example.com",
|
diaspora_id : "bob@example.com",
|
||||||
id : "666"
|
id : "666"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.statusMessage.set({mentioned_people : [this.alice, this.bob]})
|
||||||
|
this.statusMessage.set({text: "hey there @{Alice Smith; alice@example.com} and @{Bob Grimm; bob@example.com}"})
|
||||||
})
|
})
|
||||||
|
|
||||||
it("links to the mentioned person's page", function(){
|
it("links to the mentioned person's page", function(){
|
||||||
this.statusMessage.set({mentioned_people : [this.alice]})
|
|
||||||
this.statusMessage.set({text: "sup, @{Alice Smith; alice@example.com}?"})
|
|
||||||
|
|
||||||
var view = new app.views.Post({model : this.statusMessage}).render();
|
var view = new app.views.Post({model : this.statusMessage}).render();
|
||||||
expect(view.$("a:contains('Alice Smith')").attr('href')).toBe('/people/555')
|
expect(view.$("a:contains('Alice Smith')").attr('href')).toBe('/people/555')
|
||||||
})
|
})
|
||||||
|
|
||||||
it("matches all mentions", function(){
|
it("matches all mentions", function(){
|
||||||
this.statusMessage.set({mentioned_people : [this.alice, this.bob]})
|
|
||||||
this.statusMessage.set({text: "hey there @{Alice Smith; alice@example.com} and @{Bob Grimm; bob@example.com}"})
|
|
||||||
|
|
||||||
var view = new app.views.Post({model : this.statusMessage}).render();
|
var view = new app.views.Post({model : this.statusMessage}).render();
|
||||||
expect(view.$("a.mention").length).toBe(2)
|
expect(view.$("a.mention").length).toBe(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("works on reshares", function(){
|
||||||
|
var reshare = new app.models.Reshare(factory.post({
|
||||||
|
text : this.statusMessage.get("text"),
|
||||||
|
mentioned_people : this.statusMessage.get("mentioned_people"),
|
||||||
|
root : this.statusMessage
|
||||||
|
}))
|
||||||
|
|
||||||
|
var view = new app.views.Post({model : reshare}).render();
|
||||||
|
expect(view.$("a.mention").length).toBe(2)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
context("user not signed in", function(){
|
context("user not signed in", function(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue