IRC Archive for channel #xwiki on 22 July 2014

Last modified by Vincent Massol on 2014/07/22 23:43

<OSIMasson> has joined #xwiki
00:32 <OSIMasson> has quit
00:33 <vmassol> has quit
01:31 <sdumitriu> has joined #xwiki
01:47 <OSIMasson> has joined #xwiki
02:58 <OSIMasson> has quit
06:28 <andreeapopescu> has joined #xwiki
06:35 <mflorea> has joined #xwiki
07:36 <msmeria> has joined #xwiki
07:53 <tmortagne> has joined #xwiki
07:55 <tmortagne> has joined #xwiki
08:09 <vmassol> has joined #xwiki
08:28 <lucaa> has joined #xwiki
08:32 <woshilapin> has joined #xwiki
08:36 <cjd> has joined #xwiki
08:43 <vmassol> msmeria: some script running?
08:44 <msmeria> vmassol: no. manual work :)
08:44 <lucaa> has quit
08:44 <msmeria> I'm that fast B-)
08:45 <vmassol> ok it's all about the new type value
08:45 <vmassol> so it's a script
08:45 <vmassol> :)
08:45 <msmeria> no script...
08:45 <vmassol> what is "value1" though?
08:45 <vmassol> maybe you should use a better name
08:46 <msmeria> it's Admin as the user that has to execute the test
08:46 <vmassol> why not use 'admin' as value then?
08:46 <msmeria> the value is Admin, value1 is the variable name
08:47 <msmeria> look here for ex: http://test.xwiki.org/xwiki/bin/edit/Wiki+Tests/Accept+Join+Request at the Uer Type field
08:47 <msmeria> User*
08:47 <vmassol> I know that the displayed value is "Admin" (I guessed that)
08:47 <vmassol> still the question stands
08:47 <vmassol> I'd never use a variable named value1 in my code
08:47 <vmassol> it's so unreadable
08:47 <vmassol> :)
08:48 <msmeria> so you want me to change value1 to admin ?
08:48 <vmassol> value1=Admin|value2=User|value3=Both
08:49 <vmassol> depends how much work it is now
08:49 <vmassol> it was more a general comment
08:49 <vmassol> you do what you want :)
08:50 <vmassol> it should be ok IMO since it could a lot of work to change, just think about it for the next time you have to add a property :)
08:50 <msmeria> Values (separated by '|'; Example: value1=Text displayed for value 1|value2=Text displayed for value 2|value3|value4)
08:50 <msmeria> I don't think you can change those...
08:50 <vmassol> I know what they are ;)
08:50 <msmeria> or if you do, it's a lot of work
08:51 <msmeria> I'll leave it as it is for now and try to use better variable names in the future :)
09:01 <lucaa> has joined #xwiki
09:02 <msmeria> vmassol: I've commited new variable names here: https://github.com/xwiki-contrib/application-testreporting/commit/d14a18cc99f79169038a9da7303adb3805f9c807
09:06 <gdelhumeau> has joined #xwiki
09:26 <evalica> has joined #xwiki
09:27 <Enygma`> has joined #xwiki
09:32 <mflorea> has quit
09:56 <mflorea> has joined #xwiki
09:58 <ClemensR> has joined #xwiki
10:08 <ClemensR> has left #xwiki
10:38 <Lyes> has joined #xwiki
10:59 <Lyes> has quit
11:21 <Lyes> has joined #xwiki
11:44 <gdelhumeau> has quit
11:47 <Lyes> has quit
11:47 <Lyes1> has joined #xwiki
11:54 <Emenems> has quit
11:55 <Emenems> has joined #xwiki
11:57 <gdelhumeau> has joined #xwiki
11:59 <Slashman> has joined #xwiki
12:34 <vmassol> tmortagne: broken link for wikistream here fyi: http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki53
12:45 <woshilapin> Hi devs, is there any velocity macro that can be used to display a user like what is done in the template display_users.vm?
12:46 <vmassol> I don't think so
12:46 <woshilapin> (or, rephrase, how to use the code in display_users.vm to display a list of user with names, avatars and UID)
12:46 <vmassol> would be nice to improve http://extensions.xwiki.org/xwiki/bin/view/Extension/User+Avatar+Macro to do that
12:46 <woshilapin> Would you be interested if I move this to a macro (and then transform display_users.vm to use this macro)
12:47 <woshilapin> Oh, I was just talking about a Velocity macro at this stage
12:47 <vmassol> display_users.vm supports display several users right?
12:47 <woshilapin> Yes
12:47 <vmassol> ah no velcoity macro isnot very interesting
12:47 <woshilapin> Probably, I would split into 2 velocity macros
12:47 <vmassol> but a rendering macro is
12:47 <vmassol> :)
12:47 <vmassol> now
12:47 <woshilapin> It is for readibility
12:48 <vmassol> you're right that display_users.vm doesn't support rendering macros ATM
12:48 <vmassol> (well it can but it's not very nice)
12:48 <vmassol> where would you put htat macro? in macros.vm?
12:48 <woshilapin> OK, maybe during the seminar, I'll do that
12:49 <woshilapin> Don't know
12:49 <woshilapin> Where is the best place
12:49 <vmassol> yes, I'd also like to do a bit of hacking during the seminar ;)
12:49 <vmassol> I don't know the best place. ATM the only place is macros.vm
12:49 <vmassol> since that's the only file defined for velocimacros
12:50 <vmassol> it's fine for me if you create a new velocimacro
12:50 <woshilapin> Yes, but if define them into macros.vm, there is not place for a display_users.vm anymore since it will contains 3 lines
12:50 <woshilapin> Hum, not exactly, there will be a small place for it
12:50 <vmassol> I don't understand
12:50 <woshilapin> So OK, I'll try something like that
12:50 <vmassol> display_users.vm is needed
12:51 <woshilapin> Yes, yes
12:51 <vmassol> for custom display
12:51 <woshilapin> It will just be much smaller
12:51 <vmassol> it'll just contain a few lines, you still need to handle both view and edit
12:51 <woshilapin> Around 10 lines
12:51 <vmassol> well before all this
12:51 <vmassol> would be nice to discuss your need/use case
12:51 <vmassol> gtg for lunch now!
12:51 <vmassol> :)
12:51 <woshilapin> OK, we can talk about it later if you want
12:52 <woshilapin> For now, I just recopy display_users.vm in my project (crappy solution)
13:41 <vmassol> woshilapin:  a user profile macro (rendering macro) would be nice, something similar to https://confluence.atlassian.com/display/DOC/User+Profile+Macro
13:42 <vmassol> {{userprofile …/}}
13:42 <vmassol> (and {{useravatar/}} would continue to only display the avatar of the user)
13:42 <vmassol> but it's probably not what you need for your use case
13:43 <woshilapin> I'll see what I can do
13:43 <woshilapin> In my case, it's just the 'view' part of the display_users.vm that I need
14:35 <gdelhumeau> has quit
15:10 <gdelhumeau> has joined #xwiki
15:20 <mflorea> has quit
15:30 <msmeria> has quit
15:38 <mflorea> has joined #xwiki
15:56 <mflorea> vmassol: ping
15:57 <vmassol> mflorea: yes?
15:58 <mflorea> I have an issue with webjars. The response content type is not set properly (you always get text/html;charset=ISO-8859-1) and thus you cannot load CSS from webjars
15:59 <vmassol> indeed it's not set in WebJarsResourceReferenceHandler
15:59 <mflorea> it works for JS, because the browser is permissive, it puts Accept: */* on the request
15:59 <mflorea> but for CSS, I have Accept: text/css,*/*;q=0.1
15:59 <vmassol> either we try to find out automaitcally or we let the user specify it
16:00 <vmassol> or both
16:00 <mflorea> how can the user specify it?
16:00 <mflorea> as a URL param?
16:00 <vmassol> in the URL
16:00 <mflorea> ok
16:00 <vmassol> yes
16:01 <mflorea> that's probably the easies solution
16:01 <vmassol> yes
16:01 <mflorea> detecting the content type is harder
16:01 <vmassol> (and fastest in term of perf)
16:02 <mflorea> we could also do a hack and check the resource extension.
16:02 <mflorea> file name extension
16:03 <vmassol> in this case I'd suggest checking tikka since it does that too
16:03 <vmassol> s/checking/using
16:03 <vmassol> would just need to check if it also looks in the content by default or not
16:03 <vmassol> (I don't remember)
16:03 <vmassol> so if user specifies it, then use it, otherwise try to guess it
16:04 <mflorea> yep
16:05 <mflorea> XWikiAttachment uses new Tika().detect(getFilename());
16:05 <mflorea> for getMimeType()
16:05 <vmassol> yes
16:05 <mflorea> so without reading the content
16:05 <vmassol> indeed
16:06 <mflorea> now, is it possible to set the header from the ResourceReferenceHandler?
16:06 <mflorea> ah
16:06 <vmassol> yes
16:06 <vmassol> I tihnk so
16:06 <mflorea> setContentType on the response
16:07 <vmassol> that's for sure yes
16:07 <mflorea> ok, I'll make a fix
16:08 <vmassol> thanks
16:08 <vmassol> working on some xwiki presentation ATM ;)
16:08 <mflorea> ok :), I need to do that too, but later
16:25 <Denis> has joined #xwiki
16:47 <Lyes> has joined #xwiki
16:48 <vmassol> bb in 1 hour
16:48 <Lyes1> has quit
17:16 <mflorea> vmassol: adding the new contentType parameter requires a new signature for the webjars.url method, and it doesn't fill right to add a map for this. I don't see other use cases, I mean other params that we may need. Moreover, we already have the input stream and Tika is reading only a few bytes from the start, resetting the input stream afterwards, so it shouldn't affect the performance.
17:17 <mflorea> I'm going to use only tika for now. We can add support for overwriting Tika later
17:33 <evalica> has quit
17:36 <Enygma`> has quit
17:45 <tmortagne> mflorea: it's probably possible keep an instance of the DefaultDetector and reuse it instead of recreating it at each request
17:46 <mflorea> tmortagne: right, but is it thread safe?
17:46 <mflorea> it should be
17:46 <tmortagne> I don't see why not since we don't modify it
17:46 <tmortagne> it should be ok
17:53 <sdumitriu> has quit
17:56 <sdumitriu> has joined #xwiki
18:10 <xwikibot> has joined #xwiki
18:17 <gdelhumeau> has quit
18:17 <Denis> has quit
18:28 <mflorea> has quit
18:48 <tmortagne> has quit
18:57 <cjd> has quit
19:02 <andreeapopescu> has left #xwiki
19:13 <woshilapin> has quit
19:27 <Slashman> has quit
19:45 <vmassol> sdumitriu: cool to see you committing clean up  stuff :)
19:48 <abusenius> has joined #xwiki
20:29 <Lyes> has quit
20:57 <lucaa> has quit
21:15 <sdumitriu> vmassol: MockitoComponentMockingRule should call MockitoAnnotations.initMocks, so that we can have @Mock fields
21:15 <sdumitriu> WDYT?
22:28 <OSIMasson> has joined #xwiki
22:31 <Lyes> has joined #xwiki
22:45 <Lyes> has quit
22:58 <OSIMasson> has quit
23:37 <vmassol> sdumitriu: I don't know this feature well, would need to read up on it a bit more to have an opinion. Not sure it's useful though since writing mock(SomeInterface.class) is not really hard
23:39 <sdumitriu> vmassol: If a mock is used in many places, you can:
23:41 <sdumitriu> 1. use a class field initialized in a @Before method
23:41 <vmassol> sdumitriu: time for bed for me, if you think it's useful either go ahead or send an email on the list to propose it
23:41 <sdumitriu> 2. copy paste a lot of mock(class) code between methods
23:41 <sdumitriu> 3. user a @Mock class field
23:42 <sdumitriu> 3 seems the better choice
23:42 <vmassol> would be interesting to see how some of our current code can be improved by this but I'm really not sure
23:42 <vmassol> since you need to set up expectations anyway
23:42 <vmassol> (which we do in a @Before if you need to share the mock)
23:43 <vmassol> I really need to go now :)
23:43 <vmassol> nn
23:43 <sdumitriu> K, good night
23:43 <vmassol> sry
23:43 <vmassol> I'm not against it, just not sure how useful it is
23:43 <vmassol> has quit
Tags:
   

Get Connected