nsfw's users posts are now nsfw
This commit is contained in:
parent
558ceec92a
commit
8ae18bb393
4 changed files with 8 additions and 10 deletions
|
|
@ -36,6 +36,7 @@ class Post < ActiveRecord::Base
|
||||||
t.add :user_like
|
t.add :user_like
|
||||||
t.add :mentioned_people
|
t.add :mentioned_people
|
||||||
t.add :photos
|
t.add :photos
|
||||||
|
t.add :nsfw
|
||||||
end
|
end
|
||||||
|
|
||||||
xml_attr :provider_display_name
|
xml_attr :provider_display_name
|
||||||
|
|
@ -125,4 +126,8 @@ class Post < ActiveRecord::Base
|
||||||
def comment_email_subject
|
def comment_email_subject
|
||||||
I18n.t('notifier.a_post_you_shared')
|
I18n.t('notifier.a_post_you_shared')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def nsfw
|
||||||
|
self.author.profile.nsfw?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,8 @@ class StatusMessage < Post
|
||||||
self.photos << Photo.where(:id => photo_ids, :author_id => self.author_id).all
|
self.photos << Photo.where(:id => photo_ids, :author_id => self.author_id).all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def nsfw
|
||||||
def nsfw?
|
self.raw_message.match(/#nsfw/i) || super
|
||||||
self.raw_message.match(/#nsfw/i)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def formatted_message(opts={})
|
def formatted_message(opts={})
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
Then /^the post "([^"]*)" should be marked nsfw$/ do |text|
|
Then /^the post "([^"]*)" should be marked nsfw$/ do |text|
|
||||||
pending
|
|
||||||
assert_nsfw(text)
|
assert_nsfw(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,7 @@ app.views.Post = app.views.StreamObject.extend({
|
||||||
|
|
||||||
presenter : function() {
|
presenter : function() {
|
||||||
return _.extend(this.defaultPresenter(), {
|
return _.extend(this.defaultPresenter(), {
|
||||||
authorIsCurrentUser : this.authorIsCurrentUser(),
|
authorIsCurrentUser : this.authorIsCurrentUser()
|
||||||
nsfw : this.nsfw()
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -107,9 +106,5 @@ app.views.Post = app.views.StreamObject.extend({
|
||||||
|
|
||||||
authorIsCurrentUser : function() {
|
authorIsCurrentUser : function() {
|
||||||
return this.model.get("author").id != (!!app.user() && app.user().id)
|
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)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue