Moodle
  1. Moodle
  2. MDL-34910

Remove the "Blog about this (Course|module instance name)" link when the course or instance doesn't allows new blog entries

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2, 2.3
    • Fix Version/s: 2.4
    • Component/s: Blog
    • Labels:
    • Testing Instructions:
      Hide
      1. Logged as an admin enable blog associations (useblogassociations) going to the admin tree -> apparence -> blog
      2. Logged as a teacher go to a course
      3. Add the "blog menu" block
      4. Click "Add an entry about this course" and fill the form ensuring "Blog about course COURSENAME" is checked
      5. Copy in the clipboard the URL where you are redirected, you SHOULD see a link on the upper part to add a new blog entry about this course
      6. Logged as an admin go to the course administration -> users -> Permissions, select "Teacher" role and prevent the capability "moodle/blog:associatecourse", do the same with the "Authenticated user" role
      7. Paste the clipboard URL in the browser, the link SHOULD NOT appear
      8. Create a module instance of any kind and view it
      9. Add the "blog menu" block to the module instance page
      10. Click "Add an entry about this ACTIVITY" and fill the form ensuring "Blog about ACTIVITY ACTIVITYNAME" is checked
      11. Copy in the clipboard the URL where you are redirected, here you SHOULD see a link on the upper part to add a new blog entry about this activity
      12. Logged as an admin go to the course administration -> users -> Permissions, select "Teacher" role and prevent the capability "moodle/blog:associatemodule", do the same with the "Authenticated user" role
      13. Paste the clipboard URL in the browser, the link SHOULD NOT appear
      Show
      Logged as an admin enable blog associations (useblogassociations) going to the admin tree -> apparence -> blog Logged as a teacher go to a course Add the "blog menu" block Click "Add an entry about this course" and fill the form ensuring "Blog about course COURSENAME" is checked Copy in the clipboard the URL where you are redirected, you SHOULD see a link on the upper part to add a new blog entry about this course Logged as an admin go to the course administration -> users -> Permissions, select "Teacher" role and prevent the capability "moodle/blog:associatecourse", do the same with the "Authenticated user" role Paste the clipboard URL in the browser, the link SHOULD NOT appear Create a module instance of any kind and view it Add the "blog menu" block to the module instance page Click "Add an entry about this ACTIVITY" and fill the form ensuring "Blog about ACTIVITY ACTIVITYNAME" is checked Copy in the clipboard the URL where you are redirected, here you SHOULD see a link on the upper part to add a new blog entry about this activity Logged as an admin go to the course administration -> users -> Permissions, select "Teacher" role and prevent the capability "moodle/blog:associatemodule", do the same with the "Authenticated user" role Paste the clipboard URL in the browser, the link SHOULD NOT appear
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-34910_master
    • Rank:
      43436

      Description

      Viewing the list of associations between a blog entry and module instances or courses there is a link to add a new related blog entry. This link should not appear if the context doesn't allow blog associations.

      To replicate the problem:

      1. Enable blog associations to courses or modules
      2. Go to a course or module instance and add the blog menu block
      3. Add a new entry associated to the course or the module instance
      4. View the entry and copy the URL to the clipboard
      5. Remove the capability to associate courses or modules to blog entries at the course or module instance context (depending on the association you made)
      6. If you paste the copied URL you can see the link to add a new related blog entry, that link should not appear

        Issue Links

          Activity

          Hide
          Dan Poltawski added a comment -

          Sending all 'waiting for peer review' issues to integration before freeze, as agreed in Integrators Meeting 19/10/12. We are doing this to ensure any 'integratable issues' will not got missed before freeze..

          Show
          Dan Poltawski added a comment - Sending all 'waiting for peer review' issues to integration before freeze, as agreed in Integrators Meeting 19/10/12. We are doing this to ensure any 'integratable issues' will not got missed before freeze..
          Hide
          Dan Poltawski added a comment -

          Hi David,

          '$cantaddentries' is a negative word (I mean, it means I can NOT add entries) and we try to avoid such 'negative' flags, since they are harder to read.

          But actually from the code, it looks like this should be named $canaddentries, because that is what you are testing for? In which case the variable is incorrectly named and should be a positive name.

          Either way, its best if you make this a 'positive' flag.

          Show
          Dan Poltawski added a comment - Hi David, '$cantaddentries' is a negative word (I mean, it means I can NOT add entries) and we try to avoid such 'negative' flags, since they are harder to read. But actually from the code, it looks like this should be named $canaddentries, because that is what you are testing for? In which case the variable is incorrectly named and should be a positive name. Either way, its best if you make this a 'positive' flag.
          Hide
          David Monllaó added a comment -

          Hi Dan,

          Changed to $canaddentries and rebased. Thanks

          Show
          David Monllaó added a comment - Hi Dan, Changed to $canaddentries and rebased. Thanks
          Hide
          Dan Poltawski added a comment -

          Integrated to master.

          Thanks David

          Show
          Dan Poltawski added a comment - Integrated to master. Thanks David
          Hide
          Frédéric Massart added a comment -

          Failing this test.

          When a teacher, adding an entry about a module, there is an error while validating the form. After pushing David's patch trying to fix this, then I don't see the link to add another entry about that module on the redirected page even though I have the capability.

          Show
          Frédéric Massart added a comment - Failing this test. When a teacher, adding an entry about a module, there is an error while validating the form. After pushing David's patch trying to fix this, then I don't see the link to add another entry about that module on the redirected page even though I have the capability.
          Hide
          Dan Poltawski added a comment - - edited

          Pulled in Davids fix for this, Thanks!

          Show
          Dan Poltawski added a comment - - edited Pulled in Davids fix for this, Thanks!
          Show
          David Monllaó added a comment - Hi, fix commit url: https://github.com/dmonllao/moodle/commit/207b6fc5f19f2b7f6a4d4abb9fdb21baee6849ff
          Hide
          Frédéric Massart added a comment -

          Test passed on master. Thanks!

          Show
          Frédéric Massart added a comment - Test passed on master. Thanks!
          Hide
          Dan Poltawski added a comment -

          Hurray!

          You did it, congratulations! You have on Mojito credit to redeem after the release of Moodle 2.4

          Show
          Dan Poltawski added a comment - Hurray! You did it, congratulations! You have on Mojito credit to redeem after the release of Moodle 2.4

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: