[xwiki-devs] [XWiki Day] BFD#184

2018-07-18 Thread Alex Cotiugă
Hello devs,

This Thursday is BFD#184:
http://dev.xwiki.org/xwiki/bin/view/Community/XWikiDays#HBugfixingday


Our current status is:
* -49 bugs over 120 days (4 months), i.e. we need to close 49 bugs to have
created bugs # = closed bugs #
* -105 bugs over 365 days (1 year)
* -155 bugs over 500 days (between 1 and 2 years)
* -345 bugs over 1600 days (4.3 years)

See https://jira.xwiki.org/secure/Dashboard.jspa?selectPageId=10352

Here's the BFD#184 dashboard to follow the progress during the day:
https://jira.xwiki.org/secure/Dashboard.jspa?selectPageId=14310

Happy Bug Fixing Day,
Alex


Re: [xwiki-devs] [Need proposal] How to show "conflicting" macro parameters

2018-07-18 Thread Vincent Massol



> On 5 Jul 2018, at 12:06, Vincent Massol  wrote:
> 
> 
> 
>> On 4 Jul 2018, at 12:07, Thomas Mortagne  wrote:
>> 
>> Here are more details on the actual use case we need to support:
>> 
>> In include/Display macro either you set:
>> 
>> * "reference" and "type" (which default to DOCUMENT)
>> * or you set “page"
> 
> Globally I think we need to add 3 concepts to macro parameter descriptor:
> 
> 1) The concept of “deprecated” parameter. For example for “document” in the 
> include macro.
> 2) The concept of aliases or groups, i.e the ability to list parameters that 
> are mutually exclusive. Example: reference + type vs page for display/include 
> macros. This would mean that in the Macro Dialog UI if you select one of 
> those the other gets unselected/cleared out (you cannot have mutually 
> exclusive params have values).
> 3) The concept of Advanced parameters. For example, we should put reference + 
> type as advanced parameters so that they are not shown to the user by default 
> (and so that the page parameter is more highlighted). Users would need to 
> click on Advanced to see advanced parameters. I think we’re doing something 
> automatic today (I don’t remember the details) to try to hide some parameters 
> but we should probably review this.
> 
> WDYT?

Ping!

Do we agree about this? If we do we can then create jira issue about it and 
take it for implementation.

Thanks
-Vincent

> 
> Thanks
> -Vincent
> 
> 
> 
>> 
>> 
>> On Wed, Jul 4, 2018 at 10:57 AM, Marius Dumitru Florea
>>  wrote:
>>> For groups of parameters we could use tabs:
>>> 
>>> --8<--
>>> Param 1
>>> [input]
>>> 
>>> Param 2 | Param 3 | Param 4 <--- a group of 3 parameters displayed using
>>> tabs (we take into account only the value of the parameter from the active
>>> tab)
>>> [input for param 2]
>>> 
>>> Param 5
>>> [input]
>>> -->8--
>>> 
>>> But if you want to support subgroups of parameters also then it becomes
>>> more complicated.
>>> 
>>> Thanks,
>>> Marius
>>> 
>>> On Mon, Jul 2, 2018 at 11:52 AM, Thomas Mortagne 
>>> wrote:
>>> 
 Hi xwikiers,
 
 In the contact of bringing new Page concept (OK 7.4 is starting to get
 old) to the API and macros too we decided (1) to introduce a "page"
 shortcut property (even if we keep the reference/type for other
 types).
 
 While it's nicer for wiki syntax, one issue is that on WYSIWYG macros
 UI side, which display all properties, it means ending up with
 conflicting parameters that needs to be displayed as such.
 
 I don't really have much clue on how best to display this so I'm
 searching for ideas :)
 
 Then I will add in the macro descriptor what's required for whatever
 UI we want to build (group and sub groups of properties, etc.).
 
 1: http://design.xwiki.org/xwiki/bin/view/Proposal/
 DeprecatingSpaceAndSpaceReference#HMacros
 
 Thanks,
 --
 Thomas Mortagnes
 
>> 
>> 
>> 
>> -- 
>> Thomas Mortagne
> 



Re: [xwiki-devs] [Brainstorm] Notifications Filters Preferences Store.

