Skip to content
Extraits de code Groupes Projets
Valider 8ae18bb3 rédigé par Dennis Collinson's avatar Dennis Collinson
Parcourir les fichiers

nsfw's users posts are now nsfw

parent 558ceec9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -36,6 +36,7 @@ class Post < ActiveRecord::Base ...@@ -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 ...@@ -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 ...@@ -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={})
......
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({ ...@@ -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({ ...@@ -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)
} }
}); });
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter