<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[43056] trunk/src: Privacy: add "Mine" filter for media similarly to posts and comments.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/43056">43056</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/43056","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-05-01 15:42:38 +0000 (Tue, 01 May 2018)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Privacy: add "Mine" filter for media similarly to posts and comments.
Props audrasjb.
See <a href="https://core.trac.wordpress.org/ticket/43820">#43820</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesajaxactionsphp">trunk/src/wp-admin/includes/ajax-actions.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpmedialisttablephp">trunk/src/wp-admin/includes/class-wp-media-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludespostphp">trunk/src/wp-admin/includes/post.php</a></li>
<li><a href="#trunksrcwpincludesjsmediamodelsqueryjs">trunk/src/wp-includes/js/media/models/query.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaviewsattachmentfiltersalljs">trunk/src/wp-includes/js/media/views/attachment-filters/all.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaviewsattachmentfiltersuploadedjs">trunk/src/wp-includes/js/media/views/attachment-filters/uploaded.js</a></li>
<li><a href="#trunksrcwpincludesjsmediamodelsjs">trunk/src/wp-includes/js/media-models.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaviewsjs">trunk/src/wp-includes/js/media-views.js</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/ajax-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/ajax-actions.php 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-admin/includes/ajax-actions.php 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2627,6 +2627,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'paged',
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_mime_type',
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_parent',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'author',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'post__in',
</span><span class="cx" style="display: block; padding: 0 10px"> 'post__not_in',
</span><span class="cx" style="display: block; padding: 0 10px"> 'year',
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpmedialisttablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-media-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-media-list-table.php 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-admin/includes/class-wp-media-list-table.php 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -130,6 +130,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> _x( 'Trash', 'attachment filter' )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $type_links['mine'] = sprintf(
+ '<option value="mine"%s>%s</option>',
+ selected( 'mine' === $filter, true, false ),
+ __( 'Mine' )
+ );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $type_links;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminincludespostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/post.php 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-admin/includes/post.php 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1211,6 +1211,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $q['post_parent'] = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $q['mine'] ) || ( isset( $q['attachment-filter'] ) && 'mine' == $q['attachment-filter'] ) ) {
+ $q['author'] = get_current_user_id();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Filter query clauses to include filenames.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $q['s'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediamodelsqueryjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/media/models/query.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/media/models/query.js 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-includes/js/media/models/query.js 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,7 +71,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Only observe when a limited number of query args are set. There
</span><span class="cx" style="display: block; padding: 0 10px"> // are no filters for other properties, so observing will result in
</span><span class="cx" style="display: block; padding: 0 10px"> // false positives in those queries.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent' ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent', 'author' ];
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( wp.Uploader && _( this.args ).chain().keys().difference( allowed ).isEmpty().value() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> this.observe( wp.Uploader.queue );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -188,14 +188,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @readonly
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> propmap: {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'search': 's',
- 'type': 'post_mime_type',
- 'perPage': 'posts_per_page',
- 'menuOrder': 'menu_order',
- 'uploadedTo': 'post_parent',
- 'status': 'post_status',
- 'include': 'post__in',
- 'exclude': 'post__not_in'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'search': 's',
+ 'type': 'post_mime_type',
+ 'perPage': 'posts_per_page',
+ 'menuOrder': 'menu_order',
+ 'uploadedTo': 'post_parent',
+ 'status': 'post_status',
+ 'include': 'post__in',
+ 'exclude': 'post__not_in',
+ 'author': 'author'
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Creates and returns an Attachments Query collection given the properties.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -217,6 +218,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {Object} [props.menu_order]
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {Object} [props.post_parent]
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {Object} [props.post_status]
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {Object} [props.author]
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param {Object} [options]
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @returns {wp.media.model.Query} A new Attachments Query collection.
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaviewsattachmentfiltersalljs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/media/views/attachment-filters/all.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/media/views/attachment-filters/all.js 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-includes/js/media/views/attachment-filters/all.js 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,7 +14,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> All = wp.media.view.AttachmentFilters.extend(/** @lends wp.media.view.AttachmentFilters.All.prototype */{
</span><span class="cx" style="display: block; padding: 0 10px"> createFilters: function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var filters = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var filters = {},
+ uid = window.userSettings ? parseInt( window.userSettings.uid, 10 ) : 0;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> _.each( wp.media.view.settings.mimeTypes || {}, function( text, key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> filters[ key ] = {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,7 +25,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> type: key,
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'DESC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'DESC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,7 +38,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> type: null,
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'DESC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'DESC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 10
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,7 +52,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> type: null,
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: wp.media.view.settings.post.id,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'menuOrder',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'ASC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'ASC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 20
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -62,11 +66,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: 0,
</span><span class="cx" style="display: block; padding: 0 10px"> type: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'menuOrder',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'ASC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'ASC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 50
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( uid ) {
+ filters.mine = {
+ text: l10n.mine,
+ props: {
+ status: null,
+ type: null,
+ uploadedTo: null,
+ orderby: 'date',
+ order: 'DESC',
+ author: uid
+ },
+ priority: 50
+ };
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( wp.media.view.settings.mediaTrash &&
</span><span class="cx" style="display: block; padding: 0 10px"> this.controller.isModeActive( 'grid' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -77,7 +97,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> status: 'trash',
</span><span class="cx" style="display: block; padding: 0 10px"> type: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'DESC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'DESC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 50
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaviewsattachmentfiltersuploadedjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/media/views/attachment-filters/uploaded.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/media/views/attachment-filters/uploaded.js 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-includes/js/media/views/attachment-filters/uploaded.js 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,6 +16,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> createFilters: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var type = this.model.get('type'),
</span><span class="cx" style="display: block; padding: 0 10px"> types = wp.media.view.settings.mimeTypes,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ uid = window.userSettings ? parseInt( window.userSettings.uid, 10 ) : 0,
</ins><span class="cx" style="display: block; padding: 0 10px"> text;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( types && type ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,7 +29,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> props: {
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'DESC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'DESC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 10
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -38,7 +40,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> props: {
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: wp.media.view.settings.post.id,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'menuOrder',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'ASC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'ASC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 20
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -48,11 +51,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> props: {
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: 0,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'menuOrder',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'ASC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'ASC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 50
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( uid ) {
+ this.filters.mine = {
+ text: l10n.mine,
+ props: {
+ orderby: 'date',
+ order: 'DESC',
+ author: uid
+ },
+ priority: 50
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediamodelsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/media-models.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/media-models.js 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-includes/js/media-models.js 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1121,7 +1121,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Only observe when a limited number of query args are set. There
</span><span class="cx" style="display: block; padding: 0 10px"> // are no filters for other properties, so observing will result in
</span><span class="cx" style="display: block; padding: 0 10px"> // false positives in those queries.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent' ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent', 'author' ];
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( wp.Uploader && _( this.args ).chain().keys().difference( allowed ).isEmpty().value() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> this.observe( wp.Uploader.queue );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1238,14 +1238,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @readonly
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> propmap: {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'search': 's',
- 'type': 'post_mime_type',
- 'perPage': 'posts_per_page',
- 'menuOrder': 'menu_order',
- 'uploadedTo': 'post_parent',
- 'status': 'post_status',
- 'include': 'post__in',
- 'exclude': 'post__not_in'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'search': 's',
+ 'type': 'post_mime_type',
+ 'perPage': 'posts_per_page',
+ 'menuOrder': 'menu_order',
+ 'uploadedTo': 'post_parent',
+ 'status': 'post_status',
+ 'include': 'post__in',
+ 'exclude': 'post__not_in',
+ 'author': 'author'
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Creates and returns an Attachments Query collection given the properties.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1267,6 +1268,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {Object} [props.menu_order]
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {Object} [props.post_parent]
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {Object} [props.post_status]
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {Object} [props.author]
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param {Object} [options]
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @returns {wp.media.model.Query} A new Attachments Query collection.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1623,4 +1625,4 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /***/ })
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/******/ });
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/******/ });
</ins></span></pre></div>
<a id="trunksrcwpincludesjsmediaviewsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/media-views.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/media-views.js 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-includes/js/media-views.js 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7251,6 +7251,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> createFilters: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var type = this.model.get('type'),
</span><span class="cx" style="display: block; padding: 0 10px"> types = wp.media.view.settings.mimeTypes,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ uid = window.userSettings ? parseInt( window.userSettings.uid, 10 ) : 0,
</ins><span class="cx" style="display: block; padding: 0 10px"> text;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( types && type ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7263,7 +7264,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> props: {
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'DESC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'DESC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 10
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7273,7 +7275,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> props: {
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: wp.media.view.settings.post.id,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'menuOrder',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'ASC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'ASC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 20
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7283,11 +7286,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> props: {
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: 0,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'menuOrder',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'ASC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'ASC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 50
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( uid ) {
+ this.filters.mine = {
+ text: l10n.mine,
+ props: {
+ orderby: 'date',
+ order: 'DESC',
+ author: uid
+ },
+ priority: 50
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7314,7 +7330,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> All = wp.media.view.AttachmentFilters.extend(/** @lends wp.media.view.AttachmentFilters.All.prototype */{
</span><span class="cx" style="display: block; padding: 0 10px"> createFilters: function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var filters = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var filters = {},
+ uid = window.userSettings ? parseInt( window.userSettings.uid, 10 ) : 0;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> _.each( wp.media.view.settings.mimeTypes || {}, function( text, key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> filters[ key ] = {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7324,7 +7341,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> type: key,
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'DESC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'DESC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7336,7 +7354,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> type: null,
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'DESC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'DESC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 10
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7349,7 +7368,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> type: null,
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: wp.media.view.settings.post.id,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'menuOrder',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'ASC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'ASC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 20
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7362,11 +7382,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> uploadedTo: 0,
</span><span class="cx" style="display: block; padding: 0 10px"> type: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'menuOrder',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'ASC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'ASC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 50
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( uid ) {
+ filters.mine = {
+ text: l10n.mine,
+ props: {
+ status: null,
+ type: null,
+ uploadedTo: null,
+ orderby: 'date',
+ order: 'DESC',
+ author: uid
+ },
+ priority: 50
+ };
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( wp.media.view.settings.mediaTrash &&
</span><span class="cx" style="display: block; padding: 0 10px"> this.controller.isModeActive( 'grid' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7377,7 +7413,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> status: 'trash',
</span><span class="cx" style="display: block; padding: 0 10px"> type: null,
</span><span class="cx" style="display: block; padding: 0 10px"> orderby: 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- order: 'DESC'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ order: 'DESC',
+ author: null
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> priority: 50
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9425,4 +9462,4 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /***/ })
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/******/ ]));
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/******/ ]));
</ins></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/media.php 2018-05-01 13:58:02 UTC (rev 43055)
+++ trunk/src/wp-includes/media.php 2018-05-01 15:42:38 UTC (rev 43056)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3657,6 +3657,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'noItemsFound' => __( 'No items found.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'insertIntoPost' => $post_type_object->labels->insert_into_item,
</span><span class="cx" style="display: block; padding: 0 10px"> 'unattached' => __( 'Unattached' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mine' => __( 'Mine' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'trash' => _x( 'Trash', 'noun' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'uploadedToThisPost' => $post_type_object->labels->uploaded_to_this_item,
</span><span class="cx" style="display: block; padding: 0 10px"> 'warnDelete' => __( "You are about to permanently delete this item from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ),
</span></span></pre>
</div>
</div>
</body>
</html>