2018-07-18 Thread Guillaume Delhumeau
Corresponding JIRA issue: https://jira.xwiki.org/browse/XWIKI-15445

2018-07-18 11:07 GMT+02:00 Guillaume Delhumeau <
guillaume.delhum...@xwiki.com>:

> Hi.
>
> [TL;DR]
>
> This thread is about the way we store notification filter preferences for
> each user. The constraint is there can be a lot of them (700 is a number a
> user has recently reported). So how should we store them?
>
> [Full text]
>
> = Definition =
>
> So what is a filter preference? It's a generic object that can store many
> elements, such as a page locations, application names, event types, etc...
> They describe a configuration about a given filter for a given user. For
> example, a filter preference can say "for the ScopeNotificationFilter and
> the user A, include the location Main.WebHome" as it could be "for the
> UserNotificationFilter and the user A, exclude the user SPAM". It's generic.
>
> The main usage is for page locations (ScopeNotificationFilter). By
> default, we have the "autowatch" mode enabled. It means every time a user
> modifies a page, a filter preference for this page and this user is
> created. So if a user modifies 700 pages, he gets 700 filter preferences.
>
> = How are they stored =
>
> Currently, we have a simple implementation. There is a generic XClass
> called "XWiki.Notifications.Code.NotificationFilterPreferenceClass". For
> each preference, we add an XObject on the user page. It's that simple. But
> it also means that if a users have 700 filter preferences, she also gets
> 700 XObjects on her page, and 700 revisions of that page. Which is a pain:
> it takes a lot of place in the document's cache, and it's heavy to load
> (lot of SQL queries needed). So we have a big problem here.
>
> = Possible solutions =
>
> == A: Minimize the number of xobjects needed for ScopeNotificationFilter ==
>
> Currently, one location is represented by 1 filter preference. But most
> filter preferences are very similar. They almost all say "for the
> ScopeNotificationFilter, for all event types, for all applications, the
> filter preference is enabled". The only different part is the actual
> location. But the "location" field is itself a LIST stored with the
> "relational storage" option. So we can take advantage of it and store
> similar preferences into 1 single object.
>
> 1 object with 700 locations instead of 700 objects with 1 location.
>
> However, it's a bit harder than this. Event if the
> NotificationFilterPreferences is generic and can contains many locations,
> the ScopeNotificationFilter expect it to concern only one location (and
> then it perform complex operations to sort the filters preferences
> according to a hierarchy). The UI in the user profile makes the same
> assumption so it does not handle multiple locations in the same preferences
> object. Refactoring this is not simple and cannot be done for 10.6.
>
> === Variation 1: store only 1 xobject, but make the API return 700
> preferences objects anyway ===
>
> This is the variation I am prototyping. Actually it's ok if the filters
> and the UI expect only 1 location into the preferences object. All we have
> to do is to "smash" the xobject into many NotificationFilterPreferences
> objects that we need internally. It would simply be the responsibility of
> the Store to detect similarities and to save the minimal amount of XObjects
> to store a bunch of preferences.
>
> But it means being very smart when loading, creating, updating and
> deleting a preference. Not having one xobject per filter preference
> introduces complexity, and complexity can lead to bugs. Again, according to
> the time frame, it's hard to implement.
>
> === Variation 2: use custom mapping ===
>
> Probably the easiest solution that would help making less SQL queries. The
> idea is to have a SQL table for notification filter preferences and bind
> the XObjects to that table. It would still use a lot of place in the
> document's cache but be more efficient on the database level.
>
> === Other Problem 1: it still creates page revisions ===
>
> As long as we store the filter preferences with xobjects, we create page
> revisions. We can get rid of those by using some internal API to not create
> a revision when we save an xobject but I wonder if it's what users want. If
> a user tries to rollback some changes and don't see all filter preferences
> it concerns, I think it's not very transparent.
>
> === Other Problem 2: Document's cache ===
>
> Sometime we load the a user document to get the avatar of the user, her
> name, etc... So we load user documents very frequently, even if the user is
> not connected! Having 700 filters in the document and cache them with the
> document even if we don't need them is a big waste of memory.
>
> == B: Implement a completely new store with Hibernate ==
>
> A bit like having a custom mapping. We could create a SQL table and
> implement an API to handle it. Then, no xobjects would be involved.
>
> Some drawbacks:
> * we need to write a custom cache as 

