Changeset 13580
- Timestamp:
- 09/10/2023 09:56:11 AM (12 months ago)
- Location:
- trunk/src
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-template.php
r13530 r13580 678 678 // Backwards compatibility for anyone forcing a 'true' active_format. 679 679 if ( true === $r['active_format'] ) { 680 /* translators: %s: human time diff of the last time the site was active.*/680 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 681 681 $r['active_format'] = _x( 'Active %s', 'last time the site was active', 'buddypress' ); 682 682 } -
trunk/src/bp-core/classes/class-bp-core-user.php
r13433 r13580 205 205 ); 206 206 207 /* translators: %s: human time diff of the last time the user was active on the site.*/207 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 208 208 $this->last_active = bp_core_get_last_activity( bp_get_user_last_activity( $this->id ), _x( 'Active %s', 'last time the user was active', 'buddypress' ) ); 209 209 } -
trunk/src/bp-friends/blocks/dynamic-widget/index.asset.php
r13463 r13580 1 <?php return array('dependencies' => array('bp-dynamic-widget-block', 'wp-i18n'), 'version' => ' 86c938fd7a5540936871');1 <?php return array('dependencies' => array('bp-dynamic-widget-block', 'wp-i18n'), 'version' => '7e8413a4fbd65196d22e'); -
trunk/src/bp-friends/blocks/dynamic-widget/index.js
r13463 r13580 1 1 !function(){"use strict";var e=window.wp.i18n,t=window.bp.dynamicWidgetBlock;class s extends t.dynamicWidgetBlock{loop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"active";const i=super.useTemplate("bp-friends-item"),n=document.querySelector("#"+s);let d="";t&&t.length?t.forEach((t=>{if("active"===r&&t.last_activity) 2 /* translators: %s: a human time diff. */ 3 t.extra=(0,e.sprintf)((0,e.__)("Active %s","buddypress"),t.last_activity.timediff);else if("popular"===r&&t.total_friend_count){const s=parseInt(t.total_friend_count,10);t.extra=0===s?(0,e.__)("No friends","buddypress"):1===s?(0,e.__)("1 friend","buddypress"):(0,e.sprintf)((0,e.__)("%s friends","buddypress"),t.total_friend_count)}else"newest"===r&&t.registered_since&&( 2 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 3 t.extra=(0,e.sprintf)((0,e.__)("Active %s","buddypress"),t.last_activity.timediff);else if("popular"===r&&t.total_friend_count){const s=parseInt(t.total_friend_count,10);t.extra=0===s?(0,e.__)("No friends","buddypress"):1===s?(0,e.__)("1 friend","buddypress"):(0,e.sprintf)(/* translators: %s: total friend count (more than 1). */ 4 (0,e.__)("%s friends","buddypress"),t.total_friend_count)}else"newest"===r&&t.registered_since&&( 4 5 /* translators: %s is time elapsed since the registration date happened */ 5 6 t.extra=(0,e.sprintf)((0,e.__)("Registered %s","buddypress"),t.registered_since)) -
trunk/src/bp-groups/blocks/dynamic-widget/index.asset.php
r13463 r13580 1 <?php return array('dependencies' => array('bp-dynamic-widget-block', 'wp-i18n'), 'version' => ' 0de576e74bb5d9f2c117');1 <?php return array('dependencies' => array('bp-dynamic-widget-block', 'wp-i18n'), 'version' => 'befbb1ee657b7586372e'); -
trunk/src/bp-groups/blocks/dynamic-widget/index.js
r13463 r13580 1 1 !function(){"use strict";var e=window.wp.i18n,t=window.bp.dynamicWidgetBlock;class s extends t.dynamicWidgetBlock{loop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"active";const o=super.useTemplate("bp-dynamic-groups-item"),a=document.querySelector("#"+s);let n="";t&&t.length?t.forEach((t=>{if("newest"===r&&t.created_since) 2 2 /* translators: %s is time elapsed since the group was created */ 3 t.extra=(0,e.sprintf)((0,e.__)("Created %s","buddypress"),t.created_since);else if("popular"===r&&t.total_member_count){const s=parseInt(t.total_member_count,10);t.extra=0===s?(0,e.__)("No members","buddypress"):1===s?(0,e.__)("1 member","buddypress"):(0,e.sprintf)((0,e.__)("%s members","buddypress"),t.total_member_count)}else 4 /* translators: %s: a human time diff. */ 3 t.extra=(0,e.sprintf)((0,e.__)("Created %s","buddypress"),t.created_since);else if("popular"===r&&t.total_member_count){const s=parseInt(t.total_member_count,10);t.extra=0===s?(0,e.__)("No members","buddypress"):1===s?(0,e.__)("1 member","buddypress"):(0,e.sprintf)(/* translators: %s is the number of Group members (more than 1). */ 4 (0,e.__)("%s members","buddypress"),t.total_member_count)}else 5 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 5 6 t.extra=(0,e.sprintf)((0,e.__)("Active %s","buddypress"),t.last_activity_diff); 6 7 /* Translators: %s is the group's name. */t.avatar_alt=(0,e.sprintf)((0,e.__)("Group Profile photo of %s","buddypress"),t.name),n+=o(t)})):n='<div class="widget-error">'+(0,e.__)("There are no groups to display.","buddypress")+"</div>",a.innerHTML=n}start(){this.blocks.forEach(((e,t)=>{const{selector:s}=e,{type:r}=e.query_args,o=document.querySelector("#"+s).closest(".bp-dynamic-block-container");super.getItems(r,t),o.querySelectorAll(".item-options a").forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),e.target.closest(".item-options").querySelector(".selected").classList.remove("selected"),e.target.classList.add("selected");const s=e.target.getAttribute("data-bp-sort");s!==this.blocks[t].query_args.type&&super.getItems(s,t)}))}))}))}}const r=new s(window.bpDynamicGroupsSettings||{},window.bpDynamicGroupsBlocks||[]);"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r.start()):r.start()}(); -
trunk/src/bp-groups/blocks/groups/index.asset.php
r13463 r13580 1 <?php return array('dependencies' => array('bp-block-components', 'bp-block-data', 'lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => ' 3c20f668b1652b3a87fa');1 <?php return array('dependencies' => array('bp-block-components', 'bp-block-data', 'lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '9d7501097110d21a7517'); -
trunk/src/bp-groups/blocks/groups/index.js
r13463 r13580 1 !function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,r=window.wp.element,s=window.wp.apiFetch,n=e.n(s),a=window.wp.blockEditor,o=window.wp.components,l=window.wp.i18n,i=window.wp.url,d=window.bp.blockComponents,u=window.bp.blockData;const p=[{label:(0,l.__)("None","buddypress"),value:"none"},{label:(0,l.__)("Thumb","buddypress"),value:"thumb"},{label:(0,l.__)("Full","buddypress"),value:"full"}],c={public:(0,l.__)("Public","buddypress"),private:(0,l.__)("Private","buddypress"),hidden:(0,l.__)("Hidden","buddypress")},m=[{label:(0,l.__)("None","buddypress"),value:"none"},{label:(0,l.__)("Group's description","buddypress"),value:"description"},{label:(0,l.__)("Last time the group was active","buddypress"),value:"active"},{label:(0,l.__)("Amount of group members","buddypress"),value:"popular"}];var b=window.lodash;const _=e=>e&&e.status&&c[e.status]?c[e.status]:null;var y=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"bp/groups","title":"Groups","category":"widgets","icon":"buddicons-groups","description":"BuddyPress Groups.","keywords":["BuddyPress","groups","community"],"textdomain":"buddypress","attributes":{"itemIDs":{"type":"array","items":{"type":"integer"},"default":[]},"avatarSize":{"type":"string","default":"full"},"displayGroupName":{"type":"boolean","default":true},"extraInfo":{"type":"string","default":"none"},"layoutPreference":{"type":"string","default":"list"},"columns":{"type":"number","default":2}},"supports":{"align":true},"editorScript":"file:index.js","style":"file:index.css"}');(0,t.registerBlockType)(y,{icon:{background:"#fff",foreground:"#d84800",src:"buddicons-groups"},edit:e=>{let{attributes:t,setAttributes:s,isSelected:c}=e;const y=(0,a.useBlockProps)(),g=(0,u.isActive)("groups","avatar"),{itemIDs:v,avatarSize:f,displayGroupName:h,extraInfo:w,layoutPreference:E,columns:k}=t,N=0!==v.length,[x,C]=(0,r.useState)([]),P=[{icon:"text",title:(0,l.__)("List view","buddypress"),onClick:()=>s({layoutPreference:"list"}),isActive:"list"===E},{icon:"screenoptions",title:(0,l.__)("Grid view","buddypress"),onClick:()=>s({layoutPreference:"grid"}),isActive:"grid"===E}];let S,I="bp-block-groups avatar-"+f,G=m;return"grid"===E&&(I+=" is-grid columns-"+k,G=m.filter((e=>"description"!==e.value))),N&&v.length!==x.length&&n()({path:(0,i.addQueryArgs)("/buddypress/v1/groups",{populate_extras:!0,include:v})}).then((e=>{C((0,b.sortBy)(e,[e=>v.indexOf(e.id)]))})),x.length&&(S=x.map((e=>{let t=!1,n="group-content";return"list"===E&&"description"===w&&e.description&&e.description.rendered&&(t=!0,n="group-content has-description"),(0,r.createElement)("div",{key:"bp-group-"+e.id,className:n},c&&(0,r.createElement)(o.Tooltip,{text:(0,l.__)("Remove group","buddypress")},(0,r.createElement)(o.Button,{className:"is-right",onClick:()=>{var t;(t=e.id)&&-1!==v.indexOf(t)&&(C((0,b.reject)(x,["id",t])),s({itemIDs:(0,b.remove)(v,(e=>e!==t))}))},label:(0,l.__)("Remove group","buddypress")},(0,r.createElement)(o.Dashicon,{icon:"no"}))),g&&"none"!==f&&(0,r.createElement)("div",{className:"item-header-avatar"},(0,r.createElement)("a",{href:e.link,target:"_blank"},(0,r.createElement)("img",{key:"avatar-"+e.id,className:"avatar",alt:(0,l.sprintf)((0,l.__)("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[f]}))),(0,r.createElement)("div",{className:"group-description"},h&&(0,r.createElement)("strong",null,(0,r.createElement)("a",{href:e.link,target:"_blank"},e.name)),t&&(0,r.createElement)("div",{className:"group-description-content",dangerouslySetInnerHTML:{__html:e.description.rendered}}),"active"===w&&e.last_activity&&e.last_activity_diff&&(0,r.createElement)("time",{dateTime:e.last_activity},(0,l.sprintf)((0,l.__)("Active %s","buddypress"),e.last_activity_diff)),"popular"===w&&e.total_member_count&&(0,r.createElement)("div",{className:"group-meta"},(0,l.sprintf)(/* translators: 1: number of group memberss. */ 1 !function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,r=window.wp.element,s=window.wp.apiFetch,n=e.n(s),a=window.wp.blockEditor,o=window.wp.components,l=window.wp.i18n,i=window.wp.url,d=window.bp.blockComponents,u=window.bp.blockData;const p=[{label:(0,l.__)("None","buddypress"),value:"none"},{label:(0,l.__)("Thumb","buddypress"),value:"thumb"},{label:(0,l.__)("Full","buddypress"),value:"full"}],c={public:(0,l.__)("Public","buddypress"),private:(0,l.__)("Private","buddypress"),hidden:(0,l.__)("Hidden","buddypress")},m=[{label:(0,l.__)("None","buddypress"),value:"none"},{label:(0,l.__)("Group's description","buddypress"),value:"description"},{label:(0,l.__)("Last time the group was active","buddypress"),value:"active"},{label:(0,l.__)("Amount of group members","buddypress"),value:"popular"}];var b=window.lodash;const _=e=>e&&e.status&&c[e.status]?c[e.status]:null;var y=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"bp/groups","title":"Groups","category":"widgets","icon":"buddicons-groups","description":"BuddyPress Groups.","keywords":["BuddyPress","groups","community"],"textdomain":"buddypress","attributes":{"itemIDs":{"type":"array","items":{"type":"integer"},"default":[]},"avatarSize":{"type":"string","default":"full"},"displayGroupName":{"type":"boolean","default":true},"extraInfo":{"type":"string","default":"none"},"layoutPreference":{"type":"string","default":"list"},"columns":{"type":"number","default":2}},"supports":{"align":true},"editorScript":"file:index.js","style":"file:index.css"}');(0,t.registerBlockType)(y,{icon:{background:"#fff",foreground:"#d84800",src:"buddicons-groups"},edit:e=>{let{attributes:t,setAttributes:s,isSelected:c}=e;const y=(0,a.useBlockProps)(),g=(0,u.isActive)("groups","avatar"),{itemIDs:v,avatarSize:f,displayGroupName:h,extraInfo:w,layoutPreference:E,columns:k}=t,N=0!==v.length,[x,C]=(0,r.useState)([]),P=[{icon:"text",title:(0,l.__)("List view","buddypress"),onClick:()=>s({layoutPreference:"list"}),isActive:"list"===E},{icon:"screenoptions",title:(0,l.__)("Grid view","buddypress"),onClick:()=>s({layoutPreference:"grid"}),isActive:"grid"===E}];let S,I="bp-block-groups avatar-"+f,G=m;return"grid"===E&&(I+=" is-grid columns-"+k,G=m.filter((e=>"description"!==e.value))),N&&v.length!==x.length&&n()({path:(0,i.addQueryArgs)("/buddypress/v1/groups",{populate_extras:!0,include:v})}).then((e=>{C((0,b.sortBy)(e,[e=>v.indexOf(e.id)]))})),x.length&&(S=x.map((e=>{let t=!1,n="group-content";return"list"===E&&"description"===w&&e.description&&e.description.rendered&&(t=!0,n="group-content has-description"),(0,r.createElement)("div",{key:"bp-group-"+e.id,className:n},c&&(0,r.createElement)(o.Tooltip,{text:(0,l.__)("Remove group","buddypress")},(0,r.createElement)(o.Button,{className:"is-right",onClick:()=>{var t;(t=e.id)&&-1!==v.indexOf(t)&&(C((0,b.reject)(x,["id",t])),s({itemIDs:(0,b.remove)(v,(e=>e!==t))}))},label:(0,l.__)("Remove group","buddypress")},(0,r.createElement)(o.Dashicon,{icon:"no"}))),g&&"none"!==f&&(0,r.createElement)("div",{className:"item-header-avatar"},(0,r.createElement)("a",{href:e.link,target:"_blank"},(0,r.createElement)("img",{key:"avatar-"+e.id,className:"avatar",alt:(0,l.sprintf)((0,l.__)("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[f]}))),(0,r.createElement)("div",{className:"group-description"},h&&(0,r.createElement)("strong",null,(0,r.createElement)("a",{href:e.link,target:"_blank"},e.name)),t&&(0,r.createElement)("div",{className:"group-description-content",dangerouslySetInnerHTML:{__html:e.description.rendered}}),"active"===w&&e.last_activity&&e.last_activity_diff&&(0,r.createElement)("time",{dateTime:e.last_activity},(0,l.sprintf)(/* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 2 (0,l.__)("Active %s","buddypress"),e.last_activity_diff)),"popular"===w&&e.total_member_count&&(0,r.createElement)("div",{className:"group-meta"},(0,l.sprintf)(/* translators: 1: number of group memberss. */ 2 3 (0,l._n)("%1$d member","%1$d members",e.total_member_count,"buddypress"),e.total_member_count))))}))),(0,r.createElement)("div",y,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(o.PanelBody,{title:(0,l.__)("Settings","buddypress"),initialOpen:!0},(0,r.createElement)(o.ToggleControl,{label:(0,l.__)("Display the group's name","buddypress"),checked:!!h,onChange:()=>{s({displayGroupName:!h})},help:h?(0,l.__)("Include the group's name.","buddypress"):(0,l.__)("Toggle to include group's name.","buddypress")}),g&&(0,r.createElement)(o.SelectControl,{label:(0,l.__)("Avatar size","buddypress"),value:f,options:p,help:(0,l.__)('Select "None" to disable the avatar.',"buddypress"),onChange:e=>{s({avatarSize:e})}}),(0,r.createElement)(o.SelectControl,{label:(0,l.__)("Group extra information","buddypress"),value:w,options:G,help:(0,l.__)('Select "None" to show no extra information.',"buddypress"),onChange:e=>{s({extraInfo:e})}}),"grid"===E&&(0,r.createElement)(o.RangeControl,{label:(0,l.__)("Columns","buddypress"),value:k,onChange:e=>s({columns:e}),min:2,max:4,required:!0}))),(0,r.createElement)(a.BlockControls,null,(0,r.createElement)(o.ToolbarGroup,{controls:P})),N&&(0,r.createElement)("div",{className:I},S),(c||0===v.length)&&(0,r.createElement)(o.Placeholder,{icon:N?"":"groups",label:N?"":(0,l.__)("BuddyPress Groups","buddypress"),instructions:(0,l.__)("Start typing the name of the group you want to add to the groups list.","buddypress"),className:0!==v.length?"is-appender":"is-large"},(0,r.createElement)(d.AutoCompleter,{component:"groups",objectQueryArgs:{show_hidden:!1,exclude:v},slugValue:_,ariaLabel:(0,l.__)("Group's name","buddypress"),placeholder:(0,l.__)("Enter Group's name here…","buddypress"),onSelectItem:e=>{let{itemID:t}=e;t&&-1===v.indexOf(t)&&s({itemIDs:[...v,parseInt(t,10)]})},useAvatar:g})))}})}(); -
trunk/src/bp-members/blocks/dynamic-widget/index.asset.php
r13463 r13580 1 <?php return array('dependencies' => array('bp-dynamic-widget-block', 'wp-i18n'), 'version' => ' 791305675bf3288a1957');1 <?php return array('dependencies' => array('bp-dynamic-widget-block', 'wp-i18n'), 'version' => 'f6c0cbeae786ae91ce6b'); -
trunk/src/bp-members/blocks/dynamic-widget/index.js
r13463 r13580 1 1 !function(){"use strict";var e=window.wp.i18n,t=window.bp.dynamicWidgetBlock;class s extends t.dynamicWidgetBlock{loop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"active";const i=super.useTemplate("bp-dynamic-members-item"),n=document.querySelector("#"+s);let d="";t&&t.length?t.forEach((t=>{if("active"===r&&t.last_activity) 2 /* translators: %s: a human time diff.*/2 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 3 3 t.extra=(0,e.sprintf)((0,e.__)("Active %s","buddypress"),t.last_activity.timediff);else if("popular"===r&&t.total_friend_count){const s=parseInt(t.total_friend_count,10);t.extra=0===s?(0,e.__)("No friends","buddypress"):1===s?(0,e.__)("1 friend","buddypress"):(0,e.sprintf)((0,e.__)("%s friends","buddypress"),t.total_friend_count)}else"newest"===r&&t.registered_since&&( 4 4 /* translators: %s is time elapsed since the registration date happened */ -
trunk/src/bp-members/blocks/members/index.asset.php
r13463 r13580 1 <?php return array('dependencies' => array('bp-block-components', 'bp-block-data', 'lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => ' 8aaf13b8cd504dd8bb8c');1 <?php return array('dependencies' => array('bp-block-components', 'bp-block-data', 'lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '23b50823220af70bb259'); -
trunk/src/bp-members/blocks/members/index.js
r13463 r13580 1 !function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.apiFetch,r=e.n(n),s=window.wp.blockEditor,l=window.wp.components,i=window.wp.i18n,o=window.wp.url,d=window.bp.blockComponents,u=window.bp.blockData;const m=[{label:(0,i.__)("None","buddypress"),value:"none"},{label:(0,i.__)("Thumb","buddypress"),value:"thumb"},{label:(0,i.__)("Full","buddypress"),value:"full"}],c=[{label:(0,i.__)("None","buddypress"),value:"none"},{label:(0,i.__)("Last time the user was active","buddypress"),value:"last_activity"},{label:(0,i.__)("Latest activity the user posted","buddypress"),value:"latest_update"}];var p=window.lodash;const b=e=>e&&e.mention_name?e.mention_name:null;var y=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"bp/members","title":"Members","category":"widgets","icon":"groups","description":"BuddyPress Members.","keywords":["BuddyPress","members","community"],"textdomain":"buddypress","attributes":{"itemIDs":{"type":"array","items":{"type":"integer"},"default":[]},"avatarSize":{"type":"string","default":"full"},"displayMentionSlug":{"type":"boolean","default":true},"displayUserName":{"type":"boolean","default":true},"extraData":{"type":"string","default":"none"},"layoutPreference":{"type":"string","default":"list"},"columns":{"type":"number","default":2}},"supports":{"align":true},"editorScript":"file:index.js","style":"file:index.css"}');(0,t.registerBlockType)(y,{icon:{background:"#fff",foreground:"#d84800",src:"groups"},edit:e=>{let{attributes:t,setAttributes:n,isSelected:y}=e;const _=(0,s.useBlockProps)(),g=(0,u.isActive)("members","avatar"),v=(0,u.isActive)("activity","mentions"),{itemIDs:h,avatarSize:f,displayMentionSlug:w,displayUserName:E,extraData:k,layoutPreference:C,columns:S}=t,N=0!==h.length,[x,P]=(0,a.useState)([]),D=[{icon:"text",title:(0,i.__)("List view","buddypress"),onClick:()=>n({layoutPreference:"list"}),isActive:"list"===C},{icon:"screenoptions",title:(0,i.__)("Grid view","buddypress"),onClick:()=>n({layoutPreference:"grid"}),isActive:"grid"===C}];let A,I="bp-block-members avatar-"+f,M=c;return"grid"===C&&(I+=" is-grid columns-"+S,M=c.filter((e=>"latest_update"!==e.value))),N&&h.length!==x.length&&r()({path:(0,o.addQueryArgs)("/buddypress/v1/members",{populate_extras:!0,include:h})}).then((e=>{P((0,p.sortBy)(e,[e=>h.indexOf(e.id)]))})),x.length&&(A=x.map((e=>{let t=!1,r="member-content";return"list"===C&&"latest_update"===k&&e.latest_update&&e.latest_update.rendered&&(t=!0,r="member-content has-activity"),(0,a.createElement)("div",{key:"bp-member-"+e.id,className:r},y&&(0,a.createElement)(l.Tooltip,{text:(0,i.__)("Remove member","buddypress")},(0,a.createElement)(l.Button,{className:"is-right",onClick:()=>{var t;(t=e.id)&&-1!==h.indexOf(t)&&(P((0,p.reject)(x,["id",t])),n({itemIDs:(0,p.remove)(h,(e=>e!==t))}))},label:(0,i.__)("Remove member","buddypress")},(0,a.createElement)(l.Dashicon,{icon:"no"}))),g&&"none"!==f&&(0,a.createElement)("div",{className:"item-header-avatar"},(0,a.createElement)("a",{href:e.link,target:"_blank"},(0,a.createElement)("img",{key:"avatar-"+e.id,className:"avatar",alt:(0,i.sprintf)((0,i.__)("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[f]}))),(0,a.createElement)("div",{className:"member-description"},t&&(0,a.createElement)("blockquote",{className:"wp-block-quote"},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:e.latest_update.rendered}}),(0,a.createElement)("cite",null,E&&(0,a.createElement)("span",null,e.name)," ",v&&w&&(0,a.createElement)("a",{href:e.link,target:"_blank"},"(@",e.mention_name,")"))),!t&&E&&(0,a.createElement)("strong",null,(0,a.createElement)("a",{href:e.link,target:"_blank"},e.name)),!t&&v&&w&&(0,a.createElement)("span",{className:"user-nicename"},"@",e.mention_name),"last_activity"===k&&e.last_activity&&e.last_activity.date&&(0,a.createElement)("time",{dateTime:e.last_activity.date},(0,i.sprintf)((0,i.__)("Active %s","buddypress"),e.last_activity.timediff))))}))),(0,a.createElement)("div",_,(0,a.createElement)(s.InspectorControls,null,(0,a.createElement)(l.PanelBody,{title:(0,i.__)("Settings","buddypress"),initialOpen:!0},(0,a.createElement)(l.ToggleControl,{label:(0,i.__)("Display the user name","buddypress"),checked:!!E,onChange:()=>{n({displayUserName:!E})},help:E?(0,i.__)("Include the user's display name.","buddypress"):(0,i.__)("Toggle to include user's display name.","buddypress")}),v&&(0,a.createElement)(l.ToggleControl,{label:(0,i.__)("Display Mention slug","buddypress"),checked:!!w,onChange:()=>{n({displayMentionSlug:!w})},help:w?(0,i.__)("Include the user's mention name under their display name.","buddypress"):(0,i.__)("Toggle to display the user's mention name under their display name.","buddypress")}),g&&(0,a.createElement)(l.SelectControl,{label:(0,i.__)("Avatar size","buddypress"),value:f,options:m,help:(0,i.__)('Select "None" to disable the avatar.',"buddypress"),onChange:e=>{n({avatarSize:e})}}),(0,a.createElement)(l.SelectControl,{label:(0,i.__)("BuddyPress extra information","buddypress"),value:k,options:M,help:(0,i.__)('Select "None" to show no extra information.',"buddypress"),onChange:e=>{n({extraData:e})}}),"grid"===C&&(0,a.createElement)(l.RangeControl,{label:(0,i.__)("Columns","buddypress"),value:S,onChange:e=>n({columns:e}),min:2,max:4,required:!0}))),(0,a.createElement)(s.BlockControls,null,(0,a.createElement)(l.ToolbarGroup,{controls:D})),N&&(0,a.createElement)("div",{className:I},A),(y||0===h.length)&&(0,a.createElement)(l.Placeholder,{icon:N?"":"groups",label:N?"":(0,i.__)("BuddyPress Members","buddypress"),instructions:(0,i.__)("Start typing the name of the member you want to add to the members list.","buddypress"),className:0!==h.length?"is-appender":"is-large"},(0,a.createElement)(d.AutoCompleter,{component:"members",objectQueryArgs:{exclude:h},slugValue:b,ariaLabel:(0,i.__)("Member's username","buddypress"),placeholder:(0,i.__)("Enter Member's username here…","buddypress"),onSelectItem:e=>{let{itemID:t}=e;t&&-1===h.indexOf(t)&&n({itemIDs:[...h,parseInt(t,10)]})},useAvatar:g})))}})}(); 1 !function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.apiFetch,r=e.n(n),s=window.wp.blockEditor,l=window.wp.components,i=window.wp.i18n,o=window.wp.url,d=window.bp.blockComponents,u=window.bp.blockData;const m=[{label:(0,i.__)("None","buddypress"),value:"none"},{label:(0,i.__)("Thumb","buddypress"),value:"thumb"},{label:(0,i.__)("Full","buddypress"),value:"full"}],c=[{label:(0,i.__)("None","buddypress"),value:"none"},{label:(0,i.__)("Last time the user was active","buddypress"),value:"last_activity"},{label:(0,i.__)("Latest activity the user posted","buddypress"),value:"latest_update"}];var p=window.lodash;const b=e=>e&&e.mention_name?e.mention_name:null;var y=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"bp/members","title":"Members","category":"widgets","icon":"groups","description":"BuddyPress Members.","keywords":["BuddyPress","members","community"],"textdomain":"buddypress","attributes":{"itemIDs":{"type":"array","items":{"type":"integer"},"default":[]},"avatarSize":{"type":"string","default":"full"},"displayMentionSlug":{"type":"boolean","default":true},"displayUserName":{"type":"boolean","default":true},"extraData":{"type":"string","default":"none"},"layoutPreference":{"type":"string","default":"list"},"columns":{"type":"number","default":2}},"supports":{"align":true},"editorScript":"file:index.js","style":"file:index.css"}');(0,t.registerBlockType)(y,{icon:{background:"#fff",foreground:"#d84800",src:"groups"},edit:e=>{let{attributes:t,setAttributes:n,isSelected:y}=e;const _=(0,s.useBlockProps)(),g=(0,u.isActive)("members","avatar"),v=(0,u.isActive)("activity","mentions"),{itemIDs:h,avatarSize:f,displayMentionSlug:w,displayUserName:E,extraData:k,layoutPreference:C,columns:S}=t,N=0!==h.length,[x,P]=(0,a.useState)([]),D=[{icon:"text",title:(0,i.__)("List view","buddypress"),onClick:()=>n({layoutPreference:"list"}),isActive:"list"===C},{icon:"screenoptions",title:(0,i.__)("Grid view","buddypress"),onClick:()=>n({layoutPreference:"grid"}),isActive:"grid"===C}];let A,I="bp-block-members avatar-"+f,M=c;return"grid"===C&&(I+=" is-grid columns-"+S,M=c.filter((e=>"latest_update"!==e.value))),N&&h.length!==x.length&&r()({path:(0,o.addQueryArgs)("/buddypress/v1/members",{populate_extras:!0,include:h})}).then((e=>{P((0,p.sortBy)(e,[e=>h.indexOf(e.id)]))})),x.length&&(A=x.map((e=>{let t=!1,r="member-content";return"list"===C&&"latest_update"===k&&e.latest_update&&e.latest_update.rendered&&(t=!0,r="member-content has-activity"),(0,a.createElement)("div",{key:"bp-member-"+e.id,className:r},y&&(0,a.createElement)(l.Tooltip,{text:(0,i.__)("Remove member","buddypress")},(0,a.createElement)(l.Button,{className:"is-right",onClick:()=>{var t;(t=e.id)&&-1!==h.indexOf(t)&&(P((0,p.reject)(x,["id",t])),n({itemIDs:(0,p.remove)(h,(e=>e!==t))}))},label:(0,i.__)("Remove member","buddypress")},(0,a.createElement)(l.Dashicon,{icon:"no"}))),g&&"none"!==f&&(0,a.createElement)("div",{className:"item-header-avatar"},(0,a.createElement)("a",{href:e.link,target:"_blank"},(0,a.createElement)("img",{key:"avatar-"+e.id,className:"avatar",alt:(0,i.sprintf)((0,i.__)("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[f]}))),(0,a.createElement)("div",{className:"member-description"},t&&(0,a.createElement)("blockquote",{className:"wp-block-quote"},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:e.latest_update.rendered}}),(0,a.createElement)("cite",null,E&&(0,a.createElement)("span",null,e.name)," ",v&&w&&(0,a.createElement)("a",{href:e.link,target:"_blank"},"(@",e.mention_name,")"))),!t&&E&&(0,a.createElement)("strong",null,(0,a.createElement)("a",{href:e.link,target:"_blank"},e.name)),!t&&v&&w&&(0,a.createElement)("span",{className:"user-nicename"},"@",e.mention_name),"last_activity"===k&&e.last_activity&&e.last_activity.date&&(0,a.createElement)("time",{dateTime:e.last_activity.date},(0,i.sprintf)(/* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 2 (0,i.__)("Active %s","buddypress"),e.last_activity.timediff))))}))),(0,a.createElement)("div",_,(0,a.createElement)(s.InspectorControls,null,(0,a.createElement)(l.PanelBody,{title:(0,i.__)("Settings","buddypress"),initialOpen:!0},(0,a.createElement)(l.ToggleControl,{label:(0,i.__)("Display the user name","buddypress"),checked:!!E,onChange:()=>{n({displayUserName:!E})},help:E?(0,i.__)("Include the user's display name.","buddypress"):(0,i.__)("Toggle to include user's display name.","buddypress")}),v&&(0,a.createElement)(l.ToggleControl,{label:(0,i.__)("Display Mention slug","buddypress"),checked:!!w,onChange:()=>{n({displayMentionSlug:!w})},help:w?(0,i.__)("Include the user's mention name under their display name.","buddypress"):(0,i.__)("Toggle to display the user's mention name under their display name.","buddypress")}),g&&(0,a.createElement)(l.SelectControl,{label:(0,i.__)("Avatar size","buddypress"),value:f,options:m,help:(0,i.__)('Select "None" to disable the avatar.',"buddypress"),onChange:e=>{n({avatarSize:e})}}),(0,a.createElement)(l.SelectControl,{label:(0,i.__)("BuddyPress extra information","buddypress"),value:k,options:M,help:(0,i.__)('Select "None" to show no extra information.',"buddypress"),onChange:e=>{n({extraData:e})}}),"grid"===C&&(0,a.createElement)(l.RangeControl,{label:(0,i.__)("Columns","buddypress"),value:S,onChange:e=>n({columns:e}),min:2,max:4,required:!0}))),(0,a.createElement)(s.BlockControls,null,(0,a.createElement)(l.ToolbarGroup,{controls:D})),N&&(0,a.createElement)("div",{className:I},A),(y||0===h.length)&&(0,a.createElement)(l.Placeholder,{icon:N?"":"groups",label:N?"":(0,i.__)("BuddyPress Members","buddypress"),instructions:(0,i.__)("Start typing the name of the member you want to add to the members list.","buddypress"),className:0!==h.length?"is-appender":"is-large"},(0,a.createElement)(d.AutoCompleter,{component:"members",objectQueryArgs:{exclude:h},slugValue:b,ariaLabel:(0,i.__)("Member's username","buddypress"),placeholder:(0,i.__)("Enter Member's username here…","buddypress"),onSelectItem:e=>{let{itemID:t}=e;t&&-1===h.indexOf(t)&&n({itemIDs:[...h,parseInt(t,10)]})},useAvatar:g})))}})}(); -
trunk/src/js/blocks/bp-friends/dynamic-widget/friends.js
r13463 r13580 24 24 friends.forEach( ( friend ) => { 25 25 if ( 'active' === type && friend.last_activity ) { 26 /* translators: %s: a human time diff.*/26 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 27 27 friend.extra = sprintf( __( 'Active %s', 'buddypress' ), friend.last_activity.timediff ); 28 28 } else if ( 'popular' === type && friend.total_friend_count ) { … … 34 34 friend.extra = __( '1 friend', 'buddypress' ); 35 35 } else { 36 /* translators: %s: total friend count (more than 1). */ 37 friend.extra = sprintf( __( '%s friends', 'buddypress' ), friend.total_friend_count ); 36 friend.extra = sprintf( 37 /* translators: %s: total friend count (more than 1). */ 38 __( '%s friends', 'buddypress' ), 39 friend.total_friend_count 40 ); 38 41 } 39 42 } else if ( 'newest' === type && friend.registered_since ) { -
trunk/src/js/blocks/bp-groups/dynamic-widget/dynamic-groups.js
r13463 r13580 36 36 group.extra = __( '1 member', 'buddypress' ); 37 37 } else { 38 /* translators: %s is the number of Group members (more than 1). */ 39 group.extra = sprintf( __( '%s members', 'buddypress' ), group.total_member_count ); 38 group.extra = sprintf( 39 /* translators: %s is the number of Group members (more than 1). */ 40 __( '%s members', 'buddypress' ), 41 group.total_member_count 42 ); 40 43 } 41 44 } else { 42 /* translators: %s: a human time diff.*/45 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 43 46 group.extra = sprintf( __( 'Active %s', 'buddypress' ), group.last_activity_diff ); 44 47 } -
trunk/src/js/blocks/bp-groups/groups/edit.js
r13463 r13580 172 172 { 'active' === extraInfo && group.last_activity && group.last_activity_diff && ( 173 173 <time dateTime={ group.last_activity }> 174 { sprintf( __( 'Active %s', 'buddypress' ), group.last_activity_diff ) } 174 { sprintf( 175 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 176 __( 'Active %s', 'buddypress' ), 177 group.last_activity_diff 178 ) } 175 179 </time> 176 180 ) } -
trunk/src/js/blocks/bp-members/dynamic-widget/dynamic-members.js
r13463 r13580 26 26 members.forEach( ( member ) => { 27 27 if ( 'active' === type && member.last_activity ) { 28 /* translators: %s: a human time diff.*/28 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 29 29 member.extra = sprintf( __( 'Active %s', 'buddypress' ), member.last_activity.timediff ); 30 30 } else if ( 'popular' === type && member.total_friend_count ) { -
trunk/src/js/blocks/bp-members/members/edit.js
r13463 r13580 191 191 { 'last_activity' === extraData && member.last_activity && member.last_activity.date && ( 192 192 <time dateTime={ member.last_activity.date }> 193 { sprintf( __( 'Active %s', 'buddypress' ), member.last_activity.timediff ) } 193 { sprintf( 194 /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ 195 __( 'Active %s', 'buddypress' ), 196 member.last_activity.timediff 197 ) } 194 198 </time> 195 199 ) }
Note: See TracChangeset
for help on using the changeset viewer.