nsfw's users posts are now nsfw

This commit is contained in:
Dennis Collinson 2012-02-07 19:14:44 -08:00
parent 558ceec92a
commit 8ae18bb393
4 changed files with 8 additions and 10 deletions

View file

@ -36,6 +36,7 @@ class Post < ActiveRecord::Base
t.add :user_like
t.add :mentioned_people
t.add :photos
t.add :nsfw
end
xml_attr :provider_display_name
@ -125,4 +126,8 @@ class Post < ActiveRecord::Base
def comment_email_subject
I18n.t('notifier.a_post_you_shared')
end
def nsfw
self.author.profile.nsfw?
end
end

View file

@ -63,9 +63,8 @@ class StatusMessage < Post
self.photos << Photo.where(:id => photo_ids, :author_id => self.author_id).all
end
def nsfw?
self.raw_message.match(/#nsfw/i)
def nsfw
self.raw_message.match(/#nsfw/i) || super
end
def formatted_message(opts={})

View file

@ -1,5 +1,4 @@
Then /^the post "([^"]*)" should be marked nsfw$/ do |text|
pending
assert_nsfw(text)
end

View file

@ -49,8 +49,7 @@ app.views.Post = app.views.StreamObject.extend({
presenter : function() {
return _.extend(this.defaultPresenter(), {
authorIsCurrentUser : this.authorIsCurrentUser(),
nsfw : this.nsfw()
authorIsCurrentUser : this.authorIsCurrentUser()
})
},
@ -107,9 +106,5 @@ app.views.Post = app.views.StreamObject.extend({
authorIsCurrentUser : function() {
return this.model.get("author").id != (!!app.user() && app.user().id)
},
nsfw : function() {
return this.model.get("text") !== null && this.model.get("text").match(/#nsfw/i)
}
});