[xwiki-devs] [Brainstorm] Notifications Filters Preferences Store.

2018-07-18 Thread Guillaume Delhumeau
Hi.

[TL;DR]

This thread is about the way we store notification filter preferences for
each user. The constraint is there can be a lot of them (700 is a number a
user has recently reported). So how should we store them?

[Full text]

= Definition =

So what is a filter preference? It's a generic object that can store many
elements, such as a page locations, application names, event types, etc...
They describe a configuration about a given filter for a given user. For
example, a filter preference can say "for the ScopeNotificationFilter and
the user A, include the location Main.WebHome" as it could be "for the
UserNotificationFilter and the user A, exclude the user SPAM". It's generic.

The main usage is for page locations (ScopeNotificationFilter). By default,
we have the "autowatch" mode enabled. It means every time a user modifies a
page, a filter preference for this page and this user is created. So if a
user modifies 700 pages, he gets 700 filter preferences.

= How are they stored =

Currently, we have a simple implementation. There is a generic XClass
called "XWiki.Notifications.Code.NotificationFilterPreferenceClass". For
each preference, we add an XObject on the user page. It's that simple. But
it also means that if a users have 700 filter preferences, she also gets
700 XObjects on her page, and 700 revisions of that page. Which is a pain:
it takes a lot of place in the document's cache, and it's heavy to load
(lot of SQL queries needed). So we have a big problem here.

= Possible solutions =

== A: Minimize the number of xobjects needed for ScopeNotificationFilter ==

Currently, one location is represented by 1 filter preference. But most
filter preferences are very similar. They almost all say "for the
ScopeNotificationFilter, for all event types, for all applications, the
filter preference is enabled". The only different part is the actual
location. But the "location" field is itself a LIST stored with the
"relational storage" option. So we can take advantage of it and store
similar preferences into 1 single object.

1 object with 700 locations instead of 700 objects with 1 location.

However, it's a bit harder than this. Event if the
NotificationFilterPreferences is generic and can contains many locations,
the ScopeNotificationFilter expect it to concern only one location (and
then it perform complex operations to sort the filters preferences
according to a hierarchy). The UI in the user profile makes the same
assumption so it does not handle multiple locations in the same preferences
object. Refactoring this is not simple and cannot be done for 10.6.

=== Variation 1: store only 1 xobject, but make the API return 700
preferences objects anyway ===

This is the variation I am prototyping. Actually it's ok if the filters and
the UI expect only 1 location into the preferences object. All we have to
do is to "smash" the xobject into many NotificationFilterPreferences
objects that we need internally. It would simply be the responsibility of
the Store to detect similarities and to save the minimal amount of XObjects
to store a bunch of preferences.

But it means being very smart when loading, creating, updating and deleting
a preference. Not having one xobject per filter preference introduces
complexity, and complexity can lead to bugs. Again, according to the time
frame, it's hard to implement.

=== Variation 2: use custom mapping ===

Probably the easiest solution that would help making less SQL queries. The
idea is to have a SQL table for notification filter preferences and bind
the XObjects to that table. It would still use a lot of place in the
document's cache but be more efficient on the database level.

=== Other Problem 1: it still creates page revisions ===

As long as we store the filter preferences with xobjects, we create page
revisions. We can get rid of those by using some internal API to not create
a revision when we save an xobject but I wonder if it's what users want. If
a user tries to rollback some changes and don't see all filter preferences
it concerns, I think it's not very transparent.

=== Other Problem 2: Document's cache ===

Sometime we load the a user document to get the avatar of the user, her
name, etc... So we load user documents very frequently, even if the user is
not connected! Having 700 filters in the document and cache them with the
document even if we don't need them is a big waste of memory.

== B: Implement a completely new store with Hibernate ==

A bit like having a custom mapping. We could create a SQL table and
implement an API to handle it. Then, no xobjects would be involved.

Some drawbacks:
* we need to write a custom cache as well.
* the user cannot modify her preferences using the wiki principles
(xobjects all the way).

== C: Refactor the UI and the ScopeNotificationFilter so they do not assume
1 filter preference = 1 location ==

This option is still possible. Probably the best because creating 1 filter
preferences object per location is an