User able to edit title of locked post (still/again possible)

What is the purpose of locking posts then? There is none. Or I have not found one, thus the feature is either obsolete, dysfunctional, or at least confusing.

image

The text clearly says “a staff member has locked this post from being edited”. If locking has a completely different purpose than protecting the post/topic OP from being edited this text should be changed.

Locked posts should NOT be editable by non-staff users, despite the setting that high trust level posters can edit posts (which we like in general, but not for locked posts of course).

As it seems from the code below “locking” a post currently means that ONLY the OP of the post can’t edit the post anymore. TL3, TL4 (and staff) are still able to edit a locked post (if enabled in the settings).

This is very much limiting the locking feature to an extremely limited use case.

How do I protect a very important official admin announcement from one rogue TL3 user to be changed into “This is a Micky Mouse post” and being tagged the wrong way and moved into a non-relevant category, but still want to have TL3/TL4 user have the ability to edit posts in general?

Locked should mean locked (e.g. uneditable) for all besides staff.

  def can_edit_topic?(topic)
    return false if Discourse.static_doc_topic_ids.include?(topic.id) && !is_admin?
    return false unless can_see?(topic)

    return true if is_admin?
    return true if is_moderator? && can_create_post?(topic)

    # can't edit topics in secured categories where you don't have permission to create topics
    # except for a tiny edge case where the topic is uncategorized and you are trying
    # to fix it but uncategorized is disabled
    if (
      SiteSetting.allow_uncategorized_topics ||
      topic.category_id != SiteSetting.uncategorized_category_id
    )
      return false if !can_create_topic_on_category?(topic.category)
    end

    # TL4 users can edit archived topics, but can not edit private messages
    return true if (
      SiteSetting.trusted_users_can_edit_others? &&
      topic.archived &&
      !topic.private_message? &&
      user.has_trust_level?(TrustLevel[4]) &&
      can_create_post?(topic)
    )

    # TL3 users can not edit archived topics and private messages
    return true if (
      SiteSetting.trusted_users_can_edit_others? &&
      !topic.archived &&
      !topic.private_message? &&
      user.has_trust_level?(TrustLevel[3]) &&
      can_create_post?(topic)
    )

    return false if topic.archived
    is_my_own?(topic) &&
      !topic.edit_time_limit_expired?(user) &&
      **!Post.where(topic_id: topic.id, post_number: 1).where.not(locked_by_id: nil).exists?**
  end
2 Likes