diff --git a/Changelog.md b/Changelog.md
index cfc751b00..9dc39b2bc 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -34,6 +34,7 @@
* Expose which services are configured in /statistics.json [#5121](https://github.com/diaspora/diaspora/pull/5121)
* In filtered notification views, replace "Mark all as read" with "Mark shown as read" [#5122](https://github.com/diaspora/diaspora/pull/5122)
* When ignoring a user remove his posts from the stream instantly [#5127](https://github.com/diaspora/diaspora/pull/5127)
+* Allow to delete photos from the pictures stream [#5131](https://github.com/diaspora/diaspora/pull/5131)
# 0.4.0.1
diff --git a/app/assets/javascripts/app/models/user.js b/app/assets/javascripts/app/models/user.js
index 0a9046df1..b08f281f8 100644
--- a/app/assets/javascripts/app/models/user.js
+++ b/app/assets/javascripts/app/models/user.js
@@ -15,5 +15,9 @@ app.models.User = Backbone.Model.extend({
isServiceConfigured : function(providerName) {
return _.include(this.get("configured_services"), providerName)
+ },
+
+ isAuthorOf: function(model) {
+ return this.authenticated() && model.get("author").id == this.id;
}
});
diff --git a/app/assets/javascripts/app/views/photo_view.js b/app/assets/javascripts/app/views/photo_view.js
index e4035be87..072f44744 100644
--- a/app/assets/javascripts/app/views/photo_view.js
+++ b/app/assets/javascripts/app/views/photo_view.js
@@ -4,10 +4,21 @@ app.views.Photo = app.views.Base.extend({
className : "photo loaded",
+ events: {
+ "click .remove_post": "destroyModel"
+ },
+
+ tooltipSelector : ".block_user, .delete",
+
initialize : function() {
$(this.el).attr("id", this.model.get("guid"));
this.model.bind('remove', this.remove, this);
return this;
+ },
+
+ presenter : function() {
+ return _.extend(this.defaultPresenter(), {
+ authorIsCurrentUser : app.currentUser.isAuthorOf(this.model),
+ });
}
-
-});
\ No newline at end of file
+});
diff --git a/app/assets/javascripts/app/views/post_view.js b/app/assets/javascripts/app/views/post_view.js
index 7d45e6bdf..59a8a985f 100644
--- a/app/assets/javascripts/app/views/post_view.js
+++ b/app/assets/javascripts/app/views/post_view.js
@@ -1,16 +1,12 @@
app.views.Post = app.views.Base.extend({
presenter : function() {
return _.extend(this.defaultPresenter(), {
- authorIsCurrentUser : this.authorIsCurrentUser(),
+ authorIsCurrentUser : app.currentUser.isAuthorOf(this.model),
showPost : this.showPost(),
text : app.helpers.textFormatter(this.model.get("text"), this.model)
})
},
- authorIsCurrentUser : function() {
- return app.currentUser.authenticated() && this.model.get("author").id == app.user().id
- },
-
showPost : function() {
return (app.currentUser.get("showNsfw")) || !this.model.get("nsfw")
}
diff --git a/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js b/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js
index 2bd252781..a012282c6 100644
--- a/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js
+++ b/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js
@@ -25,16 +25,12 @@ app.views.SinglePostContent = app.views.Base.extend({
presenter : function() {
return _.extend(this.defaultPresenter(), {
- authorIsCurrentUser : this.authorIsCurrentUser(),
+ authorIsCurrentUser :app.currentUser.isAuthorOf(this.model),
showPost : this.showPost(),
text : app.helpers.textFormatter(this.model.get("text"), this.model)
})
},
- authorIsCurrentUser : function() {
- return app.currentUser.authenticated() && this.model.get("author").id == app.user().id
- },
-
showPost : function() {
return (app.currentUser.get("showNsfw")) || !this.model.get("nsfw")
}
diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass
index 51ed2c419..3b3cab6e1 100644
--- a/app/assets/stylesheets/application.css.sass
+++ b/app/assets/stylesheets/application.css.sass
@@ -21,6 +21,7 @@
@import 'report'
@import 'new_styles/_forms'
@import 'tag'
+@import 'photo'
/* ====== media ====== */
.media
diff --git a/app/assets/stylesheets/photo.css.scss b/app/assets/stylesheets/photo.css.scss
new file mode 100644
index 000000000..5450bff44
--- /dev/null
+++ b/app/assets/stylesheets/photo.css.scss
@@ -0,0 +1,19 @@
+.photo {
+ .controls:first-child {
+ .control_icon {
+ @include transition(opacity);
+ @include opacity(0);
+ }
+ }
+
+ &:hover {
+ .controls:first-child {
+ .control_icon {
+ @include opacity(0.3);
+ }
+ .control_icon:hover {
+ @include opacity(1);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/assets/templates/photo_tpl.jst.hbs b/app/assets/templates/photo_tpl.jst.hbs
index 375d6869e..534b9b998 100644
--- a/app/assets/templates/photo_tpl.jst.hbs
+++ b/app/assets/templates/photo_tpl.jst.hbs
@@ -1,3 +1,29 @@
-
-
-
\ No newline at end of file
+